From 27fdec5cb97346a06c30a886884505497825b479 Mon Sep 17 00:00:00 2001 From: SilverBut Date: Sun, 3 Oct 2021 05:56:31 +0800 Subject: [PATCH] dhcp ipam: fix client id First byte of client ID is type, instead of value. See this from RFC2132: Code Len Type Client-Identifier +-----+-----+-----+-----+-----+--- | 61 | n | t1 | i1 | i2 | ... +-----+-----+-----+-----+-----+--- Signed-off-by: SilverBut --- plugins/ipam/dhcp/lease.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/ipam/dhcp/lease.go b/plugins/ipam/dhcp/lease.go index 6fc0ffa6..a2989c6b 100644 --- a/plugins/ipam/dhcp/lease.go +++ b/plugins/ipam/dhcp/lease.go @@ -218,6 +218,10 @@ func (l *DHCPLease) acquire() error { for k, v := range l.optsProviding { opts[k] = v } + // client identifier's first byte is "type" + newClientID := []byte{0} + newClientID = append(newClientID, opts[dhcp4.OptionClientIdentifier]...) + opts[dhcp4.OptionClientIdentifier] = newClientID pkt, err := backoffRetry(l.resendMax, func() (*dhcp4.Packet, error) { ok, ack, err := DhcpRequest(c, opts)