diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index cc5e9231..9088456a 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -104,8 +104,12 @@ #include "pppmy.h" #include "fsm.h" #include "lcp.h" +#if CCP_SUPPORT #include "ccp.h" +#endif /* CCP_SUPPORT */ +#if ECP_SUPPORT #include "ecp.h" +#endif /* ECP_SUPPORT */ #include "ipcp.h" #if PAP_SUPPORT #include "upap.h" diff --git a/src/netif/ppp/chap_ms.c b/src/netif/ppp/chap_ms.c index 02b16675..98dba558 100644 --- a/src/netif/ppp/chap_ms.c +++ b/src/netif/ppp/chap_ms.c @@ -628,7 +628,7 @@ GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], sha1_finish(&sha1Context, Digest); /* Convert to ASCII hex string. */ - for (i = 0; i < MAX((MS_AUTH_RESPONSE_LENGTH / 2), sizeof(Digest)); i++) + for (i = 0; i < LWIP_MAX((MS_AUTH_RESPONSE_LENGTH / 2), sizeof(Digest)); i++) sprintf((char *)&authResponse[i * 2], "%02X", Digest[i]); } diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 9c21eb22..9754499d 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -2197,7 +2197,7 @@ lcp_up(f) * MTU we want to use, and our link MRU. */ mtu = ho->neg_mru? ho->mru: PPP_MRU; - mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; + mru = go->neg_mru? LWIP_MAX(wo->mru, go->mru): PPP_MRU; #ifdef HAVE_MULTILINK if (!(multilink && go->neg_mrru && ho->neg_mrru)) #endif /* HAVE_MULTILINK */ diff --git a/src/netif/ppp/options.c b/src/netif/ppp/options.c index f1eb1f5c..6e6b1915 100644 --- a/src/netif/ppp/options.c +++ b/src/netif/ppp/options.c @@ -50,7 +50,7 @@ #include #include #include -#include +//#include #include #include #ifdef PLUGIN @@ -95,7 +95,7 @@ struct option_value { int debug = 0; /* Debug flag */ int kdebugflag = 0; /* Tell kernel to print debug messages */ int default_device = 1; /* Using /dev/tty or equivalent */ -char devnam[MAXPATHLEN]; /* Device name */ +//char devnam[MAXPATHLEN]; /* Device name */ bool nodetach = 0; /* Don't detach from controlling tty */ bool updetach = 0; /* Detach once link is up */ int maxconnect = 0; /* Maximum connect time */ @@ -115,7 +115,7 @@ int log_to_fd = 1; /* send log messages to this fd too */ #endif bool log_default = 1; /* log_to_fd is default (stdout) */ int maxfail = 10; /* max # of unsuccessful connection attempts */ -char linkname[MAXPATHLEN]; /* logical name for link */ +//char linkname[MAXPATHLEN]; /* logical name for link */ bool tune_kernel; /* may alter kernel settings */ int connect_delay = 1000; /* wait this many ms after connect script */ int req_unit = -1; /* requested interface unit */ diff --git a/src/netif/ppp/pppd.h b/src/netif/ppp/pppd.h index 13eba6d7..657cc915 100644 --- a/src/netif/ppp/pppd.h +++ b/src/netif/ppp/pppd.h @@ -42,6 +42,8 @@ * $Id: pppd.h,v 1.96 2008/06/23 11:47:18 paulus Exp $ */ +#if 0 /* PPPD.H DISABLED */ + #include "lwip/opt.h" #include "pppmy.h" @@ -60,6 +62,7 @@ #include /* for struct timeval */ #include +#if 0 #if defined(__STDC__) #include #define __V(x) x @@ -74,6 +77,8 @@ #include "eui64.h" #endif +#endif + #if 0 /* * Limits. @@ -225,6 +230,7 @@ struct notifier { }; #endif /* UNUSED */ +#if 0 /* * Global variables. */ @@ -271,10 +277,13 @@ extern int ppp_session_number; /* Session number (eg PPPoE session) */ extern int fd_devnull; /* fd open to /dev/null */ //extern int listen_time; /* time to listen first (ms) */ + +#if 0 extern bool doing_multilink; extern bool multilink_master; extern bool bundle_eof; extern bool bundle_terminating; +#endif extern struct notifier *pidchange; /* for notifications of pid changing */ extern struct notifier *phasechange; /* for notifications of phase changes */ @@ -373,7 +382,11 @@ extern bool ms_lanman; /* Use LanMan password instead of NT */ /* Has meaning only with MS-CHAP challenges */ #endif +#endif + + #if 0 + /* Values for auth_pending, auth_done */ #if PAP_SUPPORT #define PAP_WITHPEER 0x1 @@ -400,6 +413,7 @@ extern bool ms_lanman; /* Use LanMan password instead of NT */ #define CHAP_MS2_PEER 0x800 #endif /* MSCHAP_SUPPORT */ #endif /* CHAP_SUPPORT */ + #endif #if 0 @@ -583,9 +597,8 @@ void unlock_db __P((void)); void tty_init __P((void)); #endif +#if 0 /* Procedures exported from utils.c. */ -void log_packet __P((u_char *, int, char *, int)); - /* Format a packet and log it with syslog */ void print_string __P((char *, int, void (*) (void *, char *, ...), void *)); /* Format a string for output */ int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ @@ -601,14 +614,18 @@ void fatal __P((char *, ...)); /* log an error message and die(1) */ void init_pr_log __P((const char *, int)); /* initialize for using pr_log */ void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */ void end_pr_log __P((void)); /* finish up after using pr_log */ +#if PRINTPKT_SUPPORT void dump_packet __P((const char *, u_char *, int)); /* dump packet to debug log if interesting */ +#endif /* PRINTPKT_SUPPORT */ +#endif #if 0 /* Unused */ ssize_t complete_read __P((int, void *, size_t)); /* read a complete buffer */ #endif /* Unused */ +#if 0 /* Procedures exported from auth.c */ void link_required __P((int)); /* we are starting to use the link */ void start_link __P((int)); /* bring the link up now */ @@ -643,7 +660,9 @@ int auth_ip_addr __P((int, u_int32_t)); int auth_number __P((void)); /* check if remote number is authorized */ int bad_ip_adrs __P((u_int32_t)); /* check if IP address is unreasonable */ +#endif +#if 0 /* Procedures exported from demand.c */ #if DEMAND_SUPPORT void demand_conf __P((void)); /* config interface(s) for demand-dial */ @@ -654,7 +673,9 @@ void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/ int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ #endif /* DEMAND_SUPPORT */ +#endif +#if 0 /* Procedures exported from multilink.c */ #ifdef HAVE_MULTILINK void mp_check_options __P((void)); /* Check multilink-related options */ @@ -669,7 +690,9 @@ int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */ #define doing_multilink 0 #define multilink_master 0 #endif +#endif +#if 0 /* Procedures exported from sys-*.c */ void sys_cleanup __P((void)); /* Restore system state before exiting */ int sys_check_options __P((void)); /* Check options specified */ @@ -756,7 +779,9 @@ int cipxfaddr __P((int)); #endif int get_if_hwaddr __P((u_char *addr, char *name)); char *get_first_ethernet __P((void)); +#endif +#if 0 /* Procedures exported from options.c */ #if 0 /* UNUSED */ int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */ @@ -788,8 +813,12 @@ int override_value __P((const char *, int, const char *)); void print_options __P((void (*) __P((void *, char *, ...)), void *)); /* print out values of all options */ #endif /* PPP_OPTIONS */ +#endif +#if 0 +/* Procedures exported from ipcp.c */ int parse_dotted_ip __P((char *, u_int32_t *)); +#endif /* * Hooks to enable plugins to change various things. @@ -1007,3 +1036,5 @@ extern void (*snoop_send_hook) __P((unsigned char *p, int len)); #endif #endif /* __PPP_H__ */ + +#endif /* PPPD.H DISABLED */ diff --git a/src/netif/ppp/pppmy.h b/src/netif/ppp/pppmy.h index f53e031b..00426892 100644 --- a/src/netif/ppp/pppmy.h +++ b/src/netif/ppp/pppmy.h @@ -21,7 +21,15 @@ #include "eui64.h" #endif - +#if defined(__STDC__) +#include +#define __V(x) x +#else +#include +#define __V(x) (va_alist) va_dcl +#define const +#define volatile +#endif /* * Limits. @@ -60,6 +68,18 @@ struct epdisc { /* * Global variables. */ +/* FIXME: improve debug flag */ +extern int debug; /* Debug flag */ + +/* FIXME: is our_name really necessary ? */ +extern char our_name[MAXNAMELEN];/* Our name for authentication purposes */ +extern char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ +extern bool explicit_remote;/* remote_name specified with remotename opt */ + +/* FIXME: make it a compile time option */ +extern int idle_time_limit;/* Shut down link if idle for this long */ + +extern int phase; /* Current state of link - see values below */ extern int error_count; /* # of times error() has been called */ extern int unsuccess; /* # unsuccessful connection attempts */ extern int listen_time; /* time to listen first (ms) */ @@ -69,6 +89,35 @@ extern int need_holdoff; /* Need holdoff period after link terminates */ extern int ifunit; /* Interface unit number */ extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ +/* FIXME: add more HAVE_MULTILINK */ +extern bool multilink; /* enable multilink operation */ + +/* FIXME: it is really necessary ? */ +extern int maxconnect; /* Maximum connect time (seconds) */ + +#ifdef HAVE_MULTILINK +extern bool doing_multilink; +extern bool multilink_master; +extern bool bundle_eof; +extern bool bundle_terminating; +#endif + +#ifdef MAXOCTETS +extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */ +extern int maxoctets_dir; /* Direction : + 0 - in+out (default) + 1 - in + 2 - out + 3 - max(in,out) */ +extern int maxoctets_timeout; /* Timeout for check of octets limit */ +#define PPP_OCTETS_DIRECTION_SUM 0 +#define PPP_OCTETS_DIRECTION_IN 1 +#define PPP_OCTETS_DIRECTION_OUT 2 +#define PPP_OCTETS_DIRECTION_MAXOVERAL 3 +/* same as previos, but little different on RADIUS side */ +#define PPP_OCTETS_DIRECTION_MAXSESSION 4 +#endif + /* * The following struct gives the addresses of procedures to call * for a particular protocol. @@ -456,3 +505,77 @@ void update_link_stats(int u); /* Get stats at link termination */ #define EXIT_TRAFFIC_LIMIT 20 #endif #define EXIT_CNID_AUTH_FAILED 21 + +/* Procedures exported from auth.c */ +void link_required __P((int)); /* we are starting to use the link */ +void link_terminated __P((int)); /* we are finished with the link */ +void link_down __P((int)); /* the LCP layer has left the Opened state */ +void upper_layers_down __P((int));/* take all NCPs down */ +void link_established __P((int)); /* the link is up; authenticate now */ +void start_networks __P((int)); /* start all the network control protos */ +void continue_networks __P((int)); /* start network [ip, etc] control protos */ + +void auth_peer_fail __P((int, int)); + /* peer failed to authenticate itself */ +void auth_peer_success __P((int, int, int, char *, int)); + /* peer successfully authenticated itself */ +void auth_withpeer_fail __P((int, int)); + /* we failed to authenticate ourselves */ +void auth_withpeer_success __P((int, int, int)); + /* we successfully authenticated ourselves */ +void np_up __P((int, int)); /* a network protocol has come up */ +void np_down __P((int, int)); /* a network protocol has gone down */ +void np_finished __P((int, int)); /* a network protocol no longer needs link */ +void auth_reset __P((int)); /* check what secrets we have */ +int get_secret __P((int, char *, char *, char *, int *, int)); + /* get "secret" for chap */ + +/* Procedures exported from ipcp.c */ +int parse_dotted_ip __P((char *, u_int32_t *)); + +/* Procedures exported from demand.c */ +#if DEMAND_SUPPORT +void demand_conf __P((void)); /* config interface(s) for demand-dial */ +void demand_block __P((void)); /* set all NPs to queue up packets */ +void demand_unblock __P((void)); /* set all NPs to pass packets */ +void demand_discard __P((void)); /* set all NPs to discard packets */ +void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/ +int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ +int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ +#endif /* DEMAND_SUPPORT */ + +/* Procedures exported from multilink.c */ +#ifdef HAVE_MULTILINK +void mp_check_options __P((void)); /* Check multilink-related options */ +int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */ +void mp_exit_bundle __P((void)); /* have disconnected our link from bundle */ +void mp_bundle_terminated __P((void)); +char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */ +int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */ +#else +#define mp_bundle_terminated() /* nothing */ +#define mp_exit_bundle() /* nothing */ +#define doing_multilink 0 +#define multilink_master 0 +#endif + +/* Procedures exported from utils.c. */ +void print_string __P((char *, int, void (*) (void *, char *, ...), + void *)); /* Format a string for output */ +int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ +int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */ +size_t strlcpy __P((char *, const char *, size_t)); /* safe strcpy */ +size_t strlcat __P((char *, const char *, size_t)); /* safe strncpy */ +void dbglog __P((char *, ...)); /* log a debug message */ +void info __P((char *, ...)); /* log an informational message */ +void notice __P((char *, ...)); /* log a notice-level message */ +void warn __P((char *, ...)); /* log a warning message */ +void error __P((char *, ...)); /* log an error message */ +void fatal __P((char *, ...)); /* log an error message and die(1) */ +void init_pr_log __P((const char *, int)); /* initialize for using pr_log */ +void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */ +void end_pr_log __P((void)); /* finish up after using pr_log */ +#if PRINTPKT_SUPPORT +void dump_packet __P((const char *, u_char *, int)); + /* dump packet to debug log if interesting */ +#endif /* PRINTPKT_SUPPORT */ diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index 2a95b81e..6acbb72c 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -816,6 +816,7 @@ dbglog __V((char *fmt, ...)) va_end(pvar); } +#if PRINTPKT_SUPPORT /* * dump_packet - print out a packet in readable form if it is interesting. * Assumes len >= PPP_HDRLEN. @@ -845,6 +846,7 @@ dump_packet(const char *tag, unsigned char *p, int len) dbglog("%s %P", tag, p, len); } +#endif /* PRINTPKT_SUPPORT */ #if 0 /* Unused */