diff options
author | aleksej <aleksej.paschenko@gmail.com> | 2019-10-27 15:14:35 +0300 |
---|---|---|
committer | aleksej <aleksej.paschenko@gmail.com> | 2019-10-27 15:28:15 +0300 |
commit | 352ae1022ce19de28fc72e034cc469872ad79d06 (patch) | |
tree | daab172474c8a917a589a2142fc66ae9cba272c3 /pkg/sentry/inet/test_stack.go | |
parent | 1c480abc39b9957606ff8bf125a5c253ad8a76cb (diff) |
Add /proc/sys/net/ipv4/ip_forward
Diffstat (limited to 'pkg/sentry/inet/test_stack.go')
-rw-r--r-- | pkg/sentry/inet/test_stack.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/sentry/inet/test_stack.go b/pkg/sentry/inet/test_stack.go index b9eed7c3a..c6907cfcb 100644 --- a/pkg/sentry/inet/test_stack.go +++ b/pkg/sentry/inet/test_stack.go @@ -14,6 +14,10 @@ package inet +import ( + "gvisor.dev/gvisor/pkg/tcpip" +) + // TestStack is a dummy implementation of Stack for tests. type TestStack struct { InterfacesMap map[int32]Interface @@ -23,6 +27,7 @@ type TestStack struct { TCPRecvBufSize TCPBufferSize TCPSendBufSize TCPBufferSize TCPSACKFlag bool + IPForwarding bool } // NewTestStack returns a TestStack with no network interfaces. The value of @@ -96,3 +101,14 @@ func (s *TestStack) RouteTable() []Route { // Resume implements Stack.Resume. func (s *TestStack) Resume() { } + +// Forwarding implements inet.Stack.Forwarding. +func (s *TestStack) Forwarding(protocol tcpip.NetworkProtocolNumber) bool { + return s.IPForwarding +} + +// SetForwarding implements inet.Stack.SetForwarding. +func (s *TestStack) SetForwarding(protocol tcpip.NetworkProtocolNumber, enable bool) error { + s.IPForwarding = enable + return nil +} |