Fix handling of LWIP_HOOK_VLAN_SET(). Previous implementation supplied uninitialized arguments to the macro (struct eth_hdr).

Change macro signature to be universal: netif, pbuf, src, dst, eth_type - whatever the user needs to decide about VLAN header.
Return value <0 means "no VLAN header", 0 <= return_value <= 0xFFFF -> value is prio_vid of header.
Clean up ethernet_output function to be more readable.
This commit is contained in:
Dirk Ziegelmeier
2016-08-25 14:07:35 +02:00
parent a2ca85a260
commit 475d49440c
3 changed files with 47 additions and 39 deletions

View File

@@ -2495,17 +2495,20 @@
/**
* LWIP_HOOK_VLAN_SET(netif, eth_hdr, vlan_hdr):
* - called from etharp_raw() and ethernet_output() if VLAN support is enabled
* - netif: struct netif that the packet will be sent through
* - eth_hdr: struct eth_hdr of the packet
* - vlan_hdr: struct eth_vlan_hdr of the packet
* Return values:
* - 0: Packet shall not contain VLAN header.
* - != 0: Packet shall contain VLAN header.
* Hook can be used to set prio_vid field of vlan_hdr.
* Called from ethernet_output() if VLAN support is enabled.
* Arguments:
* - netif: struct netif that the packet will be sent through
* - p: struct pbuf packet to be sent
* - src: source eth address
* - dst: destination eth address
* - eth_type: ethernet type to packet to be sent
* Return values:
* - <0: Packet shall not contain VLAN header.
* - 0 <= return value <= 0xFFFF: Packet shall contain VLAN header. Return value is prio_vid in host byte order.
*/
#ifdef __DOXYGEN__
#define LWIP_HOOK_VLAN_SET(netif, eth_hdr, vlan_hdr)
#define LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type)
#endif
/**