diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index 922ea924..fe353641 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -450,8 +450,8 @@ ip4_input(struct pbuf *p, struct netif *inp) ip_addr_copy_from_ip4(ip_data.current_iphdr_src, iphdr->src); /* match packet against an interface, i.e. is this packet for us? */ -#if LWIP_IGMP if (ip4_addr_ismulticast(ip4_current_dest_addr())) { +#if LWIP_IGMP if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group(inp, ip4_current_dest_addr()))) { /* IGMP snooping switches need 0.0.0.0 to be allowed as source address (RFC 4541) */ ip4_addr_t allsystems; @@ -464,9 +464,14 @@ ip4_input(struct pbuf *p, struct netif *inp) } else { netif = NULL; } - } else +#else /* LWIP_IGMP */ + if ((netif_is_up(inp)) && (!ip4_addr_isany_val(*netif_ip4_addr(inp)))) { + netif = inp; + } else { + netif = NULL; + } #endif /* LWIP_IGMP */ - { + } else { /* start trying with inp. if that's not acceptable, start walking the list of configured netifs. 'first' is used as a boolean to mark whether we started walking the list */