mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-10-04 12:01:17 +00:00
pcapif_low_level_input: let IPv6-multicast MAC addresses through, correctly check IPv4-multicast MAC addresses
This commit is contained in:
parent
3a5de6effd
commit
62a162ac66
@ -639,14 +639,21 @@ pcapif_low_level_input(struct netif *netif, const void *packet, int packet_len)
|
|||||||
struct eth_addr *src = dest + 1;
|
struct eth_addr *src = dest + 1;
|
||||||
int unicast;
|
int unicast;
|
||||||
const u8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
const u8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
const u8_t mcast[] = {0x01, 0x00, 0x5e};
|
const u8_t ipv4mcast[] = {0x01, 0x00, 0x5e};
|
||||||
|
const u8_t ipv6mcast[] = {0x33, 0x33};
|
||||||
|
|
||||||
|
/* Don't let feedback packets through (limitation in winpcap?) */
|
||||||
|
if(!memcmp(src, netif->hwaddr, ETHARP_HWADDR_LEN)) {
|
||||||
|
/* don't update counters here! */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* MAC filter: only let my MAC or non-unicast through (pcap receives loopback traffic, too) */
|
/* MAC filter: only let my MAC or non-unicast through (pcap receives loopback traffic, too) */
|
||||||
unicast = ((dest->addr[0] & 0x01) == 0);
|
unicast = ((dest->addr[0] & 0x01) == 0);
|
||||||
if ((memcmp(dest, &netif->hwaddr, ETHARP_HWADDR_LEN) &&
|
if (memcmp(dest, &netif->hwaddr, ETHARP_HWADDR_LEN) &&
|
||||||
memcmp(dest, mcast, 3) && memcmp(dest, bcast, 6)) ||
|
(memcmp(dest, ipv4mcast, 3) || ((dest->addr[3] & 0x80) != 0)) &&
|
||||||
/* and don't let feedback packets through (limitation in winpcap?) */
|
memcmp(dest, ipv6mcast, 2) &&
|
||||||
(!memcmp(src, netif->hwaddr, ETHARP_HWADDR_LEN))) {
|
memcmp(dest, bcast, 6)) {
|
||||||
/* don't update counters here! */
|
/* don't update counters here! */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user