diff options
author | Thomas Habets <habets@google.com> | 2022-03-01 16:53:24 +0000 |
---|---|---|
committer | Thomas Habets <habets@google.com> | 2022-03-01 16:53:24 +0000 |
commit | 21a2269eb6a8c26845b798e7f71a51d29fa0a6b8 (patch) | |
tree | 3095bb10d18eecb131157fa8045e8fa4127aa06c | |
parent | 5f6f15cadfd41d43ed22dbfbaa8e6a1a509ee58e (diff) | |
download | arping-21a2269eb6a8c26845b798e7f71a51d29fa0a6b8.tar.gz |
For dot1q: check that reply actually is dot1q
-rw-r--r-- | src/arping.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/arping.c b/src/arping.c index 76ddc2d..6797c80 100644 --- a/src/arping.c +++ b/src/arping.c @@ -1355,6 +1355,12 @@ pingip_recv(const char *unused, struct pcap_pkthdr *h, const char * const packet } if (veth) { + if (veth->vlan_tpi != htons(0x8100)) { + return; + } + if (verbose > 3) { + printf("arping: ... is dot1q\n"); + } if ((veth->vlan_priority_c_vid & 0xfff) == vlan_tag) { return; } @@ -1363,6 +1369,9 @@ pingip_recv(const char *unused, struct pcap_pkthdr *h, const char * const packet } } + // Not checking ethertype because in theory this could be used for + // Ethernet II. + // Wrong length of hardware address. if (harp->ar_hln != ETH_ALEN) { return; @@ -1557,6 +1566,12 @@ pingmac_recv(const char* unused, struct pcap_pkthdr *h, uint8_t *packet) } if (veth) { + if (veth->vlan_tpi != htons(0x8100)) { + return; + } + if (verbose > 3) { + printf("arping: ... is dot1q\n"); + } if ((veth->vlan_priority_c_vid & 0xfff) == vlan_tag) { return; } @@ -1565,6 +1580,9 @@ pingmac_recv(const char* unused, struct pcap_pkthdr *h, uint8_t *packet) } } + // Not checking ethertype because in theory this could be used for + // Ethernet II. + // Dest MAC must be me. if (memcmp(pkt_dstmac, srcmac, ETH_ALEN)) { return; |