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
#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
*/

View File

@@ -43,7 +43,7 @@
*/
#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
#define IPCP_H
@@ -104,4 +104,4 @@ char *ip_ntoa (u32_t);
extern const struct protent ipcp_protent;
#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 "lcp.h"
#if PPP_IPV4_SUPPORT
#include "ipcp.h"
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
#include "ipv6cp.h"
#endif /* PPP_IPV6_SUPPORT */
@@ -287,8 +289,10 @@ typedef struct ppp_settings_s {
} ppp_settings;
struct ppp_addrs {
#if PPP_IPV4_SUPPORT
ip_addr_t our_ipaddr, his_ipaddr, netmask;
ip_addr_t dns1, dns2;
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
ip6_addr_t our6_ipaddr, his6_ipaddr;
#endif /* PPP_IPV6_SUPPORT */
@@ -319,21 +323,21 @@ struct ppp_pcb_s {
u8_t err_code; /* Code indicating why interface is down. */
/* 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 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_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
unsigned int ipv6cp_is_up :1; /* have called ip6cp_up() */
unsigned int if6_up :1; /* True when the IPv6 interface is up. */
#else
unsigned int :1; /* 1 bit of padding */
unsigned int :2; /* 2 bit of padding */
#endif /* PPP_IPV6_SUPPORT */
unsigned int ask_for_local :1; /* request our address from peer */
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 */
u16_t peer_mru; /* currently negotiated peer MRU */
#if PPP_IPV4_SUPPORT
fsm ipcp_fsm; /* IPCP fsm structure */
ipcp_options ipcp_wantoptions; /* Options that we want to request */
ipcp_options ipcp_gotoptions; /* Options that peer ack'd */
ipcp_options ipcp_allowoptions; /* Options we allow peer to request */
ipcp_options ipcp_hisoptions; /* Options that we ack'd */
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
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_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 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
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);
#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 sif6down (ppp_pcb *pcb);
#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);
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
int get_idle_time(ppp_pcb *pcb, struct ppp_idle *ip);
#endif /* PPP_IDLETIMELIMIT */