diff --git a/src/core/ipv4/ip.c b/src/core/ipv4/ip.c index a317ae42..368d9776 100644 --- a/src/core/ipv4/ip.c +++ b/src/core/ipv4/ip.c @@ -238,11 +238,8 @@ ip_input(struct pbuf *p, struct netif *inp) { { /* unicast to this interface address? */ if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) || - /* or broadcast matching this interface network address? */ - (ip_addr_isbroadcast(&(iphdr->dest), netif) && - ip_addr_netcmp(&(iphdr->dest), &(netif->ip_addr), &(netif->netmask))) || - /* or restricted broadcast? */ - ip_addr_cmp(&(iphdr->dest), IP_ADDR_BROADCAST)) { + /* or broadcast on this interface network address? */ + ip_addr_isbroadcast(&(iphdr->dest), netif)) { LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet accepted on interface %c%c\n", netif->name[0], netif->name[1])); /* break out of for loop */ diff --git a/src/core/ipv4/ip_addr.c b/src/core/ipv4/ip_addr.c index 55c9b4f4..366ae8c3 100644 --- a/src/core/ipv4/ip_addr.c +++ b/src/core/ipv4/ip_addr.c @@ -60,11 +60,12 @@ u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif) /* address matches network interface address exactly? => no broadcast */ else if (addr->addr == netif->ip_addr.addr) return 0; - /* on the same (sub) network and - * host identifier bits are all ones? => network broadcast address */ + /* on the same (sub) network... */ else if (ip_addr_netcmp(addr->addr, netif->ip_addr.addr, netif->netmask.addr)) + /* ...and host identifier bits are all ones? =>... */ && ((addr->addr & ~netif->netmask.addr) == (ip_addr_broadcast.addr & ~netif->netmask.addr)) + /* => network broadcast address */ return 1; else return 0;