dhcp4d: copy reqIP, its backing storage gets reused
This commit is contained in:
parent
48fcf2d0ea
commit
32dd03c7f2
@ -172,11 +172,12 @@ func (h *Handler) ServeDHCP(p dhcp4.Packet, msgType dhcp4.MessageType, options d
|
||||
|
||||
lease := &Lease{
|
||||
Num: leaseNum,
|
||||
Addr: reqIP,
|
||||
Addr: make([]byte, 4),
|
||||
HardwareAddr: p.CHAddr().String(),
|
||||
Expiry: time.Now().Add(h.leasePeriod),
|
||||
Hostname: string(options[dhcp4.OptionHostName]),
|
||||
}
|
||||
copy(lease.Addr, reqIP.To4())
|
||||
|
||||
if l, ok := h.leasesHW[lease.HardwareAddr]; ok {
|
||||
if l.Expiry.IsZero() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user