Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mangoyhuang committed Oct 30, 2024
1 parent c0fcc86 commit b4c2297
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions arp_datagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ func (datagram arpDatagram) IsResponseOfTarget(request arpDatagram) bool {
// IsDuplicateRequestOf case: Cisco switch will re-send an ARP request when it received a DAD-ARP request
func (datagram arpDatagram) IsDuplicateRequestOf(request arpDatagram, ignoreCheck bool) bool {
return datagram.oper == requestOper && bytes.Equal(request.tpa, datagram.spa) &&
(!ignoreCheck && bytes.Equal(request.tpa, datagram.tpa))
(ignoreCheck || bytes.Equal(request.tpa, datagram.tpa))
}

// IsResponseOfDADRequest case: H3C switch will reply DAD ARP request when it received a DAD-ARP request
func (datagram arpDatagram) IsResponseOfDADRequest(request arpDatagram, ignoreCheck bool) bool {
return datagram.oper == responseOper && bytes.Equal(request.tpa, datagram.spa) &&
(!ignoreCheck && bytes.Equal(request.tpa, datagram.tpa))

(ignoreCheck || bytes.Equal(request.tpa, datagram.tpa))
}

func parseArpDatagram(buffer []byte) arpDatagram {
Expand Down

0 comments on commit b4c2297

Please sign in to comment.