From a316f83977e2a8d0b2746985342fb400472645ae Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 21 Aug 2018 15:25:50 -0700 Subject: Expose route table PiperOrigin-RevId: 209670528 Change-Id: I2890bcdef36f0b5f24b372b42cf628b38dd5764e --- pkg/tcpip/stack/stack.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/tcpip') diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go index e2b9dc2c0..e09c7efda 100644 --- a/pkg/tcpip/stack/stack.go +++ b/pkg/tcpip/stack/stack.go @@ -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] -- cgit v1.2.3