PBUF_REF with "custom" pbufs is now supported for RX pbufs (see pcapif in contrib for an example, LWIP_SUPPORT_CUSTOM_PBUF is required)

This commit is contained in:
goldsimon 2015-08-31 08:29:23 +02:00
parent b572028e95
commit dd8feb49aa
3 changed files with 17 additions and 8 deletions

View File

@ -6,6 +6,10 @@ HISTORY
++ New features: ++ New features:
2015-08-30: Simon Goldschmidt
* PBUF_REF with "custom" pbufs is now supported for RX pbufs (see pcapif in
contrib for an example, LWIP_SUPPORT_CUSTOM_PBUF is required)
2015-08-30: Simon Goldschmidt 2015-08-30: Simon Goldschmidt
* support IPv4 source based routing: define LWIP_HOOK_IP4_ROUTE_SRC to point * support IPv4 source based routing: define LWIP_HOOK_IP4_ROUTE_SRC to point
to a routing function to a routing function

View File

@ -706,8 +706,7 @@ netif_found:
options_done: options_done:
/* p points to IPv6 header again. */ /* p points to IPv6 header again. */
/* @todo: this does not work for PBUF_REF pbufs */ pbuf_header_force(p, ip_data.current_ip_header_tot_len);
pbuf_header(p, ip_data.current_ip_header_tot_len);
/* send to upper layers */ /* send to upper layers */
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: \n")); LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: \n"));

View File

@ -158,8 +158,9 @@ ip6_reass_free_complete_datagram(struct ip6_reassdata *ipr)
/* First, de-queue the first pbuf from r->p. */ /* First, de-queue the first pbuf from r->p. */
p = ipr->p; p = ipr->p;
ipr->p = iprh->next_pbuf; ipr->p = iprh->next_pbuf;
/* Then, move back to the original header (we are now pointing to Fragment header). */ /* Then, move back to the original ipv6 header (we are now pointing to Fragment header).
if (pbuf_header(p, (s16_t)((u8_t*)p->payload - (u8_t*)IPV6_FRAG_HDRREF(ipr->iphdr)))) { This cannot fail since we already checked when receiving this fragment. */
if (pbuf_header_force(p, (s16_t)((u8_t*)p->payload - (u8_t*)IPV6_FRAG_HDRREF(ipr->iphdr)))) {
LWIP_ASSERT("ip6_reass_free: moving p->payload to ip6 header failed\n", 0); LWIP_ASSERT("ip6_reass_free: moving p->payload to ip6 header failed\n", 0);
} }
else { else {
@ -267,6 +268,9 @@ ip6_reass(struct pbuf *p)
IP6_FRAG_STATS_INC(ip6_frag.recv); IP6_FRAG_STATS_INC(ip6_frag.recv);
LWIP_ASSERT("ip6_frag_hdr must be in the first pbuf, not chained",
(void*)ip6_current_header() == ((u8_t*)p->payload) - IP6_HLEN);
frag_hdr = (struct ip6_frag_hdr *) p->payload; frag_hdr = (struct ip6_frag_hdr *) p->payload;
clen = pbuf_clen(p); clen = pbuf_clen(p);
@ -367,8 +371,9 @@ ip6_reass(struct pbuf *p)
/* Overwrite Fragment Header with our own helper struct. */ /* Overwrite Fragment Header with our own helper struct. */
#if IPV6_FRAG_COPYHEADER #if IPV6_FRAG_COPYHEADER
if (IPV6_FRAG_REQROOM > 0) { if (IPV6_FRAG_REQROOM > 0) {
/* make room for struct ip6_reass_helper (only required if sizeof(void*) > 4) */ /* Make room for struct ip6_reass_helper (only required if sizeof(void*) > 4).
err_t hdrerr = pbuf_header(p, IPV6_FRAG_REQROOM); This cannot fail since we already checked when receiving this fragment. */
err_t hdrerr = pbuf_header_force(p, IPV6_FRAG_REQROOM);
LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == ERR_OK); LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == ERR_OK);
} }
#else /* IPV6_FRAG_COPYHEADER */ #else /* IPV6_FRAG_COPYHEADER */
@ -576,8 +581,9 @@ ip6_reass(struct pbuf *p)
/* adjust the number of pbufs currently queued for reassembly. */ /* adjust the number of pbufs currently queued for reassembly. */
ip6_reass_pbufcount -= pbuf_clen(p); ip6_reass_pbufcount -= pbuf_clen(p);
/* Move pbuf back to IPv6 header. */ /* Move pbuf back to IPv6 header.
if (pbuf_header(p, (s16_t)((u8_t*)p->payload - (u8_t*)iphdr_ptr))) { This cannot fail since we already checked when receiving this fragment. */
if (pbuf_header_force(p, (s16_t)((u8_t*)p->payload - (u8_t*)iphdr_ptr))) {
LWIP_ASSERT("ip6_reass: moving p->payload to ip6 header failed\n", 0); LWIP_ASSERT("ip6_reass: moving p->payload to ip6 header failed\n", 0);
pbuf_free(p); pbuf_free(p);
return NULL; return NULL;