mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
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:
committed by
gVisor bot
parent
e6a9780f3c
commit
baa0888f11
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user