mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-13 08:23:56 +08:00
task #14597: cleanup pbuf_header usages (use pbuf_add_header/pbuf_remove_header instead)
This commit is contained in:
@@ -695,7 +695,7 @@ netif_found:
|
||||
hlen = hlen_tot = IP6_HLEN;
|
||||
|
||||
/* Move to payload. */
|
||||
pbuf_header(p, -IP6_HLEN);
|
||||
pbuf_remove_header(p, IP6_HLEN);
|
||||
|
||||
/* Process known option extension headers, if present. */
|
||||
while (nexth != IP6_NEXTH_NONE)
|
||||
@@ -722,7 +722,7 @@ netif_found:
|
||||
nexth = *((u8_t *)p->payload);
|
||||
|
||||
/* Skip over this header. */
|
||||
pbuf_header(p, (s16_t)-(s16_t)hlen);
|
||||
pbuf_remove_header(p, hlen);
|
||||
break;
|
||||
case IP6_NEXTH_DESTOPTS:
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet with Destination options header\n"));
|
||||
@@ -746,7 +746,7 @@ netif_found:
|
||||
nexth = *((u8_t *)p->payload);
|
||||
|
||||
/* Skip over this header. */
|
||||
pbuf_header(p, (s16_t)-(s16_t)hlen);
|
||||
pbuf_remove_header(p, hlen);
|
||||
break;
|
||||
case IP6_NEXTH_ROUTING:
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_input: packet with Routing header\n"));
|
||||
@@ -770,7 +770,7 @@ netif_found:
|
||||
/* Skip over this header. */
|
||||
hlen_tot = (u16_t)(hlen_tot + hlen);
|
||||
|
||||
pbuf_header(p, (s16_t)-(s16_t)hlen);
|
||||
pbuf_remove_header(p, hlen);
|
||||
break;
|
||||
|
||||
case IP6_NEXTH_FRAGMENT:
|
||||
@@ -804,7 +804,7 @@ netif_found:
|
||||
if ((frag_hdr->_fragment_offset &
|
||||
PP_HTONS(IP6_FRAG_OFFSET_MASK | IP6_FRAG_MORE_FLAG)) == 0) {
|
||||
/* This is a 1-fragment packet. Skip this header and continue. */
|
||||
pbuf_header(p, (s16_t)-(s16_t)hlen);
|
||||
pbuf_remove_header(p, hlen);
|
||||
} else {
|
||||
#if LWIP_IPV6_REASS
|
||||
|
||||
@@ -821,7 +821,7 @@ netif_found:
|
||||
ip6hdr = (struct ip6_hdr *)p->payload;
|
||||
nexth = IP6H_NEXTH(ip6hdr);
|
||||
hlen = hlen_tot = IP6_HLEN;
|
||||
pbuf_header(p, -IP6_HLEN);
|
||||
pbuf_remove_header(p, IP6_HLEN);
|
||||
|
||||
#else /* LWIP_IPV6_REASS */
|
||||
/* free (drop) packet pbufs */
|
||||
@@ -863,7 +863,7 @@ options_done:
|
||||
if (raw_input(p, inp) == 0)
|
||||
{
|
||||
/* Point to payload. */
|
||||
pbuf_header(p, (s16_t)-(s16_t)hlen_tot);
|
||||
pbuf_remove_header(p, hlen_tot);
|
||||
#else /* LWIP_RAW */
|
||||
{
|
||||
#endif /* LWIP_RAW */
|
||||
@@ -996,7 +996,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
#endif /* LWIP_IPV6_SCOPES */
|
||||
|
||||
/* generate IPv6 header */
|
||||
if (pbuf_header(p, IP6_HLEN)) {
|
||||
if (pbuf_add_header(p, IP6_HLEN)) {
|
||||
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip6_output: not enough room for IPv6 header in pbuf\n"));
|
||||
IP6_STATS_INC(ip6.err);
|
||||
return ERR_BUF;
|
||||
@@ -1204,7 +1204,7 @@ ip6_options_add_hbh_ra(struct pbuf *p, u8_t nexth, u8_t value)
|
||||
struct ip6_hbh_hdr *hbh_hdr;
|
||||
|
||||
/* Move pointer to make room for hop-by-hop options header. */
|
||||
if (pbuf_header(p, sizeof(struct ip6_hbh_hdr))) {
|
||||
if (pbuf_add_header(p, sizeof(struct ip6_hbh_hdr))) {
|
||||
LWIP_DEBUGF(IP6_DEBUG, ("ip6_options: no space for options header\n"));
|
||||
IP6_STATS_INC(ip6.err);
|
||||
return ERR_BUF;
|
||||
|
||||
@@ -562,11 +562,11 @@ ip6_reass(struct pbuf *p)
|
||||
iprh_tmp = (struct ip6_reass_helper*)next_pbuf->payload;
|
||||
|
||||
/* hide the fragment header for every succeeding fragment */
|
||||
pbuf_header(next_pbuf, -IP6_FRAG_HLEN);
|
||||
pbuf_remove_header(next_pbuf, IP6_FRAG_HLEN);
|
||||
#if IPV6_FRAG_COPYHEADER
|
||||
if (IPV6_FRAG_REQROOM > 0) {
|
||||
/* hide the extra bytes borrowed from ip6_hdr for struct ip6_reass_helper */
|
||||
u8_t hdrerr = pbuf_header(next_pbuf, -(s16_t)(IPV6_FRAG_REQROOM));
|
||||
u8_t hdrerr = pbuf_remove_header(next_pbuf, IPV6_FRAG_REQROOM);
|
||||
LWIP_UNUSED_ARG(hdrerr); /* in case of LWIP_NOASSERT */
|
||||
LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0);
|
||||
}
|
||||
@@ -591,7 +591,7 @@ ip6_reass(struct pbuf *p)
|
||||
* header placed before the fragment header. */
|
||||
MEMCPY(p->payload, ipr->orig_hdr, IPV6_FRAG_REQROOM);
|
||||
/* get back room for struct ip6_reass_helper (only required if sizeof(void*) > 4) */
|
||||
hdrerr = pbuf_header(p, -(s16_t)(IPV6_FRAG_REQROOM));
|
||||
hdrerr = pbuf_remove_header(p, IPV6_FRAG_REQROOM);
|
||||
LWIP_UNUSED_ARG(hdrerr); /* in case of LWIP_NOASSERT */
|
||||
LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0);
|
||||
}
|
||||
@@ -760,7 +760,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
|
||||
(rambuf->len == rambuf->tot_len) && (rambuf->next == NULL));
|
||||
poff += pbuf_copy_partial(p, (u8_t*)rambuf->payload + IP6_FRAG_HLEN, cop, poff);
|
||||
/* make room for the IP header */
|
||||
if (pbuf_header(rambuf, IP6_HLEN)) {
|
||||
if (pbuf_add_header(rambuf, IP6_HLEN)) {
|
||||
pbuf_free(rambuf);
|
||||
IP6_FRAG_STATS_INC(ip6_frag.memerr);
|
||||
return ERR_MEM;
|
||||
|
||||
@@ -561,7 +561,7 @@ mld6_send(struct netif *netif, struct mld_group *group, u8_t type)
|
||||
}
|
||||
|
||||
/* Move to make room for Hop-by-hop options header. */
|
||||
if (pbuf_header(p, -IP6_HBH_HLEN)) {
|
||||
if (pbuf_remove_header(p, IP6_HBH_HLEN)) {
|
||||
pbuf_free(p);
|
||||
MLD6_STATS_INC(mld6.lenerr);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user