mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-19 03:39:54 +00:00
fixed some endianess issues with PPPoS
This commit is contained in:
parent
5033e0e752
commit
25c6278000
@ -666,8 +666,10 @@ void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len) {
|
|||||||
* Send back the protocol and the information field of the
|
* Send back the protocol and the information field of the
|
||||||
* rejected packet. We only get here if LCP is in the OPENED state.
|
* rejected packet. We only get here if LCP is in the OPENED state.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
p += 2;
|
p += 2;
|
||||||
len -= 2;
|
len -= 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
fsm_sdata(f, PROTREJ, ++f->id,
|
fsm_sdata(f, PROTREJ, ++f->id,
|
||||||
p, len);
|
p, len);
|
||||||
|
@ -506,7 +506,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
dump_packet("rcvd", pb->payload, pb->len);
|
dump_packet("rcvd", pb->payload, pb->len);
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
if(pbuf_header(pb, -(int)sizeof(protocol))) {
|
if(pbuf_header(pb, -(s16_t)sizeof(protocol))) {
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
@ -632,7 +632,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
#endif /* PPP_PROTOCOLNAME */
|
#endif /* PPP_PROTOCOLNAME */
|
||||||
warn("Unsupported protocol 0x%x received", protocol);
|
warn("Unsupported protocol 0x%x received", protocol);
|
||||||
#endif /* PPP_DEBUG */
|
#endif /* PPP_DEBUG */
|
||||||
if (pbuf_header(pb, sizeof(protocol))) {
|
if (pbuf_header(pb, (s16_t)sizeof(protocol))) {
|
||||||
LWIP_ASSERT("pbuf_header failed\n", 0);
|
LWIP_ASSERT("pbuf_header failed\n", 0);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
@ -867,6 +867,10 @@ pppos_put(ppp_pcb *pcb, struct pbuf *nb)
|
|||||||
struct pbuf *b;
|
struct pbuf *b;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
#if PRINTPKT_SUPPORT
|
||||||
|
dump_packet("sent", (unsigned char *)nb->payload+2, nb->len-2);
|
||||||
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
for(b = nb; b != NULL; b = b->next) {
|
for(b = nb; b != NULL; b = b->next) {
|
||||||
if((c = sio_write(pcb->fd, b->payload, b->len)) != b->len) {
|
if((c = sio_write(pcb->fd, b->payload, b->len)) != b->len) {
|
||||||
PPPDEBUG(LOG_WARNING,
|
PPPDEBUG(LOG_WARNING,
|
||||||
@ -1554,8 +1558,8 @@ pppos_input_proc(ppp_pcb_rx *pcrx, u_char *s, int l)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pcrx->in_head == NULL) {
|
if (pcrx->in_head == NULL) {
|
||||||
((u8_t*)next_pbuf->payload)[0] = pcrx->in_protocol & 0xFF;
|
((u8_t*)next_pbuf->payload)[0] = pcrx->in_protocol >> 8;
|
||||||
((u8_t*)next_pbuf->payload)[1] = pcrx->in_protocol >> 8;
|
((u8_t*)next_pbuf->payload)[1] = pcrx->in_protocol & 0xFF;
|
||||||
next_pbuf->len += sizeof(pcrx->in_protocol);
|
next_pbuf->len += sizeof(pcrx->in_protocol);
|
||||||
|
|
||||||
pcrx->in_head = next_pbuf;
|
pcrx->in_head = next_pbuf;
|
||||||
|
@ -481,7 +481,7 @@ static void format_packet(u_char *p, int len,
|
|||||||
printer(arg, "%.*B", len, p);
|
printer(arg, "%.*B", len, p);
|
||||||
len = 0;
|
len = 0;
|
||||||
} else
|
} else
|
||||||
printer(arg, "[proto=0x%x]", proto);
|
printer(arg, "[proto=0x%x]", PP_NTOHS(proto));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user