From 55fd81f7756a1d7cd9afb5257f974e0807aa5cee Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Wed, 29 Jun 2016 15:15:30 -0700 Subject: [PATCH] plugins/ptp: set the host veth hwaddr correctly --- plugins/main/ptp/ptp.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/main/ptp/ptp.go b/plugins/main/ptp/ptp.go index cdb35366..014b472c 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