Tweak persistent DHCP client

This commit is contained in:
Jack O'Sullivan 2021-06-11 00:38:04 +01:00
parent f5faea00b6
commit 5ec8126818

View File

@ -124,6 +124,10 @@ func (m *dhcpManager) setupClient(v6 bool) (chan error, error) {
v6Str = "v6"
}
log.
WithFields(m.logFields(v6)).
Info("Starting persistent DHCP client")
client, err := udhcpc.NewDHCPClient(m.ctrLink.Attrs().Name, &udhcpc.DHCPClientOptions{
Hostname: m.hostname,
V6: v6,
@ -185,9 +189,11 @@ func (m *dhcpManager) setupClient(v6 bool) (chan error, error) {
}
case <-m.stopChan:
log.WithFields(m.logFields(v6)).Info("Shutting down persistent DHCP client")
log.
WithFields(m.logFields(v6)).
Info("Shutting down persistent DHCP client")
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
errChan <- client.Finish(ctx)