fixed some endianess issues with PPPoS

This commit is contained in:
Sylvain Rochet 2012-06-23 02:27:03 +02:00
parent 5033e0e752
commit 25c6278000
3 changed files with 11 additions and 5 deletions

View File

@ -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
* rejected packet. We only get here if LCP is in the OPENED state.
*/
#if 0
p += 2;
len -= 2;
#endif
fsm_sdata(f, PROTREJ, ++f->id,
p, len);

View File

@ -506,7 +506,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
dump_packet("rcvd", pb->payload, pb->len);
#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);
goto drop;
}
@ -632,7 +632,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
#endif /* PPP_PROTOCOLNAME */
warn("Unsupported protocol 0x%x received", protocol);
#endif /* PPP_DEBUG */
if (pbuf_header(pb, sizeof(protocol))) {
if (pbuf_header(pb, (s16_t)sizeof(protocol))) {
LWIP_ASSERT("pbuf_header failed\n", 0);
goto drop;
}
@ -867,6 +867,10 @@ pppos_put(ppp_pcb *pcb, struct pbuf *nb)
struct pbuf *b;
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) {
if((c = sio_write(pcb->fd, b->payload, b->len)) != b->len) {
PPPDEBUG(LOG_WARNING,
@ -1554,8 +1558,8 @@ pppos_input_proc(ppp_pcb_rx *pcrx, u_char *s, int l)
break;
}
if (pcrx->in_head == NULL) {
((u8_t*)next_pbuf->payload)[0] = pcrx->in_protocol & 0xFF;
((u8_t*)next_pbuf->payload)[1] = pcrx->in_protocol >> 8;
((u8_t*)next_pbuf->payload)[0] = pcrx->in_protocol >> 8;
((u8_t*)next_pbuf->payload)[1] = pcrx->in_protocol & 0xFF;
next_pbuf->len += sizeof(pcrx->in_protocol);
pcrx->in_head = next_pbuf;

View File

@ -481,7 +481,7 @@ static void format_packet(u_char *p, int len,
printer(arg, "%.*B", len, p);
len = 0;
} else
printer(arg, "[proto=0x%x]", proto);
printer(arg, "[proto=0x%x]", PP_NTOHS(proto));
}
}