From a60f2588d68e263a2299b44397da4e9209426492 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Tue, 10 Mar 2015 23:34:11 +0100 Subject: [PATCH] PPP, PPPoE and PPPoL2TP, removed ppp->pcomp usage We refuse protocol compression in both PPPoE and PPPoL2TP, therefore ppp->pcomp can't be true, removed. --- src/netif/ppp/pppoe.c | 8 +++----- src/netif/ppp/pppol2tp.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index ebb13ddd..f601b9d0 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -251,7 +251,7 @@ static err_t pppoe_write(ppp_pcb *ppp, void *ctx, struct pbuf *p) { static err_t pppoe_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *p, u_short protocol) { struct pppoe_softc *sc = (struct pppoe_softc *)ctx; struct pbuf *pb; - int i=0; + u8_t *pl; #if LWIP_SNMP u16_t tot_len; #endif /* LWIP_SNMP */ @@ -270,10 +270,8 @@ static err_t pppoe_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *p, u_short ppp->last_xmit = sys_jiffies(); - if (!ppp->pcomp || protocol > 0xFF) { - *((u_char*)pb->payload + i++) = (protocol >> 8) & 0xFF; - } - *((u_char*)pb->payload + i) = protocol & 0xFF; + pl = (u8_t*)pb->payload; + PUTSHORT(protocol, pl); pbuf_chain(pb, p); #if LWIP_SNMP diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index 0ae2a9ee..8e37bc48 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -253,7 +253,7 @@ static err_t pppol2tp_write(ppp_pcb *ppp, void *ctx, struct pbuf *p) { static err_t pppol2tp_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *p, u_short protocol) { pppol2tp_pcb *l2tp = (pppol2tp_pcb *)ctx; struct pbuf *pb; - int i=0; + u8_t *pl; #if LWIP_SNMP u16_t tot_len; #endif /* LWIP_SNMP */ @@ -272,10 +272,8 @@ static err_t pppol2tp_netif_output(ppp_pcb *ppp, void *ctx, struct pbuf *p, u_sh ppp->last_xmit = sys_jiffies(); - if (!ppp->pcomp || protocol > 0xFF) { - *((u_char*)pb->payload + i++) = (protocol >> 8) & 0xFF; - } - *((u_char*)pb->payload + i) = protocol & 0xFF; + pl = (u8_t*)pb->payload; + PUTSHORT(protocol, pl); pbuf_chain(pb, p); #if LWIP_SNMP