From d656e9f28e8eaf988042d7430bd631e4dbe9fbff Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 10 May 2010 14:10:46 +0000 Subject: [PATCH] Added option LWIP_ARP_FILTER_NETIF to use multiple IPs on one hardware interface (by using multiple netifs, each with its own IP) --- src/include/netif/etharp.h | 10 ++++++++++ src/netif/etharp.c | 4 ++++ 2 files changed, 14 insertions(+) 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? */