mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 23:15:37 +00: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:
parent
38f619dd6f
commit
d154f5c653
@ -6,6 +6,10 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2011-08-26: Simon Goldschmidt
|
||||||
|
* etharp.c: ETHARP_SUPPORT_VLAN: add support for an external VLAN filter
|
||||||
|
function instead of only checking for one VLAN (define ETHARP_VLAN_CHECK_FN)
|
||||||
|
|
||||||
2011-06-26: Simon Goldschmidt (patch by Cameron Gutman)
|
2011-06-26: Simon Goldschmidt (patch by Cameron Gutman)
|
||||||
* tcp.c, tcp_out.c: bug #33604: added some more asserts to check that
|
* tcp.c, tcp_out.c: bug #33604: added some more asserts to check that
|
||||||
pcb->state != LISTEN
|
pcb->state != LISTEN
|
||||||
|
@ -461,6 +461,8 @@
|
|||||||
* Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
|
* Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check.
|
||||||
* If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
|
* If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted.
|
||||||
* If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
|
* If ETHARP_VLAN_CHECK is not defined, all traffic is accepted.
|
||||||
|
* Alternatively, define a function/define ETHARP_VLAN_CHECK_FN(eth_hdr, vlan)
|
||||||
|
* that returns 1 to accept a packet or 0 to drop a packet.
|
||||||
*/
|
*/
|
||||||
#ifndef ETHARP_SUPPORT_VLAN
|
#ifndef ETHARP_SUPPORT_VLAN
|
||||||
#define ETHARP_SUPPORT_VLAN 0
|
#define ETHARP_SUPPORT_VLAN 0
|
||||||
|
@ -1293,13 +1293,17 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
|||||||
ETHARP_STATS_INC(etharp.drop);
|
ETHARP_STATS_INC(etharp.drop);
|
||||||
goto free_and_return;
|
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) {
|
if (VLAN_ID(vlan) != ETHARP_VLAN_CHECK) {
|
||||||
|
#endif
|
||||||
/* silently ignore this packet: not for our VLAN */
|
/* silently ignore this packet: not for our VLAN */
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
#endif /* ETHARP_VLAN_CHECK */
|
#endif /* defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) */
|
||||||
type = vlan->tpid;
|
type = vlan->tpid;
|
||||||
ip_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR;
|
ip_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user