PPP, VJ, CCP: rework to fix protocol order

We need to do VJ compression before CCP/MPPE compression and VJ
decompression after CCP/MPPE decompression. This leads to a massive
rewrite of how we currently handled VJ only in the PPPoS lower protocol
handler.

Moved VJ structures from pppos to ppp_pcb because we need them back in
PPP core. This is a bit unfortunate because that's not necessary for
PPPoE or PPPoL2TP, but, hey!. Fixed CCP+MPPE+VJ order.
This commit is contained in:
Sylvain Rochet
2015-04-20 00:10:35 +02:00
parent 33838b8c1c
commit b302cad46d
7 changed files with 80 additions and 153 deletions

View File

@@ -370,6 +370,11 @@ struct ppp_pcb_s {
unsigned int :2; /* 2 bit of padding */
#endif /* PPP_IPV6_SUPPORT */
unsigned int lcp_echo_timer_running :1; /* set if a timer is running */
#if VJ_SUPPORT
unsigned int vj_enabled :1; /* Flag indicating VJ compression enabled. */
#else /* VJ_SUPPORT */
unsigned int :1; /* 1 bit of padding */
#endif /* VJ_SUPPORT */
#if CCP_SUPPORT
unsigned int ccp_all_rejected :1; /* we rejected all peer's options */
unsigned int ccp_is_open :1; /* true when CCP is open (currently negotiating) */
@@ -382,7 +387,7 @@ struct ppp_pcb_s {
#else /* MPPE_SUPPORT */
unsigned int :1; /* 1 bit of padding */
#endif /* MPPE_SUPPORT */
unsigned int :6; /* 6 bits of padding to round out to 16 bits */
unsigned int :5; /* 5 bits of padding to round out to 16 bits */
#if PPP_AUTH_SUPPORT
/* auth data */
@@ -420,6 +425,10 @@ struct ppp_pcb_s {
u8_t num_np_open; /* Number of network protocols which we have opened. */
u8_t num_np_up; /* Number of network protocols which have come up. */
#if VJ_SUPPORT
struct vjcompress vj_comp; /* Van Jacobson compression header. */
#endif /* VJ_SUPPORT */
#if CCP_SUPPORT
fsm ccp_fsm; /* CCP fsm structure */
ccp_options ccp_wantoptions; /* what to request the peer to use */

View File

@@ -159,14 +159,8 @@ struct link_callbacks {
void (*send_config)(ppp_pcb *pcb, void *ctx, u32_t accm, int pcomp, int accomp);
/* confire the receive-side characteristics of the PPP interface */
void (*recv_config)(ppp_pcb *pcb, void *ctx, u32_t accm, int pcomp, int accomp);
#if VJ_SUPPORT
/* configure TCP header compression */
void (*vj_config)(ppp_pcb *pcb, void *ctx, int vjcomp, int cidcomp, int maxcid);
#endif /* VJ_SUPPORT */
/* Get and set parameters for the given connection. */
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);
};
/*

View File

@@ -81,19 +81,11 @@ struct pppos_pcb_s {
unsigned int open :1; /* Set if PPPoS is open */
unsigned int pcomp :1; /* Does peer accept protocol compression? */
unsigned int accomp :1; /* Does peer accept addr/ctl compression? */
#if VJ_SUPPORT
unsigned int vj_enabled :1; /* Flag indicating VJ compression enabled. */
#else
unsigned int :1; /* 1 bit of padding */
#endif /* VJ_SUPPORT */
unsigned int :4; /* 4 bits of padding to round out to 8 bits */
unsigned int :5; /* 5 bits of padding to round out to 8 bits */
/* PPPoS rx */
ext_accm in_accm; /* Async-Ctl-Char-Map for input. */
struct pbuf *in_head, *in_tail; /* The input packet. */
#if VJ_SUPPORT
struct vjcompress vj_comp; /* Van Jacobson compression header. */
#endif /* VJ_SUPPORT */
u16_t in_protocol; /* The input protocol code. */
u16_t in_fcs; /* Input Frame Check Sequence value. */
u8_t in_state; /* The input process state. */