diff --git a/plugins/ipam/dhcp/lease.go b/plugins/ipam/dhcp/lease.go index 4377f58f0..8928c79de 100644 --- a/plugins/ipam/dhcp/lease.go +++ b/plugins/ipam/dhcp/lease.go @@ -234,19 +234,19 @@ func (l *DHCPLease) getAllOptions() dhcp4.Options { } func (l *DHCPLease) acquire() error { - c, err := newDHCPClient(l.link, l.timeout, l.broadcast) - if err != nil { - return err - } - defer c.Close() - if (l.link.Attrs().Flags & net.FlagUp) != net.FlagUp { log.Printf("Link %q down. Attempting to set up", l.link.Attrs().Name) - if err = netlink.LinkSetUp(l.link); err != nil { + if err := netlink.LinkSetUp(l.link); err != nil { return err } } + c, err := newDHCPClient(l.link, l.timeout, l.broadcast) + if err != nil { + return err + } + defer c.Close() + opts := l.getAllOptions() pkt, err := backoffRetry(l.resendMax, func() (*dhcp4.Packet, error) {