mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-09 17:13:49 +08:00
Fixed PBUF_LINK_ENCAPSULATION_HLEN support
PBUF_LINK_ENCAPSULATION_HLEN support was introduced by 6ef7563f and
missed the fact that header size calculation/reservation using
computation like PBUF_LINK_HLEN + PBUF_IP_HLEN + ... are used all over
the source code. Hopefully fixed all of them.
This commit is contained in:
@@ -569,7 +569,7 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
|
||||
pppos->in_tail = NULL;
|
||||
#if IP_FORWARD || LWIP_IPV6_FORWARD
|
||||
/* hide the room for Ethernet forwarding header */
|
||||
pbuf_header(inp, -(s16_t)PBUF_LINK_HLEN);
|
||||
pbuf_header(inp, -(s16_t)(PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN));
|
||||
#endif /* IP_FORWARD || LWIP_IPV6_FORWARD */
|
||||
#if PPP_INPROC_IRQ_SAFE
|
||||
if(tcpip_callback_with_block(pppos_input_callback, inp, 0) != ERR_OK) {
|
||||
@@ -672,12 +672,12 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
|
||||
/* If we haven't started a packet, we need a packet header. */
|
||||
pbuf_alloc_len = 0;
|
||||
#if IP_FORWARD || LWIP_IPV6_FORWARD
|
||||
/* If IP forwarding is enabled we are reserving PBUF_LINK_HLEN bytes so
|
||||
* the packet is being allocated with enough header space to be
|
||||
* forwarded (to Ethernet for example).
|
||||
/* If IP forwarding is enabled we are reserving PBUF_LINK_ENCAPSULATION_HLEN
|
||||
* + PBUF_LINK_HLEN bytes so the packet is being allocated with enough header
|
||||
* space to be forwarded (to Ethernet for example).
|
||||
*/
|
||||
if (pppos->in_head == NULL) {
|
||||
pbuf_alloc_len = PBUF_LINK_HLEN;
|
||||
pbuf_alloc_len = PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN;
|
||||
}
|
||||
#endif /* IP_FORWARD || LWIP_IPV6_FORWARD */
|
||||
next_pbuf = pbuf_alloc(PBUF_RAW, pbuf_alloc_len, PBUF_POOL);
|
||||
|
||||
@@ -252,7 +252,7 @@ slipif_rxbyte(struct netif *netif, u8_t c)
|
||||
if (priv->p == NULL) {
|
||||
/* allocate a new pbuf */
|
||||
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n"));
|
||||
priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN), PBUF_POOL);
|
||||
priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN - PBUF_LINK_ENCAPSULATION_HLEN), PBUF_POOL);
|
||||
|
||||
if (priv->p == NULL) {
|
||||
LINK_STATS_INC(link.drop);
|
||||
|
||||
Reference in New Issue
Block a user