summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDmitrii Okunev <xaionaro@fb.com>2019-11-29 10:50:55 +0000
committerDmitrii Okunev <xaionaro@fb.com>2019-11-29 10:50:55 +0000
commit73d51e8973f7e89fe1d2a988aaef7739c8696dd4 (patch)
treed5a56356d4af33f243c093e783c8ad9a4b528857
parent92b156c5580501ec2a4e8a504edbc3db55d7df82 (diff)
Added option nclient4.WithHWAddr
This option allows to receive answers DHCP with arbitrary client addresses Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>
-rw-r--r--dhcpv4/nclient4/client.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/dhcpv4/nclient4/client.go b/dhcpv4/nclient4/client.go
index 17af89c..a1596a5 100644
--- a/dhcpv4/nclient4/client.go
+++ b/dhcpv4/nclient4/client.go
@@ -362,6 +362,15 @@ func WithUnicast(srcAddr *net.UDPAddr) ClientOpt {
}
}
+// WithHWAddr tells to the Client to receive messages destinated to selected
+// hardware address
+func WithHWAddr(hwAddr net.HardwareAddr) ClientOpt {
+ return func(c *Client) (err error) {
+ c.ifaceHWAddr = hwAddr
+ return
+ }
+}
+
func withBufferCap(n int) ClientOpt {
return func(c *Client) (err error) {
c.bufferCap = n