PPP, IPv4 support is now optional

New compile time option: PPP_IPV4_SUPPORT

PPP IPv4 support can now be compiled out.
This commit is contained in:
Sylvain Rochet 2015-02-22 02:28:04 +01:00
parent 5680808fb6
commit 00e8988b52
9 changed files with 171 additions and 137 deletions

View File

@ -1933,6 +1933,13 @@
#define PRINTPKT_SUPPORT 0 #define PRINTPKT_SUPPORT 0
#endif #endif
/**
* PPP_IPV4_SUPPORT==1: Enable PPP IPv4 support
*/
#ifndef PPP_IPV4_SUPPORT
#define PPP_IPV4_SUPPORT 1
#endif
/** /**
* PPP_IPV6_SUPPORT==1: Enable PPP IPv6 support * PPP_IPV6_SUPPORT==1: Enable PPP IPv6 support
*/ */

View File

@ -43,7 +43,7 @@
*/ */
#include "lwip/opt.h" #include "lwip/opt.h"
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ #if PPP_SUPPORT && PPP_IPV4_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef IPCP_H #ifndef IPCP_H
#define IPCP_H #define IPCP_H
@ -104,4 +104,4 @@ char *ip_ntoa (u32_t);
extern const struct protent ipcp_protent; extern const struct protent ipcp_protent;
#endif /* IPCP_H */ #endif /* IPCP_H */
#endif /* PPP_SUPPORT */ #endif /* PPP_SUPPORT && PPP_IPV4_SUPPORT */

View File

@ -153,7 +153,9 @@ typedef unsigned char u_char;
#include "fsm.h" #include "fsm.h"
#include "lcp.h" #include "lcp.h"
#if PPP_IPV4_SUPPORT
#include "ipcp.h" #include "ipcp.h"
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
#include "ipv6cp.h" #include "ipv6cp.h"
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -287,8 +289,10 @@ typedef struct ppp_settings_s {
} ppp_settings; } ppp_settings;
struct ppp_addrs { struct ppp_addrs {
#if PPP_IPV4_SUPPORT
ip_addr_t our_ipaddr, his_ipaddr, netmask; ip_addr_t our_ipaddr, his_ipaddr, netmask;
ip_addr_t dns1, dns2; ip_addr_t dns1, dns2;
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
ip6_addr_t our6_ipaddr, his6_ipaddr; ip6_addr_t our6_ipaddr, his6_ipaddr;
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -319,21 +323,21 @@ struct ppp_pcb_s {
u8_t err_code; /* Code indicating why interface is down. */ u8_t err_code; /* Code indicating why interface is down. */
/* flags */ /* flags */
unsigned int if_up :1; /* True when the interface is up. */
#if PPP_IPV6_SUPPORT
unsigned int if6_up :1; /* True when the IPv6 interface is up. */
#else
unsigned int :1; /* 1 bit of padding */
#endif /* PPP_IPV6_SUPPORT */
unsigned int pcomp :1; /* Does peer accept protocol compression? */ unsigned int pcomp :1; /* Does peer accept protocol compression? */
unsigned int accomp :1; /* Does peer accept addr/ctl compression? */ unsigned int accomp :1; /* Does peer accept addr/ctl compression? */
unsigned int proxy_arp_set :1; /* Have created proxy arp entry */ #if PPP_IPV4_SUPPORT
unsigned int ipcp_is_open :1; /* haven't called np_finished() */ unsigned int ipcp_is_open :1; /* haven't called np_finished() */
unsigned int ipcp_is_up :1; /* have called ipcp_up() */ unsigned int ipcp_is_up :1; /* have called ipcp_up() */
unsigned int if4_up :1; /* True when the IPv4 interface is up. */
unsigned int proxy_arp_set :1; /* Have created proxy arp entry */
#else
unsigned int :4; /* 4 bit of padding */
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
unsigned int ipv6cp_is_up :1; /* have called ip6cp_up() */ unsigned int ipv6cp_is_up :1; /* have called ip6cp_up() */
unsigned int if6_up :1; /* True when the IPv6 interface is up. */
#else #else
unsigned int :1; /* 1 bit of padding */ unsigned int :2; /* 2 bit of padding */
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
unsigned int ask_for_local :1; /* request our address from peer */ unsigned int ask_for_local :1; /* request our address from peer */
unsigned int lcp_echo_timer_running :1; /* set if a timer is running */ unsigned int lcp_echo_timer_running :1; /* set if a timer is running */
@ -381,11 +385,13 @@ struct ppp_pcb_s {
u8_t lcp_echo_number; /* ID number of next echo frame */ u8_t lcp_echo_number; /* ID number of next echo frame */
u16_t peer_mru; /* currently negotiated peer MRU */ u16_t peer_mru; /* currently negotiated peer MRU */
#if PPP_IPV4_SUPPORT
fsm ipcp_fsm; /* IPCP fsm structure */ fsm ipcp_fsm; /* IPCP fsm structure */
ipcp_options ipcp_wantoptions; /* Options that we want to request */ ipcp_options ipcp_wantoptions; /* Options that we want to request */
ipcp_options ipcp_gotoptions; /* Options that peer ack'd */ ipcp_options ipcp_gotoptions; /* Options that peer ack'd */
ipcp_options ipcp_allowoptions; /* Options we allow peer to request */ ipcp_options ipcp_allowoptions; /* Options we allow peer to request */
ipcp_options ipcp_hisoptions; /* Options that we ack'd */ ipcp_options ipcp_hisoptions; /* Options that we ack'd */
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
fsm ipv6cp_fsm; /* IPV6CP fsm structure */ fsm ipv6cp_fsm; /* IPV6CP fsm structure */

View File

@ -424,21 +424,21 @@ void new_phase(ppp_pcb *pcb, int p);
int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp); int ppp_send_config(ppp_pcb *pcb, int mtu, u32_t accm, int pcomp, int accomp);
int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp); int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp);
#if PPP_IPV4_SUPPORT
int sifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr, u32_t net_mask); int sifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr, u32_t net_mask);
int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr); int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr);
int sifproxyarp(ppp_pcb *pcb, u32_t his_adr);
int cifproxyarp(ppp_pcb *pcb, u32_t his_adr);
int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
int sifup(ppp_pcb *pcb);
int sifdown (ppp_pcb *pcb);
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
int sif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64); int sif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64); int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64);
#endif /* PPP_IPV6_SUPPORT */
int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2);
int sifup(ppp_pcb *pcb);
int sifdown (ppp_pcb *pcb);
#if PPP_IPV6_SUPPORT
int sif6up(ppp_pcb *pcb); int sif6up(ppp_pcb *pcb);
int sif6down (ppp_pcb *pcb); int sif6down (ppp_pcb *pcb);
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -448,11 +448,6 @@ int sifnpmode(ppp_pcb *pcb, int proto, enum NPmode mode);
void netif_set_mtu(ppp_pcb *pcb, int mtu); void netif_set_mtu(ppp_pcb *pcb, int mtu);
int netif_get_mtu(ppp_pcb *pcb); int netif_get_mtu(ppp_pcb *pcb);
int sifproxyarp(ppp_pcb *pcb, u32_t his_adr);
int cifproxyarp(ppp_pcb *pcb, u32_t his_adr);
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid);
#if PPP_IDLETIMELIMIT #if PPP_IDLETIMELIMIT
int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip); int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
#endif /* PPP_IDLETIMELIMIT */ #endif /* PPP_IDLETIMELIMIT */

View File

@ -41,7 +41,7 @@
*/ */
#include "lwip/opt.h" #include "lwip/opt.h"
#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ #if PPP_SUPPORT && PPP_IPV4_SUPPORT /* don't build if not configured for use in lwipopts.h */
/* /*
* TODO: * TODO:
@ -2272,4 +2272,4 @@ ip_active_pkt(pkt, len)
} }
#endif /* DEMAND_SUPPORT */ #endif /* DEMAND_SUPPORT */
#endif /* PPP_SUPPORT */ #endif /* PPP_SUPPORT && PPP_IPV4_SUPPORT */

View File

@ -100,7 +100,6 @@
#include "netif/ppp/fsm.h" #include "netif/ppp/fsm.h"
#include "netif/ppp/lcp.h" #include "netif/ppp/lcp.h"
#include "netif/ppp/ipcp.h"
#include "netif/ppp/magic.h" #include "netif/ppp/magic.h"
#if PAP_SUPPORT #if PAP_SUPPORT
@ -121,6 +120,9 @@
#if VJ_SUPPORT #if VJ_SUPPORT
#include "netif/ppp/vj.h" #include "netif/ppp/vj.h"
#endif /* VJ_SUPPORT */ #endif /* VJ_SUPPORT */
#if PPP_IPV4_SUPPORT
#include "netif/ppp/ipcp.h"
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
#include "netif/ppp/ipv6cp.h" #include "netif/ppp/ipv6cp.h"
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -154,7 +156,9 @@ const struct protent* const protocols[] = {
#if CBCP_SUPPORT #if CBCP_SUPPORT
&cbcp_protent, &cbcp_protent,
#endif /* CBCP_SUPPORT */ #endif /* CBCP_SUPPORT */
#if PPP_IPV4_SUPPORT
&ipcp_protent, &ipcp_protent,
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
&ipv6cp_protent, &ipv6cp_protent,
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -351,7 +355,10 @@ ppp_ioctl(ppp_pcb *pcb, u8_t cmd, void *arg)
if (!arg) { if (!arg) {
goto fail; goto fail;
} }
*(int *)arg = (int)(pcb->if_up *(int *)arg = (int)(0
#if PPP_IPV4_SUPPORT
|| pcb->if4_up
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
|| pcb->if6_up || pcb->if6_up
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
@ -424,6 +431,7 @@ static void ppp_do_open(void *arg) {
static err_t ppp_netif_init_cb(struct netif *netif) { static err_t ppp_netif_init_cb(struct netif *netif) {
netif->name[0] = 'p'; netif->name[0] = 'p';
netif->name[1] = 'p'; netif->name[1] = 'p';
/* FIXME: change that when netif_null_output_ip4() will materialize */
netif->output = ppp_netif_output_ip4; netif->output = ppp_netif_output_ip4;
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
netif->output_ip6 = ppp_netif_output_ip6; netif->output_ip6 = ppp_netif_output_ip6;
@ -440,11 +448,12 @@ static err_t ppp_netif_init_cb(struct netif *netif) {
* Send an IPv4 packet on the given connection. * Send an IPv4 packet on the given connection.
*/ */
static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr) { static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr) {
#if PPP_IPV4_SUPPORT
ppp_pcb *pcb = (ppp_pcb*)netif->state; ppp_pcb *pcb = (ppp_pcb*)netif->state;
LWIP_UNUSED_ARG(ipaddr); LWIP_UNUSED_ARG(ipaddr);
/* Check that the link is up. */ /* Check that the link is up. */
if (!pcb->if_up) { if (!pcb->if4_up) {
PPPDEBUG(LOG_ERR, ("ppp_netif_output_ip4[%d]: link not up\n", pcb->netif->num)); PPPDEBUG(LOG_ERR, ("ppp_netif_output_ip4[%d]: link not up\n", pcb->netif->num));
LINK_STATS_INC(link.rterr); LINK_STATS_INC(link.rterr);
LINK_STATS_INC(link.drop); LINK_STATS_INC(link.drop);
@ -453,6 +462,12 @@ static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, ip_addr_
} }
return pcb->link_cb->netif_output(pcb, pcb->link_ctx_cb, pb, PPP_IP); return pcb->link_cb->netif_output(pcb, pcb->link_ctx_cb, pb, PPP_IP);
#else /* PPP_IPV4_SUPPORT */
LWIP_UNUSED_ARG(netif);
LWIP_UNUSED_ARG(pb);
LWIP_UNUSED_ARG(ipaddr);
return ERR_IF;
#endif /* PPP_IPV4_SUPPORT */
} }
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
@ -581,7 +596,9 @@ void ppp_clear(ppp_pcb *pcb) {
#endif /* PPP_STATS_SUPPORT */ #endif /* PPP_STATS_SUPPORT */
memset(&pcb->phase, 0, sizeof(ppp_pcb) - ( (char*)&((ppp_pcb*)0)->phase - (char*)0 ) ); memset(&pcb->phase, 0, sizeof(ppp_pcb) - ( (char*)&((ppp_pcb*)0)->phase - (char*)0 ) );
#if PPP_IPV4_SUPPORT
ip4_addr_set_u32(&pcb->addrs.netmask, IPADDR_BROADCAST); ip4_addr_set_u32(&pcb->addrs.netmask, IPADDR_BROADCAST);
#endif /* PPP_IPV4_SUPPORT */
/* /*
* Initialize each protocol. * Initialize each protocol.
@ -863,7 +880,7 @@ int ppp_recv_config(ppp_pcb *pcb, int mru, u32_t accm, int pcomp, int accomp) {
return 0; return 0;
} }
#if PPP_IPV4_SUPPORT
/* /*
* sifaddr - Config the interface IP addresses and netmask. * sifaddr - Config the interface IP addresses and netmask.
*/ */
@ -876,7 +893,6 @@ int sifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr,
return 1; return 1;
} }
/******************************************************************** /********************************************************************
* *
* cifaddr - Clear the interface IP addresses, and delete routes * cifaddr - Clear the interface IP addresses, and delete routes
@ -893,6 +909,104 @@ int cifaddr(ppp_pcb *pcb, u32_t our_adr, u32_t his_adr) {
return 1; return 1;
} }
/********************************************************************
*
* sifproxyarp - Make a proxy ARP entry for the peer.
*/
int sifproxyarp(ppp_pcb *pcb, u32_t his_adr) {
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(his_adr);
/* FIXME: do we really need that in IPCP ? */
return 0;
}
/********************************************************************
*
* cifproxyarp - Delete the proxy ARP entry for the peer.
*/
int cifproxyarp(ppp_pcb *pcb, u32_t his_adr) {
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(his_adr);
/* FIXME: do we really need that in IPCP ? */
return 0;
}
/*
* sdns - Config the DNS servers
*/
int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
ip4_addr_set_u32(&pcb->addrs.dns1, ns1);
ip4_addr_set_u32(&pcb->addrs.dns2, ns2);
return 1;
}
/********************************************************************
*
* cdns - Clear the DNS servers
*/
int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
LWIP_UNUSED_ARG(ns1);
LWIP_UNUSED_ARG(ns2);
ip_addr_set_zero(&pcb->addrs.dns1);
ip_addr_set_zero(&pcb->addrs.dns2);
return 1;
}
/********************************************************************
*
* sifvjcomp - config tcp header compression
*/
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid) {
if (pcb->link_cb->vj_config) {
pcb->link_cb->vj_config(pcb, pcb->link_ctx_cb, vjcomp, cidcomp, maxcid);
}
return 0;
}
/*
* sifup - Config the interface up and enable IP packets to pass.
*/
int sifup(ppp_pcb *pcb) {
netif_set_addr(pcb->netif, &pcb->addrs.our_ipaddr, &pcb->addrs.netmask,
&pcb->addrs.his_ipaddr);
netif_set_up(pcb->netif);
pcb->if4_up = 1;
pcb->err_code = PPPERR_NONE;
PPPDEBUG(LOG_DEBUG, ("sifup: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code));
pcb->link_status_cb(pcb, pcb->err_code, pcb->ctx_cb);
return 1;
}
/********************************************************************
*
* sifdown - Disable the indicated protocol and config the interface
* down if there are no remaining protocols.
*/
int sifdown(ppp_pcb *pcb) {
pcb->if4_up = 0;
if (1
#if PPP_IPV6_SUPPORT
/* set the interface down if IPv6 is down as well */
&& !pcb->if6_up
#endif /* PPP_IPV6_SUPPORT */
) {
/* make sure the netif status callback is called */
netif_set_down(pcb->netif);
}
PPPDEBUG(LOG_DEBUG, ("sifdown: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code));
return 1;
}
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
#define IN6_LLADDR_FROM_EUI64(ip6, eui64) do { \ #define IN6_LLADDR_FROM_EUI64(ip6, eui64) do { \
@ -925,75 +1039,7 @@ int cif6addr(ppp_pcb *pcb, eui64_t our_eui64, eui64_t his_eui64) {
ip6_addr_set_zero(&pcb->addrs.his6_ipaddr); ip6_addr_set_zero(&pcb->addrs.his6_ipaddr);
return 1; return 1;
} }
#endif /* PPP_IPV6_SUPPORT */
/*
* sdns - Config the DNS servers
*/
int sdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
ip4_addr_set_u32(&pcb->addrs.dns1, ns1);
ip4_addr_set_u32(&pcb->addrs.dns2, ns2);
return 1;
}
/********************************************************************
*
* cdns - Clear the DNS servers
*/
int cdns(ppp_pcb *pcb, u32_t ns1, u32_t ns2) {
LWIP_UNUSED_ARG(ns1);
LWIP_UNUSED_ARG(ns2);
ip_addr_set_zero(&pcb->addrs.dns1);
ip_addr_set_zero(&pcb->addrs.dns2);
return 1;
}
/*
* sifup - Config the interface up and enable IP packets to pass.
*/
int sifup(ppp_pcb *pcb) {
netif_set_addr(pcb->netif, &pcb->addrs.our_ipaddr, &pcb->addrs.netmask,
&pcb->addrs.his_ipaddr);
netif_set_up(pcb->netif);
pcb->if_up = 1;
pcb->err_code = PPPERR_NONE;
PPPDEBUG(LOG_DEBUG, ("sifup: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code));
pcb->link_status_cb(pcb, pcb->err_code, pcb->ctx_cb);
return 1;
}
/********************************************************************
*
* sifdown - Disable the indicated protocol and config the interface
* down if there are no remaining protocols.
*/
int sifdown(ppp_pcb *pcb) {
pcb->if_up = 0;
if (1
#if PPP_IPV6_SUPPORT
/* set the interface down if IPv6 is down as well */
&& !pcb->if6_up
#endif /* PPP_IPV6_SUPPORT */
) {
/* make sure the netif status callback is called */
netif_set_down(pcb->netif);
}
PPPDEBUG(LOG_DEBUG, ("sifdown: unit %d: err_code=%d\n", pcb->netif->num, pcb->err_code));
return 1;
}
#if PPP_IPV6_SUPPORT
/* /*
* sif6up - Config the interface up and enable IPv6 packets to pass. * sif6up - Config the interface up and enable IPv6 packets to pass.
*/ */
@ -1020,7 +1066,12 @@ int sif6down(ppp_pcb *pcb) {
pcb->if6_up = 0; pcb->if6_up = 0;
/* set the interface down if IPv4 is down as well */ /* set the interface down if IPv4 is down as well */
if (!pcb->if_up) { if (1
#if PPP_IPV4_SUPPORT
/* set the interface down if IPv6 is down as well */
&& !pcb->if4_up
#endif /* PPP_IPV4_SUPPORT */
) {
/* make sure the netif status callback is called */ /* make sure the netif status callback is called */
netif_set_down(pcb->netif); netif_set_down(pcb->netif);
} }
@ -1055,41 +1106,6 @@ int netif_get_mtu(ppp_pcb *pcb) {
return pcb->netif->mtu; return pcb->netif->mtu;
} }
/********************************************************************
*
* sifproxyarp - Make a proxy ARP entry for the peer.
*/
int sifproxyarp(ppp_pcb *pcb, u32_t his_adr) {
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(his_adr);
/* FIXME: do we really need that in IPCP ? */
return 0;
}
/********************************************************************
*
* cifproxyarp - Delete the proxy ARP entry for the peer.
*/
int cifproxyarp(ppp_pcb *pcb, u32_t his_adr) {
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(his_adr);
/* FIXME: do we really need that in IPCP ? */
return 0;
}
/********************************************************************
*
* sifvjcomp - config tcp header compression
*/
int sifvjcomp(ppp_pcb *pcb, int vjcomp, int cidcomp, int maxcid) {
if (pcb->link_cb->vj_config) {
pcb->link_cb->vj_config(pcb, pcb->link_ctx_cb, vjcomp, cidcomp, maxcid);
}
return 0;
}
#if PPP_IDLETIMELIMIT #if PPP_IDLETIMELIMIT
/******************************************************************** /********************************************************************
* *

View File

@ -907,8 +907,10 @@ pppoe_connect(ppp_pcb *ppp, void *ctx)
struct pppoe_softc *sc = (struct pppoe_softc *)ctx; struct pppoe_softc *sc = (struct pppoe_softc *)ctx;
lcp_options *lcp_wo; lcp_options *lcp_wo;
lcp_options *lcp_ao; lcp_options *lcp_ao;
#if PPP_IPV4_SUPPORT
ipcp_options *ipcp_wo; ipcp_options *ipcp_wo;
ipcp_options *ipcp_ao; ipcp_options *ipcp_ao;
#endif /* PPP_IPV4_SUPPORT */
if (sc->sc_state != PPPOE_STATE_INITIAL) { if (sc->sc_state != PPPOE_STATE_INITIAL) {
return EBUSY; return EBUSY;
@ -940,6 +942,7 @@ pppoe_connect(ppp_pcb *ppp, void *ctx)
lcp_ao->neg_pcompression = 0; lcp_ao->neg_pcompression = 0;
lcp_ao->neg_accompression = 0; lcp_ao->neg_accompression = 0;
#if PPP_IPV4_SUPPORT
ipcp_wo = &ppp->ipcp_wantoptions; ipcp_wo = &ppp->ipcp_wantoptions;
ipcp_wo->neg_vj = 0; ipcp_wo->neg_vj = 0;
ipcp_wo->old_vj = 0; ipcp_wo->old_vj = 0;
@ -947,6 +950,7 @@ pppoe_connect(ppp_pcb *ppp, void *ctx)
ipcp_ao = &ppp->ipcp_allowoptions; ipcp_ao = &ppp->ipcp_allowoptions;
ipcp_ao->neg_vj = 0; ipcp_ao->neg_vj = 0;
ipcp_ao->old_vj = 0; ipcp_ao->old_vj = 0;
#endif /* PPP_IPV4_SUPPORT */
/* save state, in case we fail to send PADI */ /* save state, in case we fail to send PADI */
sc->sc_state = PPPOE_STATE_PADI_SENT; sc->sc_state = PPPOE_STATE_PADI_SENT;

View File

@ -258,8 +258,10 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
pppol2tp_pcb *l2tp = (pppol2tp_pcb *)ctx; pppol2tp_pcb *l2tp = (pppol2tp_pcb *)ctx;
lcp_options *lcp_wo; lcp_options *lcp_wo;
lcp_options *lcp_ao; lcp_options *lcp_ao;
#if PPP_IPV4_SUPPORT
ipcp_options *ipcp_wo; ipcp_options *ipcp_wo;
ipcp_options *ipcp_ao; ipcp_options *ipcp_ao;
#endif /* PPP_IPV4_SUPPORT */
if (l2tp->phase != PPPOL2TP_STATE_INITIAL) { if (l2tp->phase != PPPOL2TP_STATE_INITIAL) {
return ERR_VAL; return ERR_VAL;
@ -281,6 +283,7 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
lcp_ao->neg_pcompression = 0; lcp_ao->neg_pcompression = 0;
lcp_ao->neg_accompression = 0; lcp_ao->neg_accompression = 0;
#if PPP_IPV4_SUPPORT
ipcp_wo = &ppp->ipcp_wantoptions; ipcp_wo = &ppp->ipcp_wantoptions;
ipcp_wo->neg_vj = 0; ipcp_wo->neg_vj = 0;
ipcp_wo->old_vj = 0; ipcp_wo->old_vj = 0;
@ -288,6 +291,7 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
ipcp_ao = &ppp->ipcp_allowoptions; ipcp_ao = &ppp->ipcp_allowoptions;
ipcp_ao->neg_vj = 0; ipcp_ao->neg_vj = 0;
ipcp_ao->old_vj = 0; ipcp_ao->old_vj = 0;
#endif /* PPP_IPV4_SUPPORT */
/* Listen to a random source port, we need to do that instead of using udp_connect() /* Listen to a random source port, we need to do that instead of using udp_connect()
* because the L2TP LNS might answer with its own random source port (!= 1701) * because the L2TP LNS might answer with its own random source port (!= 1701)

View File

@ -382,10 +382,10 @@ static err_t
pppos_connect(ppp_pcb *ppp, void *ctx) pppos_connect(ppp_pcb *ppp, void *ctx)
{ {
pppos_pcb *pppos = (pppos_pcb *)ctx; pppos_pcb *pppos = (pppos_pcb *)ctx;
#if !VJ_SUPPORT #if !VJ_SUPPORT && PPP_IPV4_SUPPORT
ipcp_options *ipcp_wo; ipcp_options *ipcp_wo;
ipcp_options *ipcp_ao; ipcp_options *ipcp_ao;
#endif /* !VJ_SUPPORT */ #endif /* !VJ_SUPPORT && PPP_IPV4_SUPPORT */
/* input pbuf left over from last session? */ /* input pbuf left over from last session? */
pppos_free_current_input_packet(pppos); pppos_free_current_input_packet(pppos);
@ -394,6 +394,7 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
/* reset PPPoS control block to its initial state */ /* reset PPPoS control block to its initial state */
memset(&pppos->out_accm, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->out_accm - (char*)0 ) ); memset(&pppos->out_accm, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->out_accm - (char*)0 ) );
#if PPP_IPV4_SUPPORT
#if VJ_SUPPORT #if VJ_SUPPORT
vj_compress_init(&pppos->vj_comp); vj_compress_init(&pppos->vj_comp);
#else /* VJ_SUPPORT */ #else /* VJ_SUPPORT */
@ -406,6 +407,7 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
ipcp_ao->neg_vj = 0; ipcp_ao->neg_vj = 0;
ipcp_ao->old_vj = 0; ipcp_ao->old_vj = 0;
#endif /* VJ_SUPPORT */ #endif /* VJ_SUPPORT */
#endif /* PPP_IPV4_SUPPORT */
/* /*
* Default the in and out accm so that escape and flag characters * Default the in and out accm so that escape and flag characters