PPP, PPPoS, re-enabled PPPCTLG_FD

Found a fine way to get PPP fd without making this call crash for for PPPoE
or PPPoL2TP.
This commit is contained in:
Sylvain Rochet 2015-02-16 23:22:00 +01:00
parent cfe04d4453
commit 7132893863
3 changed files with 15 additions and 2 deletions

View File

@ -37,6 +37,9 @@
#ifndef PPPOS_H #ifndef PPPOS_H
#define PPPOS_H #define PPPOS_H
#include "lwip/sys.h"
#include "lwip/sio.h"
#include "ppp.h" #include "ppp.h"
#include "vj.h" #include "vj.h"
@ -61,6 +64,7 @@ ppp_pcb *ppp_over_serial_create(struct netif *pppif, sio_fd_t fd,
void pppos_input(ppp_pcb *ppp, u_char* data, int len); void pppos_input(ppp_pcb *ppp, u_char* data, int len);
sio_fd_t pppos_get_fd(pppos_pcb *pppos);
void pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid); void pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid);
int pppos_vjc_comp(pppos_pcb *pppos, struct pbuf *pb); int pppos_vjc_comp(pppos_pcb *pppos, struct pbuf *pb);
int pppos_vjc_uncomp(pppos_pcb *pppos, struct pbuf *pb); int pppos_vjc_uncomp(pppos_pcb *pppos, struct pbuf *pb);

View File

@ -773,10 +773,10 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
return PPPERR_PARAM; return PPPERR_PARAM;
break; break;
#if 0/*PPPOS_SUPPORT*/ #if PPPOS_SUPPORT
case PPPCTLG_FD: /* Get the fd associated with the ppp */ case PPPCTLG_FD: /* Get the fd associated with the ppp */
if (arg) { if (arg) {
*(sio_fd_t *)arg = pcb->fd; *(sio_fd_t *)arg = pppos_get_fd((pppos_pcb*)pcb->link_ctx_cb);
return PPPERR_NONE; return PPPERR_NONE;
} }
return PPPERR_PARAM; return PPPERR_PARAM;

View File

@ -743,6 +743,15 @@ drop:
} }
#endif /* PPP_INPROC_MULTITHREADED */ #endif /* PPP_INPROC_MULTITHREADED */
sio_fd_t
pppos_get_fd(pppos_pcb *pppos)
{
if (!pppos_exist(pppos)) {
return 0;
}
return pppos->fd;
}
#if VJ_SUPPORT #if VJ_SUPPORT
void void
pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid) pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid)