diff --git a/src/api/pppapi.c b/src/api/pppapi.c index 08e7508e..daf3a483 100644 --- a/src/api/pppapi.c +++ b/src/api/pppapi.c @@ -349,7 +349,7 @@ pppapi_do_ppp_ioctl(struct pppapi_msg_msg *msg) * Call ppp_ioctl() in a thread-safe way by running that function inside the * tcpip_thread context. */ -int +err_t pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg) { struct pppapi_msg msg; diff --git a/src/include/lwip/pppapi.h b/src/include/lwip/pppapi.h index aed14c6b..2adfa4ac 100644 --- a/src/include/lwip/pppapi.h +++ b/src/include/lwip/pppapi.h @@ -137,7 +137,7 @@ int pppapi_open(ppp_pcb *pcb, u16_t holdoff); int pppapi_close(ppp_pcb *pcb); void pppapi_sighup(ppp_pcb *pcb); int pppapi_free(ppp_pcb *pcb); -int pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg); +err_t pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg); #if LWIP_NETIF_STATUS_CALLBACK void pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback); #endif /* LWIP_NETIF_STATUS_CALLBACK */ diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index ec5eaf4f..e08455ff 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -494,7 +494,7 @@ int ppp_free(ppp_pcb *pcb); * Get and set parameters for the given connection. * Return 0 on success, an error code on failure. */ -int ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg); +err_t ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg); /* Get the PPP netif interface */ #define ppp_netif(ppp) (ppp->netif) diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index ddbc8934..d07e8acb 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -158,7 +158,7 @@ struct link_callbacks { /* configure TCP header compression */ void (*vj_config)(ppp_pcb *pcb, void *ctx, int vjcomp, int cidcomp, int maxcid); /* Get and set parameters for the given connection. */ - int (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg); + err_t (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg); /* Pass the processed input packet to the appropriate handler. */ err_t (*netif_input)(ppp_pcb *pcb, void *ctx, struct pbuf *p, u16_t protocol); }; diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 5bd548e2..190732fc 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -337,11 +337,12 @@ int ppp_free(ppp_pcb *pcb) { /* Get and set parameters for the given connection. * Return 0 on success, an error code on failure. */ -int +err_t ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg) { - if(NULL == pcb) - return PPPERR_PARAM; + if (pcb == NULL) { + return ERR_VAL; + } switch(cmd) { case PPPCTLG_UPSTATUS: /* Get the PPP up status. */ @@ -349,21 +350,21 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg) goto fail; } *(int *)arg = (int)(pcb->if_up); - return PPPERR_NONE; + return ERR_OK; case PPPCTLS_ERRCODE: /* Set the PPP error code. */ if (!arg) { goto fail; } pcb->err_code = (u8_t)(*(int *)arg); - return PPPERR_NONE; + return ERR_OK; case PPPCTLG_ERRCODE: /* Get the PPP error code. */ if (!arg) { goto fail; } *(int *)arg = (int)(pcb->err_code); - return PPPERR_NONE; + return ERR_OK; default: if (pcb->link_cb->ioctl) { @@ -372,7 +373,7 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg) } fail: - return PPPERR_PARAM; + return ERR_VAL; } #if LWIP_NETIF_STATUS_CALLBACK diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index bad89436..8ee1c3c7 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -58,7 +58,7 @@ static void pppos_disconnect(ppp_pcb *ppp, void *ctx); static err_t pppos_destroy(ppp_pcb *ppp, void *ctx); static void pppos_send_config(ppp_pcb *ppp, void *ctx, u32_t accm); static void pppos_recv_config(ppp_pcb *ppp, void *ctx, u32_t accm); -static int pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg); +static err_t pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg); #if VJ_SUPPORT static void pppos_vjc_config(ppp_pcb *ppp, void *ctx, int vjcomp, int cidcomp, int maxcid); static err_t pppos_netif_input(ppp_pcb *ppp, void *ctx, struct pbuf *p, u16_t protocol); @@ -753,7 +753,7 @@ pppos_recv_config(ppp_pcb *ppp, void *ctx, u32_t accm) pppos->in_accm[0], pppos->in_accm[1], pppos->in_accm[2], pppos->in_accm[3])); } -static int +static err_t pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg) { pppos_pcb *pppos = (pppos_pcb *)ctx; @@ -765,13 +765,13 @@ pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg) goto fail; } *(sio_fd_t *)arg = pppos->fd; - return PPPERR_NONE; + return ERR_OK; default: ; } fail: - return PPPERR_PARAM; + return ERR_VAL; } #if VJ_SUPPORT