mirror of
https://github.com/soypat/lneto.git
synced 2026-08-22 23:49:08 +00:00
no dhcp request on zeroed address (#33)
This commit is contained in:
+2
-1
@@ -11,6 +11,7 @@ import (
|
||||
"net/netip"
|
||||
|
||||
"github.com/soypat/lneto"
|
||||
"github.com/soypat/lneto/internal"
|
||||
"github.com/soypat/lneto/ipv4"
|
||||
)
|
||||
|
||||
@@ -90,7 +91,7 @@ func (c *Client) BeginRequest(xid uint32, cfg RequestConfig) error {
|
||||
c.state = StateInit
|
||||
c.currentXID = xid
|
||||
c.reqHostname = cfg.Hostname
|
||||
c.reqIP = addr4{addr: cfg.RequestedAddr, valid: true}
|
||||
c.reqIP = addr4{addr: cfg.RequestedAddr, valid: !internal.IsZeroed(cfg.RequestedAddr[:]...)} // TODO(pato): what's lighter? Comparing the [4]byte or ...byte
|
||||
c.clientMAC = cfg.ClientHardwareAddr
|
||||
if cfg.ClientID != "" {
|
||||
c.clientID = append(c.clientID[:0], cfg.ClientID...)
|
||||
|
||||
Reference in New Issue
Block a user