mirror of
https://github.com/maride/pancap.git
synced 2024-11-22 16:54:25 +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 {
|
if arppacket.Operation == layers.ARPRequest {
|
||||||
// Request packet
|
// Request packet
|
||||||
participant.asked++
|
participant.asked++
|
||||||
appendIfUnique(net.IP(arppacket.DstProtAddress).String(), participant.askedList)
|
participant.askedList = appendIfUnique(net.IP(arppacket.DstProtAddress).String(), participant.askedList)
|
||||||
|
|
||||||
// Add device entry
|
// Add device entry
|
||||||
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
||||||
} else {
|
} else {
|
||||||
// Response packet
|
// Response packet
|
||||||
participant.answered++
|
participant.answered++
|
||||||
appendIfUnique(net.IP(arppacket.SourceProtAddress).String(), participant.answeredList)
|
participant.answeredList = appendIfUnique(net.IP(arppacket.SourceProtAddress).String(), participant.answeredList)
|
||||||
|
|
||||||
// Add device entry
|
// Add device entry
|
||||||
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
addDeviceEntry(sourceAddr, net.IP(arppacket.SourceProtAddress).String())
|
||||||
|
@ -42,7 +42,7 @@ func HandleDHCPv4Packet(packet gopacket.Packet) error {
|
|||||||
// Examine packet further
|
// Examine packet further
|
||||||
if dhcppacket.Operation == layers.DHCPOpRequest {
|
if dhcppacket.Operation == layers.DHCPOpRequest {
|
||||||
// Request packet
|
// Request packet
|
||||||
appendIfUnique(dhcppacket.ClientHWAddr.String(), requestMAC)
|
requestMAC = appendIfUnique(dhcppacket.ClientHWAddr.String(), requestMAC)
|
||||||
} else {
|
} else {
|
||||||
// Response/Offer packet
|
// Response/Offer packet
|
||||||
addResponseEntry(dhcppacket.ClientIP.String(), dhcppacket.YourClientIP.String(), dhcppacket.ClientHWAddr.String(), ethernetpacket.SrcMAC.String())
|
addResponseEntry(dhcppacket.ClientIP.String(), dhcppacket.YourClientIP.String(), dhcppacket.ClientHWAddr.String(), ethernetpacket.SrcMAC.String())
|
||||||
|
Loading…
Reference in New Issue
Block a user