MCPcopy Index your code
hub / github.com/coder/coder / setVethNetNS

Function setVethNetNS

tailnet/test/integration/network.go:707–719  ·  view source on GitHub ↗

setVethNetNS moves the veth interface to the specified network namespace.

(vethName string, netNSFd int)

Source from the content-addressed store, hash-verified

705
706// setVethNetNS moves the veth interface to the specified network namespace.
707func setVethNetNS(vethName string, netNSFd int) error {
708 veth, err := netlink.LinkByName(vethName)
709 if err != nil {
710 return xerrors.Errorf("LinkByName(%q): %w", vethName, err)
711 }
712
713 err = netlink.LinkSetNsFd(veth, netNSFd)
714 if err != nil {
715 return xerrors.Errorf("LinkSetNsFd(%q, %v): %w", vethName, netNSFd, err)
716 }
717
718 return nil
719}
720
721// setInterfaceIP sets the IP address on the given interface. It automatically
722// adds a /24 subnet mask.

Callers 3

createFakeInternetFunction · 0.85
SetupNetworkingMethod · 0.85
joinBridgeFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected