From 81a0fd782f5ce35ec427d2a494b9e94f9eeb0fdb Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Wed, 13 Jun 2012 00:12:55 +0200 Subject: [PATCH] removed unit from ppp_ioctl() --- src/netif/ppp/ppp.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index f75057f0..ebf20c97 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -361,7 +361,7 @@ int ppp_over_serial_open(ppp_pcb *pcb, sio_fd_t fd, ppp_link_status_cb_fn link_s sys_thread_new(PPP_THREAD_NAME, ppp_input_thread, (void*)&pcb->rx, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO); #endif /* PPP_INPROC_OWNTHREAD */ - return pcb->unit; + return PPPERR_NONE; } /* @@ -413,7 +413,7 @@ int ppp_over_ethernet_open(ppp_pcb *pcb, struct netif *ethif, const char *servic } pppoe_connect(pcb->pppoe_sc); - return pcb->unit; + return PPPERR_NONE; } #endif /* PPPOE_SUPPORT */ @@ -1105,49 +1105,50 @@ static err_t ppp_netif_output_over_ethernet(ppp_pcb *pcb, struct pbuf *p) { int ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg) { - int st = 0; + if(NULL == pcb) + return PPPERR_PARAM; - if (pcb->unit < 0 || pcb->unit >= NUM_PPP) { - st = PPPERR_PARAM; - } else { - switch(cmd) { + switch(cmd) { case PPPCTLG_UPSTATUS: /* Get the PPP up status. */ if (arg) { *(int *)arg = (int)(pcb->if_up); - } else { - st = PPPERR_PARAM; + return PPPERR_NONE; } + return PPPERR_PARAM; break; + case PPPCTLS_ERRCODE: /* Set the PPP error code. */ if (arg) { pcb->err_code = *(int *)arg; - } else { - st = PPPERR_PARAM; + return PPPERR_NONE; } + return PPPERR_PARAM; break; + case PPPCTLG_ERRCODE: /* Get the PPP error code. */ if (arg) { *(int *)arg = (int)(pcb->err_code); - } else { - st = PPPERR_PARAM; + return PPPERR_NONE; } + return PPPERR_PARAM; break; + #if PPPOS_SUPPORT case PPPCTLG_FD: /* Get the fd associated with the ppp */ if (arg) { *(sio_fd_t *)arg = pcb->fd; - } else { - st = PPPERR_PARAM; + return PPPERR_NONE; } + return PPPERR_PARAM; break; #endif /* PPPOS_SUPPORT */ + default: - st = PPPERR_PARAM; + return PPPERR_PARAM; break; - } } - return st; + return PPPERR_PARAM; } /*