mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
PPP, PPPoS, using PPPoS PCB pointer on VJ and pppos_ configuration functions
Slightly more consistent this way, and prevent using link_ctx_cb pointer from PPPoS protocol file.
This commit is contained in:
parent
f98f2890f3
commit
cfe04d4453
@ -61,9 +61,9 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
void pppos_vjc_config(ppp_pcb *ppp, int vjcomp, int cidcomp, int maxcid);
|
void pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid);
|
||||||
int pppos_vjc_comp(ppp_pcb *ppp, struct pbuf *pb);
|
int pppos_vjc_comp(pppos_pcb *pppos, struct pbuf *pb);
|
||||||
int pppos_vjc_uncomp(ppp_pcb *ppp, struct pbuf *pb);
|
int pppos_vjc_uncomp(pppos_pcb *pppos, struct pbuf *pb);
|
||||||
|
|
||||||
#endif /* PPPOS_H */
|
#endif /* PPPOS_H */
|
||||||
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */
|
#endif /* PPP_SUPPORT && PPPOL2TP_SUPPORT */
|
||||||
|
@ -91,6 +91,9 @@
|
|||||||
#include "lwip/sio.h"
|
#include "lwip/sio.h"
|
||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include "lwip/ip.h" /* for ip_input() */
|
#include "lwip/ip.h" /* for ip_input() */
|
||||||
|
#if PPP_IPV6_SUPPORT
|
||||||
|
#include "lwip/ip6.h" /* for ip6_input() */
|
||||||
|
#endif /* PPP_IPV6_SUPPORT */
|
||||||
|
|
||||||
#include "netif/ppp/ppp_impl.h"
|
#include "netif/ppp/ppp_impl.h"
|
||||||
#include "netif/ppp/pppos.h"
|
#include "netif/ppp/pppos.h"
|
||||||
@ -582,13 +585,15 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
|||||||
|
|
||||||
#if VJ_SUPPORT
|
#if VJ_SUPPORT
|
||||||
case PPP_VJC_COMP: /* VJ compressed TCP */
|
case PPP_VJC_COMP: /* VJ compressed TCP */
|
||||||
if (pppos_vjc_comp(pcb, pb) >= 0) {
|
/* VJ is only enabled on PPPoS interfaces */
|
||||||
|
if (pcb->vj_enabled && pppos_vjc_comp((pppos_pcb*)pcb->link_ctx_cb, pb) >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PPP_VJC_UNCOMP: /* VJ uncompressed TCP */
|
case PPP_VJC_UNCOMP: /* VJ uncompressed TCP */
|
||||||
if (pppos_vjc_uncomp(pcb, pb) >= 0) {
|
/* VJ is only enabled on PPPoS interfaces */
|
||||||
|
if (pcb->vj_enabled && pppos_vjc_uncomp((pppos_pcb*)pcb->link_ctx_cb, pb) >= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1185,7 +1190,7 @@ int cifproxyarp(ppp_pcb *pcb, u32_t his_adr) {
|
|||||||
*/
|
*/
|
||||||
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid) {
|
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid) {
|
||||||
#if VJ_SUPPORT
|
#if VJ_SUPPORT
|
||||||
pppos_vjc_config(pcb, vjcomp, cidcomp, maxcid);
|
pppos_vjc_config((pppos_pcb*)pcb->link_ctx_cb, vjcomp, cidcomp, maxcid);
|
||||||
#else /* VJ_SUPPORT */
|
#else /* VJ_SUPPORT */
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_UNUSED_ARG(vjcomp);
|
LWIP_UNUSED_ARG(vjcomp);
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include "lwip/tcpip.h"
|
#include "lwip/tcpip.h"
|
||||||
#include "lwip/api.h"
|
#include "lwip/api.h"
|
||||||
#include "lwip/sio.h"
|
#include "lwip/sio.h"
|
||||||
|
#include "lwip/ip.h" /* for ip_input() */
|
||||||
|
|
||||||
#include "netif/ppp/ppp_impl.h"
|
#include "netif/ppp/ppp_impl.h"
|
||||||
#include "netif/ppp/pppos.h"
|
#include "netif/ppp/pppos.h"
|
||||||
@ -744,32 +745,29 @@ drop:
|
|||||||
|
|
||||||
#if VJ_SUPPORT
|
#if VJ_SUPPORT
|
||||||
void
|
void
|
||||||
pppos_vjc_config(ppp_pcb *ppp, int vjcomp, int cidcomp, int maxcid)
|
pppos_vjc_config(pppos_pcb *pppos, int vjcomp, int cidcomp, int maxcid)
|
||||||
{
|
{
|
||||||
pppos_pcb *pppos = (pppos_pcb *)ppp->link_ctx_cb;
|
ppp_pcb *ppp;
|
||||||
|
|
||||||
if (!pppos_exist(pppos)) {
|
if (!pppos_exist(pppos)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ppp = pppos->ppp;
|
||||||
ppp->vj_enabled = vjcomp;
|
ppp->vj_enabled = vjcomp;
|
||||||
pppos->vj_comp.compressSlot = cidcomp;
|
pppos->vj_comp.compressSlot = cidcomp;
|
||||||
pppos->vj_comp.maxSlotIndex = maxcid;
|
pppos->vj_comp.maxSlotIndex = maxcid;
|
||||||
PPPDEBUG(LOG_INFO, ("pppos_vjc_config: VJ compress enable=%d slot=%d max slot=%d\n",
|
PPPDEBUG(LOG_INFO, ("pppos_vjc_config[%d]: VJ compress enable=%d slot=%d max slot=%d\n",
|
||||||
vjcomp, cidcomp, maxcid));
|
ppp->num, vjcomp, cidcomp, maxcid));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pppos_vjc_comp(ppp_pcb *ppp, struct pbuf *pb)
|
pppos_vjc_comp(pppos_pcb *pppos, struct pbuf *pb)
|
||||||
{
|
{
|
||||||
pppos_pcb *pppos;
|
ppp_pcb *ppp = pppos->ppp;
|
||||||
int ret;
|
int ret;
|
||||||
PPPDEBUG(LOG_INFO, ("pppos_vjc_comp[%d]: vj_comp in pbuf len=%d\n", ppp->num, pb->len));
|
PPPDEBUG(LOG_INFO, ("pppos_vjc_comp[%d]: vj_comp in pbuf len=%d\n", ppp->num, pb->len));
|
||||||
|
|
||||||
/* VJ is only enabled on PPPoS interfaces */
|
|
||||||
if (!ppp->vj_enabled) {
|
|
||||||
goto drop;
|
|
||||||
}
|
|
||||||
pppos = (pppos_pcb *)ppp->link_ctx_cb;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
|
||||||
* pass the result to IP.
|
* pass the result to IP.
|
||||||
@ -780,25 +778,18 @@ pppos_vjc_comp(ppp_pcb *ppp, struct pbuf *pb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
drop:
|
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
PPPDEBUG(LOG_WARNING, ("pppos_vjc_comp[%d]: Dropping VJ compressed\n", ppp->num));
|
PPPDEBUG(LOG_WARNING, ("pppos_vjc_comp[%d]: Dropping VJ compressed\n", ppp->num));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pppos_vjc_uncomp(ppp_pcb *ppp, struct pbuf *pb)
|
pppos_vjc_uncomp(pppos_pcb *pppos, struct pbuf *pb)
|
||||||
{
|
{
|
||||||
pppos_pcb *pppos;
|
ppp_pcb *ppp = pppos->ppp;
|
||||||
int ret;
|
int ret;
|
||||||
PPPDEBUG(LOG_INFO, ("pppos_vjc_uncomp[%d]: vj_un in pbuf len=%d\n", ppp->num, pb->len));
|
PPPDEBUG(LOG_INFO, ("pppos_vjc_uncomp[%d]: vj_un in pbuf len=%d\n", ppp->num, pb->len));
|
||||||
|
|
||||||
/* VJ is only enabled on PPPoS interfaces */
|
|
||||||
if (!ppp->vj_enabled) {
|
|
||||||
goto drop;
|
|
||||||
}
|
|
||||||
pppos = (pppos_pcb *)ppp->link_ctx_cb;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process the TCP/IP header for VJ header compression and then pass
|
* Process the TCP/IP header for VJ header compression and then pass
|
||||||
* the packet to IP.
|
* the packet to IP.
|
||||||
@ -809,7 +800,6 @@ pppos_vjc_uncomp(ppp_pcb *ppp, struct pbuf *pb)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
drop:
|
|
||||||
/* Something's wrong so drop it. */
|
/* Something's wrong so drop it. */
|
||||||
PPPDEBUG(LOG_WARNING, ("pppos_vjc_uncomp[%d]: Dropping VJ uncompressed\n", ppp->num));
|
PPPDEBUG(LOG_WARNING, ("pppos_vjc_uncomp[%d]: Dropping VJ uncompressed\n", ppp->num));
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user