From aeb3834219a78624f3d1dc8e050dd1ec3d38e521 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 25 Aug 2016 14:12:49 +0200 Subject: [PATCH] Add debug assert to my last commit and improve comment in opt.h --- src/include/lwip/opt.h | 1 + src/netif/ethernet.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index d4061d8b..49b6c17b 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -2497,6 +2497,7 @@ * LWIP_HOOK_VLAN_SET(netif, eth_hdr, vlan_hdr): * Hook can be used to set prio_vid field of vlan_hdr. * Called from ethernet_output() if VLAN support is enabled. + * Signature: s32_t my_hook_vlan_set(struct netif* netif, struct pbuf* pbuf, const struct eth_addr* src, const struct eth_addr* dst, u16_t eth_type); * Arguments: * - netif: struct netif that the packet will be sent through * - p: struct pbuf packet to be sent diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c index fffa48f9..681991ee 100644 --- a/src/netif/ethernet.c +++ b/src/netif/ethernet.c @@ -265,6 +265,8 @@ ethernet_output(struct netif* netif, struct pbuf* p, if (vlan_prio_vid >= 0) { struct eth_vlan_hdr* vlanhdr; + LWIP_ASSERT("prio_vid must be <= 0xFFFF", vlan_prio_vid <= 0xFFFF); + if (pbuf_header(p, SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR) != 0) { goto pbuf_header_failed; }