setVethNetNS moves the veth interface to the specified network namespace.
(vethName string, netNSFd int)
| 705 | |
| 706 | // setVethNetNS moves the veth interface to the specified network namespace. |
| 707 | func 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. |
no test coverage detected