Skip to content

Commit a94e306

Browse files
committed
[dhcpv4/dhcpv6] Adding Selector function for dropping packets that do not meet user-defined conditions.
Signed-off-by: 63818569 <[email protected]>
1 parent 59ad830 commit a94e306

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dhcpv4/client4/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (c *Client) getRemoteUDPAddr() (*net.UDPAddr, error) {
181181
// ordered as Discovery, Offer, Request and Acknowledge. In case of errors, an
182182
// error is returned, and the list of DHCPv4 objects will be shorted than 4,
183183
// containing all the sent and received DHCPv4 messages.
184-
func (c *Client) Exchange(ifname string, selector dhcpv4.Selector,modifiers ...dhcpv4.Modifier) ([]*dhcpv4.DHCPv4, error) {
184+
func (c *Client) Exchange(ifname string, selector dhcpv4.Selector, modifiers ...dhcpv4.Modifier) ([]*dhcpv4.DHCPv4, error) {
185185
conversation := make([]*dhcpv4.DHCPv4, 0)
186186
raddr, err := c.getRemoteUDPAddr()
187187
if err != nil {
@@ -333,7 +333,7 @@ func (c *Client) SendReceive(sendFd, recvFd int, packet *dhcpv4.DHCPv4, messageT
333333
if response.TransactionID != packet.TransactionID {
334334
continue
335335
}
336-
if !selector(response){
336+
if !selector(response) {
337337
continue
338338
}
339339
// wait for a response message

0 commit comments

Comments
 (0)