PPP, move VJ_SUPPORT disabling if LWIP_TCP is not enabled to PPP options

Van Jacobson TCP header compression only apply if TCP is enabled,
therefore we need to disable VJ compression if TCP is disabled.

We already have conditions to enforce VJ disabling if IPv4 is disabled
or if PPPoS is disabled, add TCP to those conditions and remove
unecessary VJ_SUPPORT && LWIP_TCP conditions.
This commit is contained in:
Sylvain Rochet 2016-08-07 19:27:50 +02:00
parent 898e69118a
commit dd0779c204
4 changed files with 12 additions and 12 deletions

View File

@ -296,8 +296,8 @@
#ifndef VJ_SUPPORT
#define VJ_SUPPORT 1
#endif
/* VJ compression is only supported for IPv4 over PPPoS. */
#if !PPPOS_SUPPORT || !PPP_IPV4_SUPPORT
/* VJ compression is only supported for TCP over IPv4 over PPPoS. */
#if !PPPOS_SUPPORT || !PPP_IPV4_SUPPORT || !LWIP_TCP
#undef VJ_SUPPORT
#define VJ_SUPPORT 0
#endif /* !PPPOS_SUPPORT */

View File

@ -510,7 +510,7 @@ static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u16_t protoc
}
#endif /* MPPE_SUPPORT */
#if VJ_SUPPORT && LWIP_TCP
#if VJ_SUPPORT
/*
* Attempt Van Jacobson header compression if VJ is configured and
* this is an IP packet.
@ -541,7 +541,7 @@ static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u16_t protoc
return ERR_VAL;
}
}
#endif /* VJ_SUPPORT && LWIP_TCP */
#endif /* VJ_SUPPORT */
#if CCP_SUPPORT
switch (pcb->ccp_transmit_method) {
@ -720,9 +720,9 @@ void ppp_start(ppp_pcb *pcb) {
memset(&pcb->mppe_comp, 0, sizeof(pcb->mppe_comp));
memset(&pcb->mppe_decomp, 0, sizeof(pcb->mppe_decomp));
#endif /* MPPE_SUPPORT */
#if VJ_SUPPORT && LWIP_TCP
#if VJ_SUPPORT
vj_compress_init(&pcb->vj_comp);
#endif /* VJ_SUPPORT && LWIP_TCP */
#endif /* VJ_SUPPORT */
/* Start protocol */
new_phase(pcb, PPP_PHASE_ESTABLISH);
@ -871,7 +871,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
return;
#endif /* PPP_IPV6_SUPPORT */
#if VJ_SUPPORT && LWIP_TCP
#if VJ_SUPPORT
case PPP_VJC_COMP: /* VJ compressed TCP */
/*
* Clip off the VJ header and prepend the rebuilt TCP/IP header and
@ -899,7 +899,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
/* Something's wrong so drop it. */
PPPDEBUG(LOG_WARNING, ("ppp_input[%d]: Dropping VJ uncompressed\n", pcb->netif->num));
break;
#endif /* VJ_SUPPORT && LWIP_TCP */
#endif /* VJ_SUPPORT */
default: {
int i;

View File

@ -785,9 +785,9 @@ pppos_input_drop(pppos_pcb *pppos)
PPPDEBUG(LOG_INFO, ("pppos_input_drop: pbuf len=%d, addr %p\n", pppos->in_head->len, (void*)pppos->in_head));
}
pppos_input_free_current_packet(pppos);
#if VJ_SUPPORT && LWIP_TCP
#if VJ_SUPPORT
vj_uncompress_err(&pppos->ppp->vj_comp);
#endif /* VJ_SUPPORT && LWIP_TCP */
#endif /* VJ_SUPPORT */
LINK_STATS_INC(link.drop);
MIB2_STATS_NETIF_INC(pppos->ppp->netif, ifindiscards);

View File

@ -29,7 +29,7 @@
*/
#include "netif/ppp/ppp_opts.h"
#if PPP_SUPPORT && VJ_SUPPORT && LWIP_TCP /* don't build if not configured for use in lwipopts.h */
#if PPP_SUPPORT && VJ_SUPPORT /* don't build if not configured for use in lwipopts.h */
#include "netif/ppp/ppp_impl.h"
#include "netif/ppp/pppdebug.h"
@ -692,4 +692,4 @@ bad:
return (-1);
}
#endif /* PPP_SUPPORT && VJ_SUPPORT && LWIP_TCP */
#endif /* PPP_SUPPORT && VJ_SUPPORT */