diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-03-09 04:45:46 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-09 04:45:46 +0000 |
commit | 8aebd0c66a48e61e0741dccf191190122a42e5c7 (patch) | |
tree | 0753c40620c3a23ccc070fd6bead60b438556a16 /pkg/sentry/inet | |
parent | cb52b569b89f3ca61695fbf07175cf6e4503e168 (diff) | |
parent | abbdcebc543242862fad0984db2db0a842021917 (diff) |
Merge release-20210301.0-29-gabbdcebc5 (automated)
Diffstat (limited to 'pkg/sentry/inet')
-rw-r--r-- | pkg/sentry/inet/inet.go | 8 | ||||
-rw-r--r-- | pkg/sentry/inet/test_stack.go | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/pkg/sentry/inet/inet.go b/pkg/sentry/inet/inet.go index f31277d30..6b71bd3a9 100644 --- a/pkg/sentry/inet/inet.go +++ b/pkg/sentry/inet/inet.go @@ -93,6 +93,14 @@ type Stack interface { // SetForwarding enables or disables packet forwarding between NICs. SetForwarding(protocol tcpip.NetworkProtocolNumber, enable bool) error + + // PortRange returns the UDP and TCP inclusive range of ephemeral ports + // used in both IPv4 and IPv6. + PortRange() (uint16, uint16) + + // SetPortRange sets the UDP and TCP IPv4 and IPv6 ephemeral port range + // (inclusive). + SetPortRange(start uint16, end uint16) error } // Interface contains information about a network interface. diff --git a/pkg/sentry/inet/test_stack.go b/pkg/sentry/inet/test_stack.go index 9ebeba8a3..03e2608c2 100644 --- a/pkg/sentry/inet/test_stack.go +++ b/pkg/sentry/inet/test_stack.go @@ -164,3 +164,15 @@ func (s *TestStack) SetForwarding(protocol tcpip.NetworkProtocolNumber, enable b s.IPForwarding = enable return nil } + +// PortRange implements inet.Stack.PortRange. +func (*TestStack) PortRange() (uint16, uint16) { + // Use the default Linux values per net/ipv4/af_inet.c:inet_init_net(). + return 32768, 28232 +} + +// SetPortRange implements inet.Stack.SetPortRange. +func (*TestStack) SetPortRange(start uint16, end uint16) error { + // No-op. + return nil +} |