diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-05-13 11:22:25 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-13 11:24:20 -0700 |
commit | baa0888f114c586ea490d49a23c3d828fd739b85 (patch) | |
tree | a8091d50e8dbd7dafa0cb46ed20600e9f1d5adfa /pkg/sentry/socket/netstack/stack.go | |
parent | e6a9780f3cca047577db3fe57eeb0d7444030711 (diff) |
Rename SetForwarding to SetForwardingDefaultAndAllNICs
...to make it clear to callers that all interfaces are updated with the
forwarding flag and that future NICs will be created with the new
forwarding state.
PiperOrigin-RevId: 373618435
Diffstat (limited to 'pkg/sentry/socket/netstack/stack.go')
-rw-r--r-- | pkg/sentry/socket/netstack/stack.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/pkg/sentry/socket/netstack/stack.go b/pkg/sentry/socket/netstack/stack.go index b215067cf..9cc1c57d7 100644 --- a/pkg/sentry/socket/netstack/stack.go +++ b/pkg/sentry/socket/netstack/stack.go @@ -470,11 +470,8 @@ func (s *Stack) Forwarding(protocol tcpip.NetworkProtocolNumber) bool { // SetForwarding implements inet.Stack.SetForwarding. func (s *Stack) SetForwarding(protocol tcpip.NetworkProtocolNumber, enable bool) error { - switch protocol { - case ipv4.ProtocolNumber, ipv6.ProtocolNumber: - s.Stack.SetForwarding(protocol, enable) - default: - panic(fmt.Sprintf("SetForwarding(%v) failed: unsupported protocol", protocol)) + if err := s.Stack.SetForwardingDefaultAndAllNICs(protocol, enable); err != nil { + return fmt.Errorf("SetForwardingDefaultAndAllNICs(%d, %t): %s", protocol, enable, err) } return nil } |