mirror of
https://github.com/maride/pancap.git
synced 2024-12-22 20:27:29 +00:00
Fix usage of appendIfUnique
This commit is contained in:
parent
c01d1f49c2
commit
27a06c0cd2
@ -33,14 +33,14 @@ func ProcessARPPacket(packet gopacket.Packet) error {
|
||||
if arppacket.Operation == layers.ARPRequest {
|
||||
// Request packet
|
||||
participant.asked++
|
||||
appendIfUnique(net.IP(arppacket.DstProtAddress).String(), participant.askedList)
|
||||
participant.askedList = appendIfUnique(net.IP(arppacket.DstProtAddress).String(), participant.askedList)
|
||||
|
||||
// Add device entry
|
||||
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
||||
} else {
|
||||
// Response packet
|
||||
participant.answered++
|
||||
appendIfUnique(net.IP(arppacket.SourceProtAddress).String(), participant.answeredList)
|
||||
participant.answeredList = appendIfUnique(net.IP(arppacket.SourceProtAddress).String(), participant.answeredList)
|
||||
|
||||
// Add device entry
|
||||
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
||||
|
@ -42,7 +42,7 @@ func HandleDHCPv4Packet(packet gopacket.Packet) error {
|
||||
// Examine packet further
|
||||
if dhcppacket.Operation == layers.DHCPOpRequest {
|
||||
// Request packet
|
||||
appendIfUnique(dhcppacket.ClientHWAddr.String(), requestMAC)
|
||||
requestMAC = appendIfUnique(dhcppacket.ClientHWAddr.String(), requestMAC)
|
||||
} else {
|
||||
// Response/Offer packet
|
||||
addResponseEntry(dhcppacket.ClientIP.String(), dhcppacket.YourClientIP.String(), dhcppacket.ClientHWAddr.String(), ethernetpacket.SrcMAC.String())
|
||||
|
Loading…
Reference in New Issue
Block a user