From c7be96ac2ea96f9773eb66fdef199e4aa28892bf Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 1 Jan 2019 10:44:31 +0100 Subject: [PATCH] dhcp4d: fix IP address comparison MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AFAICT, this wasn’t actually a bug: canLease performs the correct check. --- internal/dhcp4d/dhcp4d.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/dhcp4d/dhcp4d.go b/internal/dhcp4d/dhcp4d.go index feb2f8a..ea84de2 100644 --- a/internal/dhcp4d/dhcp4d.go +++ b/internal/dhcp4d/dhcp4d.go @@ -16,7 +16,6 @@ package dhcp4d import ( - "bytes" "log" "math/rand" "net" @@ -226,7 +225,7 @@ func (h *Handler) serveDHCP(p dhcp4.Packet, msgType dhcp4.MessageType, options d hwAddr := p.CHAddr().String() // try to offer the requested IP, if any and available - if !bytes.Equal(reqIP.To4(), net.IPv4zero) { + if !reqIP.To4().Equal(net.IPv4zero) { free = h.canLease(reqIP, hwAddr) //log.Printf("canLease(%v, %s) = %d", reqIP, hwAddr, free) }