From fd3e153a043941c6f72d7f1c9cfaecdd537a490e Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 23 Sep 2019 18:47:13 +0300 Subject: [PATCH] - dhcp: don't replace a static lease with a dynamic one --- dhcpd/dhcpd.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dhcpd/dhcpd.go b/dhcpd/dhcpd.go index b95982a1..3163c753 100644 --- a/dhcpd/dhcpd.go +++ b/dhcpd/dhcpd.go @@ -506,7 +506,9 @@ func (s *Server) handleDHCP4Request(p dhcp4.Packet, options dhcp4.Options) dhcp4 return dhcp4.ReplyPacket(p, dhcp4.NAK, s.ipnet.IP, nil, 0, nil) } - lease.Expiry = time.Now().Add(s.leaseTime) + if lease.Expiry.Unix() != leaseExpireStatic { + lease.Expiry = time.Now().Add(s.leaseTime) + } log.Tracef("Replying with ACK. IP: %s HW: %s Expire: %s", lease.IP, lease.HWAddr, lease.Expiry) opt := s.leaseOptions.SelectOrderOrAll(options[dhcp4.OptionParameterRequestList])