Skip to content

Commit

Permalink
[dhcpv4/dhcpv6] Adding Selector function for dropping packets that do…
Browse files Browse the repository at this point in the history
… not meet user-defined conditions.
  • Loading branch information
63818569 committed Aug 8, 2021
1 parent 2780f27 commit 3cdd959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dhcpv4/client4/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (c *Client) getRemoteUDPAddr() (*net.UDPAddr, error) {
// ordered as Discovery, Offer, Request and Acknowledge. In case of errors, an
// error is returned, and the list of DHCPv4 objects will be shorted than 4,
// containing all the sent and received DHCPv4 messages.
func (c *Client) Exchange(ifname string, selector dhcpv4.Selector,modifiers ...dhcpv4.Modifier) ([]*dhcpv4.DHCPv4, error) {
func (c *Client) Exchange(ifname string, selector dhcpv4.Selector, modifiers ...dhcpv4.Modifier) ([]*dhcpv4.DHCPv4, error) {
conversation := make([]*dhcpv4.DHCPv4, 0)
raddr, err := c.getRemoteUDPAddr()
if err != nil {
Expand Down Expand Up @@ -333,7 +333,7 @@ func (c *Client) SendReceive(sendFd, recvFd int, packet *dhcpv4.DHCPv4, messageT
if response.TransactionID != packet.TransactionID {
continue
}
if !selector(response){
if !selector(response) {
continue
}
// wait for a response message
Expand Down

0 comments on commit 3cdd959

Please sign in to comment.