diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 66b47166..5272a76f 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -809,10 +809,10 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { pl = (u8_t*)pb->payload; if (pl[0] & 0x01) { protocol = pl[0]; - pbuf_header(pb, -1); + pbuf_header(pb, -(s16_t)1); } else { protocol = (pl[0] << 8) | pl[1]; - pbuf_header(pb, -2); + pbuf_header(pb, -(s16_t)2); } } #endif /* CCP_SUPPORT */ diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index c3c24156..1dfa5155 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -666,7 +666,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb) #ifdef PPPOE_TERM_UNKNOWN_SESSIONS MEMCPY(shost, ((struct eth_hdr *)pb->payload)->src.addr, sizeof(shost)); #endif - if (pbuf_header(pb, -(int)sizeof(struct eth_hdr)) != 0) { + if (pbuf_header(pb, -(s16_t)sizeof(struct eth_hdr)) != 0) { /* bail out */ PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header failed\n")); LINK_STATS_INC(link.lenerr); @@ -699,7 +699,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb) plen = ntohs(ph->plen); - if (pbuf_header(pb, -(int)(PPPOE_HEADERLEN)) != 0) { + if (pbuf_header(pb, -(s16_t)(PPPOE_HEADERLEN)) != 0) { /* bail out */ PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header PPPOE_HEADERLEN failed\n")); LINK_STATS_INC(link.lenerr); @@ -735,7 +735,7 @@ pppoe_output(struct pppoe_softc *sc, struct pbuf *pb) } /* make room for Ethernet header - should not fail */ - if (pbuf_header(pb, (u16_t)(sizeof(struct eth_hdr))) != 0) { + if (pbuf_header(pb, (s16_t)(sizeof(struct eth_hdr))) != 0) { /* bail out */ PPPDEBUG(LOG_ERR, ("pppoe: %c%c%"U16_F": pppoe_output: could not allocate room for Ethernet header\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)); LINK_STATS_INC(link.lenerr); @@ -1078,7 +1078,7 @@ pppoe_send_padt(struct netif *outgoing_if, u_int session, const u8_t *dest) } LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); - pbuf_header(pb, sizeof(struct eth_hdr)); + pbuf_header(pb, (s16_t)sizeof(struct eth_hdr)); ethhdr = (struct eth_hdr *)pb->payload; ethhdr->type = PP_HTONS(ETHTYPE_PPPOEDISC); MEMCPY(ðhdr->dest.addr, dest, sizeof(ethhdr->dest.addr)); @@ -1187,7 +1187,7 @@ pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb) len = pb->tot_len; /* make room for PPPoE header - should not fail */ - if (pbuf_header(pb, (u16_t)(PPPOE_HEADERLEN)) != 0) { + if (pbuf_header(pb, (s16_t)(PPPOE_HEADERLEN)) != 0) { /* bail out */ PPPDEBUG(LOG_ERR, ("pppoe: %c%c%"U16_F": pppoe_xmit: could not allocate room for PPPoE header\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)); LINK_STATS_INC(link.lenerr); diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index ed87f0e7..1514134b 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -443,7 +443,7 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, const /* printf("HLEN = %d\n", hlen); */ /* skip L2TP header */ - if (pbuf_header(p, -hlen) != 0) { + if (pbuf_header(p, -(s16_t)hlen) != 0) { goto free_and_return; } @@ -659,7 +659,7 @@ skipavp: nextavp: /* printf("AVP Found, vendor=%d, attribute=%d, len=%d\n", vendorid, attributetype, avplen); */ /* next AVP */ - if (pbuf_header(p, -avplen - sizeof(avpflags) - sizeof(vendorid) - sizeof(attributetype) ) != 0) { + if (pbuf_header(p, -(s16_t)(avplen + sizeof(avpflags) + sizeof(vendorid) + sizeof(attributetype)) ) != 0) { return; } } @@ -1128,7 +1128,7 @@ static err_t pppol2tp_xmit(pppol2tp_pcb *l2tp, struct pbuf *pb) { } /* make room for L2TP header - should not fail */ - if (pbuf_header(pb, PPPOL2TP_OUTPUT_DATA_HEADER_LEN) != 0) { + if (pbuf_header(pb, (s16_t)PPPOL2TP_OUTPUT_DATA_HEADER_LEN) != 0) { /* bail out */ PPPDEBUG(LOG_ERR, ("pppol2tp: pppol2tp_pcb: could not allocate room for L2TP header\n")); LINK_STATS_INC(link.lenerr); diff --git a/src/netif/ppp/vj.c b/src/netif/ppp/vj.c index d44eee45..71fbc68d 100644 --- a/src/netif/ppp/vj.c +++ b/src/netif/ppp/vj.c @@ -374,7 +374,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb) if (!comp->compressSlot || comp->last_xmit != cs->cs_id) { comp->last_xmit = cs->cs_id; hlen -= deltaS + 4; - if(pbuf_header(pb, -hlen)){ + if (pbuf_header(pb, -(s16_t)hlen)){ /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); } @@ -383,7 +383,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb) *cp++ = cs->cs_id; } else { hlen -= deltaS + 3; - if(pbuf_header(pb, -hlen)) { + if (pbuf_header(pb, -(s16_t)hlen)) { /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); } @@ -585,7 +585,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp) IPH_CHKSUM_SET(&cs->cs_ip, (u_short)(~tmp)); /* Remove the compressed header and prepend the uncompressed header. */ - if(pbuf_header(n0, -((s16_t)(vjlen)))) { + if (pbuf_header(n0, -(s16_t)vjlen)) { /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); goto bad; @@ -609,7 +609,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp) goto bad; } - if(pbuf_header(np, -cs->cs_hlen)) { + if (pbuf_header(np, -(s16_t)cs->cs_hlen)) { /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); goto bad; @@ -629,7 +629,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp) n0 = np; } - if(pbuf_header(n0, cs->cs_hlen)) { + if (pbuf_header(n0, (s16_t)cs->cs_hlen)) { struct pbuf *np; LWIP_ASSERT("vj_uncompress_tcp: cs->cs_hlen <= PBUF_POOL_BUFSIZE", cs->cs_hlen <= PBUF_POOL_BUFSIZE);