Chore: move stack & device to core

This commit is contained in:
xjasonlyu
2021-02-07 18:49:55 +08:00
parent 669a601f1a
commit ace24826d2
18 changed files with 9 additions and 9 deletions

24
core/stack/icmp.go Executable file
View File

@@ -0,0 +1,24 @@
package stack
import (
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/header"
)
func withICMPHandler() Option {
return func(s *Stack) error {
// Add default route table for IPv4 and IPv6.
// This will handle all incoming ICMP packets.
s.SetRouteTable([]tcpip.Route{
{
Destination: header.IPv4EmptySubnet,
NIC: s.nicID,
},
{
Destination: header.IPv6EmptySubnet,
NIC: s.nicID,
},
})
return nil
}
}