pkg/ip: use iface name in SetHWAddrByIP

This commit is contained in:
Stefan Junker
2016-06-29 12:13:05 -07:00
parent 8e1c215116
commit 7d19c01818
4 changed files with 28 additions and 25 deletions

View File

@ -64,7 +64,9 @@ func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string
return err
}
if err := ip.SetHWAddrByIP(hostVeth, pr.IP4.IP.IP, nil /* TODO IPv6 */); err != nil {
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)
}
@ -77,7 +79,7 @@ func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string
return fmt.Errorf("failed to look up %q: %v", ifName, err)
}
if err := ip.SetHWAddrByIP(contVeth, pr.IP4.IP.IP, nil /* TODO IPv6 */); err != nil {
if err := ip.SetHWAddrByIP(contVeth.Attrs().Name, pr.IP4.IP.IP, nil /* TODO IPv6 */); err != nil {
return fmt.Errorf("failed to set hardware addr by IP: %v", err)
}
@ -121,8 +123,6 @@ func setupContainerVeth(netns, ifName string, mtu int, pr *types.Result) (string
}
}
hostVethName = hostVeth.Attrs().Name
return nil
})
return hostVethName, err