mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #3651 from ianlewis:ip-forwarding
PiperOrigin-RevId: 332760843
This commit is contained in:
@@ -412,3 +412,24 @@ func (s *Stack) CleanupEndpoints() []stack.TransportEndpoint {
|
||||
func (s *Stack) RestoreCleanupEndpoints(es []stack.TransportEndpoint) {
|
||||
s.Stack.RestoreCleanupEndpoints(es)
|
||||
}
|
||||
|
||||
// Forwarding implements inet.Stack.Forwarding.
|
||||
func (s *Stack) Forwarding(protocol tcpip.NetworkProtocolNumber) bool {
|
||||
switch protocol {
|
||||
case ipv4.ProtocolNumber, ipv6.ProtocolNumber:
|
||||
return s.Stack.Forwarding(protocol)
|
||||
default:
|
||||
panic(fmt.Sprintf("Forwarding(%v) failed: unsupported protocol", protocol))
|
||||
}
|
||||
}
|
||||
|
||||
// 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))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user