diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index e44d914f..1924b03e 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -122,6 +122,12 @@ #include "netif/ppp_oe.h" #endif /* PPPOE_SUPPORT */ +/* Global variables */ + +#if PPP_DEBUG +u8_t ppp_num; /* PPP Interface counter, used for debugging messages */ +#endif /* PPP_DEBUG */ + /*************************/ /*** LOCAL DEFINITIONS ***/ /*************************/ @@ -223,7 +229,7 @@ int ppp_init(void) { } /* Create a new PPP session. */ -ppp_pcb *ppp_new(u8_t num) { +ppp_pcb *ppp_new(void) { int i; ppp_pcb *pcb; struct protent *protp; @@ -237,7 +243,9 @@ ppp_pcb *ppp_new(u8_t num) { #endif /* PPP_STATS_SUPPORT */ memset(pcb, 0, sizeof(ppp_pcb)); - pcb->num = num; +#if PPP_DEBUG + pcb->num = ppp_num++; +#endif /* PPP_DEBUG */ pcb->lcp_loopbackfail = DEFLOOPBACKFAIL; new_phase(pcb, PHASE_INITIALIZE); @@ -1141,8 +1149,9 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg) /* FIXME: improve that */ int ppp_write_pbuf(ppp_pcb *pcb, struct pbuf *p) { - ppp_write(pcb, p->payload, p->len); + int ret = ppp_write(pcb, p->payload, p->len); pbuf_free(p); + return ret; } /* diff --git a/src/netif/ppp/ppp.h b/src/netif/ppp/ppp.h index db12d2a7..d3ac6b9f 100644 --- a/src/netif/ppp/ppp.h +++ b/src/netif/ppp/ppp.h @@ -269,7 +269,9 @@ typedef struct ppp_pcb_rx_s { */ struct ppp_pcb_s { ppp_settings settings; +#if PPP_DEBUG u8_t num; /* Interface number - only useful for debugging */ +#endif /* PPP_DEBUG */ #if PPPOS_SUPPORT ppp_pcb_rx rx; #endif /* PPPOS_SUPPORT */ @@ -363,7 +365,7 @@ struct ppp_pcb_s { int ppp_init(void); /* Create a new PPP session, returns a PPP PCB structure. */ -ppp_pcb *ppp_new(u8_t num); +ppp_pcb *ppp_new(void); /* Set auth helper, optional, you can either fill ppp_pcb->settings. */