Add pkg/ip/link_linux.go:SetupVethWithName to support the host-side veth

name configuration.
This commit is contained in:
Koonwah Chen
2019-06-26 10:23:20 -07:00
parent 545a77f4bb
commit 96bd10f679
4 changed files with 18 additions and 10 deletions

View File

@ -283,7 +283,7 @@ func setupVeth(netns ns.NetNS, br *netlink.Bridge, ifName string, mtu int, hairp
err := netns.Do(func(hostNS ns.NetNS) error {
// create the veth pair in the container and move host end into host netns
hostVeth, containerVeth, err := ip.SetupVeth(ifName, "", mtu, hostNS)
hostVeth, containerVeth, err := ip.SetupVeth(ifName, mtu, hostNS)
if err != nil {
return err
}

View File

@ -66,7 +66,7 @@ func setupContainerVeth(netns ns.NetNS, ifName string, mtu int, pr *current.Resu
containerInterface := &current.Interface{}
err := netns.Do(func(hostNS ns.NetNS) error {
hostVeth, contVeth0, err := ip.SetupVeth(ifName, "", mtu, hostNS)
hostVeth, contVeth0, err := ip.SetupVeth(ifName, mtu, hostNS)
if err != nil {
return err
}