diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index af78f525..51d7b6ad 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -157,6 +157,16 @@ PACK_STRUCT_END #define ARP_REQUEST 1 #define ARP_REPLY 2 +/** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) + * to a filter function that returns the correct netif when using multiple + * netifs on one hardware interface where the netif's low-level receive + * routine cannot decide for the correct netif (e.g. when mapping multiple + * IP addresses to one hardware interface). + */ +#ifndef LWIP_ARP_FILTER_NETIF +#define LWIP_ARP_FILTER_NETIF 0 +#endif + #if ARP_QUEUEING /** struct for queueing outgoing packets for unknown address * defined here to be accessed by memp.h diff --git a/src/netif/etharp.c b/src/netif/etharp.c index fed920c6..42bce4b4 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -1226,6 +1226,10 @@ ethernet_input(struct pbuf *p, struct netif *netif) } #endif /* ETHARP_SUPPORT_VLAN */ +#if LWIP_ARP_FILTER_NETIF + netif = LWIP_ARP_FILTER_NETIF_FN(p, netif, type); +#endif /* LWIP_ARP_FILTER_NETIF*/ + switch (type) { #if LWIP_ARP /* IP packet? */