From c5c531b3c18081b9a7e9ddb176965c46cde0eb45 Mon Sep 17 00:00:00 2001 From: Akhil Velagapudi <4@4khil.com> Date: Wed, 22 Jun 2022 21:10:47 -0700 Subject: [PATCH] Use the same options for acquiring, renewing lease Currently, hostname is set in the original DHCPREQUEST but not the renewal. With some DHCP server implementations (such as FreeBSD dhcpd), this leads to the hostname being cleared in the lease table. This behavior is inconsistent with other DHCP clients such as dhclient which set the hostname on the renewal request as well. To fix, use the same options for acquire and renew. This is compatible with RFC 2131 (see table 5). Signed-off-by: Akhil Velagapudi <4@4khil.com> --- plugins/ipam/dhcp/lease.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ipam/dhcp/lease.go b/plugins/ipam/dhcp/lease.go index f8311e571..eb321bfb2 100644 --- a/plugins/ipam/dhcp/lease.go +++ b/plugins/ipam/dhcp/lease.go @@ -356,7 +356,7 @@ func (l *DHCPLease) renew() error { } defer c.Close() - opts := l.getOptionsWithClientId() + opts := l.getAllOptions() pkt, err := backoffRetry(l.resendMax, func() (*dhcp4.Packet, error) { ok, ack, err := DhcpRenew(c, *l.ack, opts) switch {