diff --git a/src/apps/httpd/httpd.c b/src/apps/httpd/httpd.c index f8d2233f..49669b3f 100644 --- a/src/apps/httpd/httpd.c +++ b/src/apps/httpd/httpd.c @@ -1799,7 +1799,7 @@ http_post_request(struct pbuf *inp, struct http_state *hs, } if (q != NULL) { /* hide the remaining HTTP header */ - pbuf_header(q, -(s16_t)start_offset); + pbuf_remove_header(q, start_offset); #if LWIP_HTTPD_POST_MANUAL_WND if (!post_auto_wnd) { /* already tcp_recved() this data... */ diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index efabe478..a5db43d4 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -471,7 +471,7 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) return ERR_OK; } conn->next_num = 4; /* 24 bytes received... */ - tmp = pbuf_header(p, -24); + tmp = pbuf_remove_header(p, 24); LWIP_ASSERT("pbuf_header failed", tmp == 0); } diff --git a/src/apps/tftp/tftp_server.c b/src/apps/tftp/tftp_server.c index 5009f741..4c3eaa9e 100644 --- a/src/apps/tftp/tftp_server.c +++ b/src/apps/tftp/tftp_server.c @@ -296,7 +296,7 @@ recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16 } blknum = lwip_ntohs(sbuf[1]); - pbuf_header(p, -TFTP_HEADER_LENGTH); + pbuf_remove_header(p, TFTP_HEADER_LENGTH); ret = tftp_state.ctx->write(tftp_state.handle, p); if (ret < 0) { diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c index dbf7349c..8a0a470f 100644 --- a/src/core/ipv4/icmp.c +++ b/src/core/ipv4/icmp.c @@ -152,7 +152,7 @@ icmp_input(struct pbuf *p, struct netif *inp) } #endif #if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN - if (pbuf_header(p, (s16_t)(hlen + PBUF_LINK_HLEN + PBUF_LINK_ENCAPSULATION_HLEN))) { + if (pbuf_add_header(p, hlen + PBUF_LINK_HLEN + PBUF_LINK_ENCAPSULATION_HLEN)) { /* p is not big enough to contain link headers * allocate a new one and copy p into it */ @@ -176,7 +176,7 @@ icmp_input(struct pbuf *p, struct netif *inp) /* copy the ip header */ MEMCPY(r->payload, iphdr_in, hlen); /* switch r->payload back to icmp header (cannot fail) */ - if (pbuf_header(r, (s16_t)-hlen)) { + if (pbuf_remove_header(r, hlen)) { LWIP_ASSERT("icmp_input: moving r->payload to icmp header failed\n", 0); pbuf_free(r); goto icmperr; @@ -193,7 +193,7 @@ icmp_input(struct pbuf *p, struct netif *inp) p = r; } else { /* restore p->payload to point to icmp header (cannot fail) */ - if (pbuf_header(p, (s16_t)-(s16_t)(hlen + PBUF_LINK_HLEN + PBUF_LINK_ENCAPSULATION_HLEN))) { + if (pbuf_remove_header(p, hlen + PBUF_LINK_HLEN + PBUF_LINK_ENCAPSULATION_HLEN)) { LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0); goto icmperr; } @@ -203,7 +203,7 @@ icmp_input(struct pbuf *p, struct netif *inp) /* We generate an answer by switching the dest and src ip addresses, * setting the icmp type to ECHO_RESPONSE and updating the checksum. */ iecho = (struct icmp_echo_hdr *)p->payload; - if (pbuf_header(p, (s16_t)hlen)) { + if (pbuf_add_header(p, hlen)) { LWIP_DEBUGF(ICMP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("Can't move over header in packet")); } else { err_t ret; diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index b7fdf7c4..82f9378a 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -674,7 +674,7 @@ ip4_input(struct pbuf *p, struct netif *inp) if (raw_input(p, inp) == 0) #endif /* LWIP_RAW */ { - pbuf_header(p, (s16_t)-(s16_t)iphdr_hlen); /* Move to payload, no check necessary. */ + pbuf_remove_header(p, iphdr_hlen); /* Move to payload, no check necessary. */ switch (IPH_PROTO(iphdr)) { #if LWIP_UDP @@ -847,7 +847,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d optlen_aligned = (u16_t)((optlen + 3) & ~3); ip_hlen = (u16_t)(ip_hlen + optlen_aligned); /* First write in the IP options */ - if (pbuf_header(p, (s16_t)optlen_aligned)) { + if (pbuf_add_header(p, optlen_aligned)) { LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip4_output_if_opt: not enough room for IP options in pbuf\n")); IP_STATS_INC(ip.err); MIB2_STATS_INC(mib2.ipoutdiscards); @@ -866,7 +866,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d } #endif /* IP_OPTIONS_SEND */ /* generate IP header */ - if (pbuf_header(p, IP_HLEN)) { + if (pbuf_add_header(p, IP_HLEN)) { LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip4_output: not enough room for IP header in pbuf\n")); IP_STATS_INC(ip.err); diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c index 90af970e..91238f9b 100644 --- a/src/core/ipv4/ip4_frag.c +++ b/src/core/ipv4/ip4_frag.c @@ -651,7 +651,7 @@ ip4_reass(struct pbuf *p) iprh = (struct ip_reass_helper*)r->payload; /* hide the ip header for every succeeding fragment */ - pbuf_header(r, -IP_HLEN); + pbuf_remove_header(r, IP_HLEN); pbuf_cat(p, r); r = iprh->next_pbuf; } @@ -779,7 +779,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest) (rambuf->len == rambuf->tot_len) && (rambuf->next == NULL)); poff += pbuf_copy_partial(p, rambuf->payload, fragsize, poff); /* make room for the IP header */ - if (pbuf_header(rambuf, IP_HLEN)) { + if (pbuf_add_header(rambuf, IP_HLEN)) { pbuf_free(rambuf); goto memerr; } diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index 6ee63da1..291b9717 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -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; diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c index 5c36d546..aa33da91 100644 --- a/src/core/ipv6/ip6_frag.c +++ b/src/core/ipv6/ip6_frag.c @@ -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; diff --git a/src/core/ipv6/mld6.c b/src/core/ipv6/mld6.c index 69aa7a8b..b5a159b5 100644 --- a/src/core/ipv6/mld6.c +++ b/src/core/ipv6/mld6.c @@ -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; diff --git a/src/core/raw.c b/src/core/raw.c index 96c75790..be5214e0 100644 --- a/src/core/raw.c +++ b/src/core/raw.c @@ -414,7 +414,7 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, { err_t err; struct pbuf *q; /* q will be sent down the stack */ - s16_t header_size; + u16_t header_size; u8_t ttl; if ((pcb == NULL) || (dst_ip == NULL) || (netif == NULL) || (src_ip == NULL) || @@ -451,7 +451,7 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, return ERR_MEM; } /* not enough space to add an IP header to first pbuf in given p chain? */ - if (pbuf_header(p, header_size)) { + if (pbuf_add_header(p, header_size)) { /* allocate header in new pbuf */ q = pbuf_alloc(PBUF_IP, 0, PBUF_RAM); /* new header pbuf could not be allocated? */ @@ -468,7 +468,7 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, } else { /* first pbuf q equals given pbuf */ q = p; - if (pbuf_header(q, (s16_t)-header_size)) { + if (pbuf_remove_header(q, header_size)) { LWIP_ASSERT("Can't restore header we just removed!", 0); return ERR_MEM; } diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 09898e66..bee160bc 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -178,7 +178,7 @@ tcp_input(struct pbuf *p, struct netif *inp) if (p->len >= hdrlen_bytes) { /* all options are in the first pbuf */ tcphdr_opt1len = tcphdr_optlen; - pbuf_header(p, (s16_t)-(s16_t)hdrlen_bytes); /* cannot fail */ + pbuf_remove_header(p, hdrlen_bytes); /* cannot fail */ } else { u16_t opt2len; /* TCP header fits into first pbuf, options don't - data is in the next pbuf */ @@ -186,7 +186,7 @@ tcp_input(struct pbuf *p, struct netif *inp) LWIP_ASSERT("p->next != NULL", p->next != NULL); /* advance over the TCP header (cannot fail) */ - pbuf_header(p, -TCP_HLEN); + pbuf_remove_header(p, TCP_HLEN); /* determine how long the first and second parts of the options are */ tcphdr_opt1len = p->len; @@ -194,7 +194,7 @@ tcp_input(struct pbuf *p, struct netif *inp) /* options continue in the next pbuf: set p to zero length and hide the options in the next pbuf (adjusting p->tot_len) */ - pbuf_header(p, (s16_t)-(s16_t)tcphdr_opt1len); + pbuf_remove_header(p, tcphdr_opt1len); /* check that the options fit in the second pbuf */ if (opt2len > p->next->len) { @@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp) /* advance p->next to point after the options, and manually adjust p->tot_len to keep it consistent with the changed p->next */ - pbuf_header(p->next, (s16_t)-(s16_t)opt2len); + pbuf_remove_header(p->next, opt2len); p->tot_len = (u16_t)(p->tot_len - opt2len); LWIP_ASSERT("p->len == 0", p->len == 0); diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 3f6ef8ac..2cf2de9e 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -210,7 +210,7 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno, #endif /* TCP_CHECKSUM_ON_COPY */ /* build TCP header */ - if (pbuf_header(p, TCP_HLEN)) { + if (pbuf_add_header(p, TCP_HLEN)) { LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_create_segment: no room for TCP header in pbuf.\n")); TCP_STATS_INC(tcp.err); tcp_seg_free(seg); diff --git a/src/core/udp.c b/src/core/udp.c index 553f6fb6..feed6152 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -342,7 +342,7 @@ udp_input(struct pbuf *p, struct netif *inp) } } #endif /* CHECKSUM_CHECK_UDP */ - if (pbuf_header(p, -UDP_HLEN)) { + if (pbuf_remove_header(p, UDP_HLEN)) { /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); UDP_STATS_INC(udp.drop); @@ -712,7 +712,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d return ERR_MEM; } /* not enough space to add an UDP header to first pbuf in given p chain? */ - if (pbuf_header(p, UDP_HLEN)) { + if (pbuf_add_header(p, UDP_HLEN)) { /* allocate header in a separate new pbuf */ q = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM); /* new header pbuf could not be allocated? */ diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c index 5f3175f5..4a5f554b 100644 --- a/src/netif/ethernet.c +++ b/src/netif/ethernet.c @@ -83,7 +83,7 @@ ethernet_input(struct pbuf *p, struct netif *netif) struct eth_hdr* ethhdr; u16_t type; #if LWIP_ARP || ETHARP_SUPPORT_VLAN || LWIP_IPV6 - s16_t ip_hdr_offset = SIZEOF_ETH_HDR; + u16_t next_hdr_offset = SIZEOF_ETH_HDR; #endif /* LWIP_ARP || ETHARP_SUPPORT_VLAN */ if (p->len <= SIZEOF_ETH_HDR) { @@ -133,7 +133,7 @@ ethernet_input(struct pbuf *p, struct netif *netif) } #endif /* defined(LWIP_HOOK_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) */ type = vlan->tpid; - ip_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR; + next_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR; } #endif /* ETHARP_SUPPORT_VLAN */ @@ -173,10 +173,10 @@ ethernet_input(struct pbuf *p, struct netif *netif) goto free_and_return; } /* skip Ethernet header */ - if ((p->len < ip_hdr_offset) || pbuf_header(p, (s16_t)-ip_hdr_offset)) { + if ((p->len < next_hdr_offset) || pbuf_remove_header(p, next_hdr_offset)) { LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, - ("ethernet_input: IPv4 packet dropped, too short (%"S16_F"/%"S16_F")\n", - p->tot_len, ip_hdr_offset)); + ("ethernet_input: IPv4 packet dropped, too short (%"U16_F"/%"U16_F")\n", + p->tot_len, next_hdr_offset)); LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("Can't move over header in packet")); goto free_and_return; } else { @@ -190,10 +190,10 @@ ethernet_input(struct pbuf *p, struct netif *netif) goto free_and_return; } /* skip Ethernet header */ - if ((p->len < ip_hdr_offset) || pbuf_header(p, (s16_t)-ip_hdr_offset)) { + if ((p->len < next_hdr_offset) || pbuf_remove_header(p, next_hdr_offset)) { LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, - ("ethernet_input: ARP response packet dropped, too short (%"S16_F"/%"S16_F")\n", - p->tot_len, ip_hdr_offset)); + ("ethernet_input: ARP response packet dropped, too short (%"U16_F"/%"U16_F")\n", + p->tot_len, next_hdr_offset)); LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("Can't move over header in packet")); ETHARP_STATS_INC(etharp.lenerr); ETHARP_STATS_INC(etharp.drop); @@ -217,10 +217,10 @@ ethernet_input(struct pbuf *p, struct netif *netif) #if LWIP_IPV6 case PP_HTONS(ETHTYPE_IPV6): /* IPv6 */ /* skip Ethernet header */ - if ((p->len < ip_hdr_offset) || pbuf_header(p, (s16_t)-ip_hdr_offset)) { + if ((p->len < next_hdr_offset) || pbuf_remove_header(p, next_hdr_offset)) { LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, - ("ethernet_input: IPv6 packet dropped, too short (%"S16_F"/%"S16_F")\n", - p->tot_len, ip_hdr_offset)); + ("ethernet_input: IPv6 packet dropped, too short (%"U16_F"/%"U16_F")\n", + p->tot_len, next_hdr_offset)); goto free_and_return; } else { /* pass to IPv6 layer */ diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index 7867c882..e2bf982e 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -142,7 +142,7 @@ low_level_output(struct netif *netif, struct pbuf *p) initiate transfer(); #if ETH_PAD_SIZE - pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ + pbuf_remove_header(p, ETH_PAD_SIZE); /* drop the padding word */ #endif for (q = p; q != NULL; q = q->next) { @@ -165,7 +165,7 @@ low_level_output(struct netif *netif, struct pbuf *p) /* increase ifoutdiscards or ifouterrors on error */ #if ETH_PAD_SIZE - pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ + pbuf_add_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif LINK_STATS_INC(link.xmit); @@ -202,7 +202,7 @@ low_level_input(struct netif *netif) if (p != NULL) { #if ETH_PAD_SIZE - pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ + pbuf_remove_header(p, ETH_PAD_SIZE); /* drop the padding word */ #endif /* We iterate over the pbuf chain until we have read the entire @@ -229,7 +229,7 @@ low_level_input(struct netif *netif) MIB2_STATS_NETIF_INC(netif, ifinucastpkts); } #if ETH_PAD_SIZE - pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ + pbuf_add_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif LINK_STATS_INC(link.recv); diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c index 4e0d86ca..603cde08 100644 --- a/src/netif/lowpan6.c +++ b/src/netif/lowpan6.c @@ -411,7 +411,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr } /* Move to payload. */ - pbuf_header(p, -IP6_HLEN); + pbuf_remove_header(p, IP6_HLEN); #if LWIP_UDP /* Compress UDP header? */ @@ -451,7 +451,7 @@ lowpan6_frag(struct netif *netif, struct pbuf *p, const struct ieee_802154_addr buffer[ieee_header_len + lowpan6_header_len++] = ((u8_t *)p->payload)[6]; buffer[ieee_header_len + lowpan6_header_len++] = ((u8_t *)p->payload)[7]; - pbuf_header(p, -UDP_HLEN); + pbuf_remove_header(p, UDP_HLEN); } #endif /* LWIP_UDP */ } @@ -695,7 +695,7 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8 { struct pbuf * q; u8_t * lowpan6_buffer; - s8_t lowpan6_offset; + u16_t lowpan6_offset; struct ip6_hdr *ip6hdr; s8_t i; s8_t ip6_offset = IP6_HLEN; @@ -963,7 +963,7 @@ lowpan6_decompress(struct pbuf * p, struct ieee_802154_addr * src, struct ieee_8 /* Now we copy leftover contents from p to q, so we have all L2 and L3 headers (and L4?) in a single PBUF. * Replace p with q, and free p */ - pbuf_header(p, -lowpan6_offset); + pbuf_remove_header(p, lowpan6_offset); MEMCPY((u8_t*)q->payload + ip6_offset, p->payload, p->len); q->len = q->tot_len = ip6_offset + p->len; if (p->next != NULL) { @@ -1021,7 +1021,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif) datagram_offset += 2; } - pbuf_header(p, -datagram_offset); /* hide IEEE802.15.4 header. */ + pbuf_remove_header(p, datagram_offset); /* hide IEEE802.15.4 header. */ /* Check dispatch. */ puc = (u8_t*)p->payload; @@ -1058,7 +1058,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif) } } - pbuf_header(p, -4); /* hide frag1 dispatch */ + pbuf_remove_header(p, 4); /* hide frag1 dispatch */ lrh = (struct lowpan6_reass_helper *) mem_malloc(sizeof(struct lowpan6_reass_helper)); if (lrh == NULL) { @@ -1084,7 +1084,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif) datagram_size = ((u16_t)(puc[0] & 0x07) << 8) | (u16_t)puc[1]; datagram_tag = ((u16_t)puc[2] << 8) | (u16_t)puc[3]; datagram_offset = (u16_t)puc[4] << 3; - pbuf_header(p, -5); /* hide frag1 dispatch */ + pbuf_remove_header(p, 5); /* hide frag1 dispatch */ for (lrh = reass_list; lrh != NULL; lrh = lrh->next_packet) { if ((lrh->sender_addr.addr_len == src.addr_len) && @@ -1141,7 +1141,7 @@ lowpan6_input(struct pbuf * p, struct netif *netif) if (*puc == 0x41) { /* This is a complete IPv6 packet, just skip dispatch byte. */ - pbuf_header(p, -1); /* hide dispatch byte. */ + pbuf_remove_header(p, 1); /* hide dispatch byte. */ } else if ((*puc & 0xe0 )== 0x60) { /* IPv6 headers are compressed using IPHC. */ p = lowpan6_decompress(p, &src, &dest);