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

Function setInterfaceIP

tailnet/test/integration/network.go:723–730  ·  view source on GitHub ↗

setInterfaceIP sets the IP address on the given interface. It automatically adds a /24 subnet mask.

(netNS *os.File, ifaceName, ip string)

Source from the content-addressed store, hash-verified

721// setInterfaceIP sets the IP address on the given interface. It automatically
722// adds a /24 subnet mask.
723func setInterfaceIP(netNS *os.File, ifaceName, ip string) error {
724 _, err := commandInNetNS(netNS, "ip", []string{"addr", "add", ip + "/24", "dev", ifaceName}).Output()
725 if err != nil {
726 return xerrors.Errorf("set IP %q on interface %q in netns: %w", ip, ifaceName, wrapExitErr(err))
727 }
728
729 return nil
730}
731
732// setInterfaceIP6 sets the IPv6 address on the given interface. It automatically
733// adds a /64 subnet mask.

Callers 2

createFakeInternetFunction · 0.85
joinBridgeFunction · 0.85

Calls 4

commandInNetNSFunction · 0.85
wrapExitErrFunction · 0.85
OutputMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected