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
This commit is contained in:
Ghanan Gowripalan
2021-05-13 11:24:20 -07:00
committed by gVisor bot
parent e6a9780f3c
commit baa0888f11
13 changed files with 59 additions and 52 deletions
+2 -5
View File
@@ -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
}