mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-27 07:43:37 +08:00
ETHARP_SUPPORT_VLAN: add support for an external VLAN filter function instead of only checking for one VLAN (define ETHARP_VLAN_CHECK_FN)
This commit is contained in:
@@ -1297,13 +1297,17 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
||||
ETHARP_STATS_INC(etharp.drop);
|
||||
goto free_and_return;
|
||||
}
|
||||
#ifdef ETHARP_VLAN_CHECK /* if not, allow all VLANs */
|
||||
#if defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) /* if not, allow all VLANs */
|
||||
#ifdef ETHARP_VLAN_CHECK_FN
|
||||
if (!ETHARP_VLAN_CHECK_FN(ethhdr, vlan)) {
|
||||
#elif defined(ETHARP_VLAN_CHECK)
|
||||
if (VLAN_ID(vlan) != ETHARP_VLAN_CHECK) {
|
||||
#endif
|
||||
/* silently ignore this packet: not for our VLAN */
|
||||
pbuf_free(p);
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* ETHARP_VLAN_CHECK */
|
||||
#endif /* defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) */
|
||||
type = vlan->tpid;
|
||||
ip_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user