diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index d2aa97d4..006971d9 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -35,6 +35,7 @@ #if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in lwipopts.h */ #include +#include #include "lwip/err.h" #include "lwip/pbuf.h" @@ -310,7 +311,7 @@ pppos_connect(ppp_pcb *ppp, void *ctx) ppp_link_start(ppp); /* reset PPPoS control block to its initial state */ - memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->last_xmit - (char*)0 ) ); + memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit)); /* * Default the in and out accm so that escape and flag characters @@ -344,7 +345,7 @@ pppos_listen(ppp_pcb *ppp, void *ctx) ppp_link_start(ppp); /* reset PPPoS control block to its initial state */ - memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->last_xmit - (char*)0 ) ); + memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit)); /* * Default the in and out accm so that escape and flag characters