diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c index 545ce460..b33566bd 100644 --- a/src/netif/ethernet.c +++ b/src/netif/ethernet.c @@ -96,10 +96,6 @@ ethernet_input(struct pbuf *p, struct netif *netif) goto free_and_return; } - if (p->if_idx == NETIF_NO_INDEX) { - p->if_idx = netif_get_index(netif); - } - /* points to packet payload, which starts with an Ethernet header */ ethhdr = (struct eth_hdr *)p->payload; LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, @@ -143,6 +139,10 @@ ethernet_input(struct pbuf *p, struct netif *netif) netif = LWIP_ARP_FILTER_NETIF_FN(p, netif, lwip_htons(type)); #endif /* LWIP_ARP_FILTER_NETIF*/ + if (p->if_idx == NETIF_NO_INDEX) { + p->if_idx = netif_get_index(netif); + } + if (ethhdr->dest.addr[0] & 1) { /* this might be a multicast or broadcast packet */ if (ethhdr->dest.addr[0] == LL_IP4_MULTICAST_ADDR_0) {