Fix usage of appendIfUnique

This commit is contained in:
maride 2019-11-28 19:28:48 +01:00
parent c01d1f49c2
commit 27a06c0cd2
2 changed files with 3 additions and 3 deletions

View File

@ -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())

View File

@ -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())