summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/stack.go
diff options
context:
space:
mode:
authorGoogler <noreply@google.com>2018-08-21 15:25:50 -0700
committerShentubot <shentubot@google.com>2018-08-21 15:27:09 -0700
commita316f83977e2a8d0b2746985342fb400472645ae (patch)
treeaf0bca77d84943fa2dab245aba3b8b4d70a1f1bb /pkg/tcpip/stack/stack.go
parent19ef2ad1fe82093548edbb00de536d4bcf328f2b (diff)
Expose route table
PiperOrigin-RevId: 209670528 Change-Id: I2890bcdef36f0b5f24b372b42cf628b38dd5764e
Diffstat (limited to 'pkg/tcpip/stack/stack.go')
-rw-r--r--pkg/tcpip/stack/stack.go7
1 files changed, 7 insertions, 0 deletions
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]