From: Stefan Junker Date: Wed, 29 Jun 2016 22:15:30 +0000 (-0700) Subject: plugins/ptp: set the host veth hwaddr correctly X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=55fd81f7756a1d7cd9afb5257f974e0807aa5cee;p=cni.git plugins/ptp: set the host veth hwaddr correctly --- diff --git a/plugins/main/ptp/ptp.go b/plugins/main/ptp/ptp.go index cdb3536..014b472 100644 --- a/plugins/main/ptp/ptp.go +++ b/plugins/main/ptp/ptp.go @@ -64,11 +64,14 @@ func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string return err } - hostVethName = hostVeth.Attrs().Name + hostNS.Do(func(_ ns.NetNS) error { + hostVethName = hostVeth.Attrs().Name + if err := ip.SetHWAddrByIP(hostVethName, pr.IP4.IP.IP, nil /* TODO IPv6 */); err != nil { + return fmt.Errorf("failed to set hardware addr by IP: %v", err) + } - if err := ip.SetHWAddrByIP(hostVethName, pr.IP4.IP.IP, nil /* TODO IPv6 */); err != nil { - return fmt.Errorf("failed to set hardware addr by IP: %v", err) - } + return nil + }) if err = ipam.ConfigureIface(ifName, pr); err != nil { return err