Expose route table

PiperOrigin-RevId: 209670528
Change-Id: I2890bcdef36f0b5f24b372b42cf628b38dd5764e
This commit is contained in:
Googler 2018-08-21 15:25:50 -07:00 committed by Shentubot
parent 19ef2ad1fe
commit a316f83977
1 changed files with 7 additions and 0 deletions

View File

@ -469,6 +469,13 @@ func (s *Stack) SetRouteTable(table []tcpip.Route) {
s.routeTable = table
}
// GetRouteTable returns the route table which is currently in use.
func (s *Stack) GetRouteTable() []tcpip.Route {
s.mu.Lock()
defer s.mu.Unlock()
return append([]tcpip.Route(nil), s.routeTable...)
}
// NewEndpoint creates a new transport layer endpoint of the given protocol.
func (s *Stack) NewEndpoint(transport tcpip.TransportProtocolNumber, network tcpip.NetworkProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, *tcpip.Error) {
t, ok := s.transportProtocols[transport]