Codebase list arping / 5f6f15c
Check received VLAN tag when using -V Thomas Habets 2 years ago
1 changed file(s) with 20 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
13221322 pingip_recv(const char *unused, struct pcap_pkthdr *h, const char * const packet)
13231323 {
13241324 const unsigned char *pkt_srcmac;
1325 const struct libnet_802_1q_hdr *veth;
1325 const struct libnet_802_1q_hdr *veth = NULL;
13261326 struct libnet_802_3_hdr *heth;
13271327 struct libnet_arp_hdr *harp;
13281328 struct timespec arrival;
13511351 }
13521352 if (verbose > 3) {
13531353 printf("arping: ... good length\n");
1354 }
1355
1356 if (veth) {
1357 if ((veth->vlan_priority_c_vid & 0xfff) == vlan_tag) {
1358 return;
1359 }
1360 if (verbose > 3) {
1361 printf("arping: ... right VLAN\n");
1362 }
13541363 }
13551364
13561365 // Wrong length of hardware address.
15101519 {
15111520 const unsigned char *pkt_dstmac;
15121521 const unsigned char *pkt_srcmac;
1513 const struct libnet_802_1q_hdr *veth;
1522 const struct libnet_802_1q_hdr *veth = NULL;
15141523 struct libnet_802_3_hdr *heth;
15151524 struct libnet_ipv4_hdr *hip;
15161525 struct libnet_icmpv4_hdr *hicmp;
15441553 }
15451554 if (verbose > 3) {
15461555 printf("arping: ... good length\n");
1556 }
1557
1558 if (veth) {
1559 if ((veth->vlan_priority_c_vid & 0xfff) == vlan_tag) {
1560 return;
1561 }
1562 if (verbose > 3) {
1563 printf("arping: ... right VLAN\n");
1564 }
15471565 }
15481566
15491567 // Dest MAC must be me.