mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-24 15:16:02 +00:00
PPP, added missing cast on pbuf_header()
This commit is contained in:
parent
3a3c823ddb
commit
0a8b1c199d
|
@ -809,10 +809,10 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
||||||
pl = (u8_t*)pb->payload;
|
pl = (u8_t*)pb->payload;
|
||||||
if (pl[0] & 0x01) {
|
if (pl[0] & 0x01) {
|
||||||
protocol = pl[0];
|
protocol = pl[0];
|
||||||
pbuf_header(pb, -1);
|
pbuf_header(pb, -(s16_t)1);
|
||||||
} else {
|
} else {
|
||||||
protocol = (pl[0] << 8) | pl[1];
|
protocol = (pl[0] << 8) | pl[1];
|
||||||
pbuf_header(pb, -2);
|
pbuf_header(pb, -(s16_t)2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CCP_SUPPORT */
|
#endif /* CCP_SUPPORT */
|
||||||
|
|
|
@ -666,7 +666,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
|
||||||
#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
|
#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
|
||||||
MEMCPY(shost, ((struct eth_hdr *)pb->payload)->src.addr, sizeof(shost));
|
MEMCPY(shost, ((struct eth_hdr *)pb->payload)->src.addr, sizeof(shost));
|
||||||
#endif
|
#endif
|
||||||
if (pbuf_header(pb, -(int)sizeof(struct eth_hdr)) != 0) {
|
if (pbuf_header(pb, -(s16_t)sizeof(struct eth_hdr)) != 0) {
|
||||||
/* bail out */
|
/* bail out */
|
||||||
PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header failed\n"));
|
PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header failed\n"));
|
||||||
LINK_STATS_INC(link.lenerr);
|
LINK_STATS_INC(link.lenerr);
|
||||||
|
@ -699,7 +699,7 @@ pppoe_data_input(struct netif *netif, struct pbuf *pb)
|
||||||
|
|
||||||
plen = ntohs(ph->plen);
|
plen = ntohs(ph->plen);
|
||||||
|
|
||||||
if (pbuf_header(pb, -(int)(PPPOE_HEADERLEN)) != 0) {
|
if (pbuf_header(pb, -(s16_t)(PPPOE_HEADERLEN)) != 0) {
|
||||||
/* bail out */
|
/* bail out */
|
||||||
PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header PPPOE_HEADERLEN failed\n"));
|
PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header PPPOE_HEADERLEN failed\n"));
|
||||||
LINK_STATS_INC(link.lenerr);
|
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 */
|
/* 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 */
|
/* 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));
|
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);
|
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);
|
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 = (struct eth_hdr *)pb->payload;
|
||||||
ethhdr->type = PP_HTONS(ETHTYPE_PPPOEDISC);
|
ethhdr->type = PP_HTONS(ETHTYPE_PPPOEDISC);
|
||||||
MEMCPY(ðhdr->dest.addr, dest, sizeof(ethhdr->dest.addr));
|
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;
|
len = pb->tot_len;
|
||||||
|
|
||||||
/* make room for PPPoE header - should not fail */
|
/* 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 */
|
/* 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));
|
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);
|
LINK_STATS_INC(link.lenerr);
|
||||||
|
|
|
@ -443,7 +443,7 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, const
|
||||||
/* printf("HLEN = %d\n", hlen); */
|
/* printf("HLEN = %d\n", hlen); */
|
||||||
|
|
||||||
/* skip L2TP header */
|
/* skip L2TP header */
|
||||||
if (pbuf_header(p, -hlen) != 0) {
|
if (pbuf_header(p, -(s16_t)hlen) != 0) {
|
||||||
goto free_and_return;
|
goto free_and_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ skipavp:
|
||||||
nextavp:
|
nextavp:
|
||||||
/* printf("AVP Found, vendor=%d, attribute=%d, len=%d\n", vendorid, attributetype, avplen); */
|
/* printf("AVP Found, vendor=%d, attribute=%d, len=%d\n", vendorid, attributetype, avplen); */
|
||||||
/* next AVP */
|
/* 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1128,7 @@ static err_t pppol2tp_xmit(pppol2tp_pcb *l2tp, struct pbuf *pb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make room for L2TP header - should not fail */
|
/* 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 */
|
/* bail out */
|
||||||
PPPDEBUG(LOG_ERR, ("pppol2tp: pppol2tp_pcb: could not allocate room for L2TP header\n"));
|
PPPDEBUG(LOG_ERR, ("pppol2tp: pppol2tp_pcb: could not allocate room for L2TP header\n"));
|
||||||
LINK_STATS_INC(link.lenerr);
|
LINK_STATS_INC(link.lenerr);
|
||||||
|
|
|
@ -374,7 +374,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
|
||||||
if (!comp->compressSlot || comp->last_xmit != cs->cs_id) {
|
if (!comp->compressSlot || comp->last_xmit != cs->cs_id) {
|
||||||
comp->last_xmit = cs->cs_id;
|
comp->last_xmit = cs->cs_id;
|
||||||
hlen -= deltaS + 4;
|
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 */
|
/* Can we cope with this failing? Just assert for now */
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb)
|
||||||
*cp++ = cs->cs_id;
|
*cp++ = cs->cs_id;
|
||||||
} else {
|
} else {
|
||||||
hlen -= deltaS + 3;
|
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 */
|
/* Can we cope with this failing? Just assert for now */
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
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));
|
IPH_CHKSUM_SET(&cs->cs_ip, (u_short)(~tmp));
|
||||||
|
|
||||||
/* Remove the compressed header and prepend the uncompressed header. */
|
/* 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 */
|
/* Can we cope with this failing? Just assert for now */
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto bad;
|
goto bad;
|
||||||
|
@ -609,7 +609,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
|
||||||
goto bad;
|
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 */
|
/* Can we cope with this failing? Just assert for now */
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto bad;
|
goto bad;
|
||||||
|
@ -629,7 +629,7 @@ vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp)
|
||||||
n0 = np;
|
n0 = np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pbuf_header(n0, cs->cs_hlen)) {
|
if (pbuf_header(n0, (s16_t)cs->cs_hlen)) {
|
||||||
struct pbuf *np;
|
struct pbuf *np;
|
||||||
|
|
||||||
LWIP_ASSERT("vj_uncompress_tcp: cs->cs_hlen <= PBUF_POOL_BUFSIZE", cs->cs_hlen <= PBUF_POOL_BUFSIZE);
|
LWIP_ASSERT("vj_uncompress_tcp: cs->cs_hlen <= PBUF_POOL_BUFSIZE", cs->cs_hlen <= PBUF_POOL_BUFSIZE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user