From dd0779c204a096f34a1cc8c5dca33a91b2293796 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 7 Aug 2016 19:27:50 +0200 Subject: [PATCH] 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. --- src/include/netif/ppp/ppp_opts.h | 4 ++-- src/netif/ppp/ppp.c | 12 ++++++------ src/netif/ppp/pppos.c | 4 ++-- src/netif/ppp/vj.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/include/netif/ppp/ppp_opts.h b/src/include/netif/ppp/ppp_opts.h index 75541f44..fa79c090 100644 --- a/src/include/netif/ppp/ppp_opts.h +++ b/src/include/netif/ppp/ppp_opts.h @@ -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 */ diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index 6d4f3a62..4c06083c 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -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; diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 69ed80e9..b4d435e8 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -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); diff --git a/src/netif/ppp/vj.c b/src/netif/ppp/vj.c index b297c78d..dadb38d6 100644 --- a/src/netif/ppp/vj.c +++ b/src/netif/ppp/vj.c @@ -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 */