ppp.c disabled, everything required for lwIP moved to our impl

This commit is contained in:
Sylvain Rochet 2012-06-02 18:07:34 +02:00
parent 4dd297cef2
commit a5dd1ccfaa
4 changed files with 79 additions and 14 deletions

View File

@ -66,9 +66,9 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "lwip/opt.h"
#if 0 /* PPP.C DISABLED */
#define RCSID "$Id: main.c,v 1.156 2008/06/23 11:47:18 paulus Exp $"
#include "lwip/opt.h"
#include <stdio.h>
#include <ctype.h>
@ -122,26 +122,32 @@
#include "atcp.h"
#endif
static const char rcsid[] = RCSID;
#if 0
/* interface vars */
char ifname[32]; /* Interface name */
int ifunit; /* Interface unit number */
#endif
#if 0
struct channel *the_channel;
#endif
#if 0
char *progname; /* Name of this program */
char hostname[MAXNAMELEN]; /* Our hostname */
//static char pidfilename[MAXPATHLEN]; /* name of pid file */
//static char linkpidfile[MAXPATHLEN]; /* name of linkname pid file */
char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
uid_t uid; /* Our real user-id */
struct notifier *pidchange = NULL;
struct notifier *phasechange = NULL;
struct notifier *exitnotify = NULL;
struct notifier *sigreceived = NULL;
struct notifier *fork_notifier = NULL;
#endif
#if 0
int hungup; /* terminal has been hung up */
int privileged; /* we're running as real uid root */
int need_holdoff; /* need holdoff period before restarting */
@ -153,17 +159,25 @@ int doing_callback; /* != 0 if we are doing callback */
int ppp_session_number; /* Session number, for channels with such a
concept (eg PPPoE) */
int childwait_done; /* have timed out waiting for children */
#endif
#if 0
char db_key[32];
#endif
#if 0
int (*holdoff_hook) __P((void)) = NULL;
int (*new_phase_hook) __P((int)) = NULL;
void (*snoop_recv_hook) __P((unsigned char *p, int len)) = NULL;
void (*snoop_send_hook) __P((unsigned char *p, int len)) = NULL;
#endif
#if 0
static int conn_running; /* we have a [dis]connector running */
static int fd_loop; /* fd for getting demand-dial packets */
#endif
#if 0
int fd_devnull; /* fd for /dev/null */
int devfd = -1; /* fd of underlying device */
int fd_ppp = -1; /* fd for talking PPP */
@ -175,29 +189,37 @@ int listen_time;
int got_sigusr2;
int got_sigterm;
int got_sighup;
#endif
#if 0
static sigset_t signals_handled;
static int waiting;
static sigjmp_buf sigjmp;
char **script_env; /* Env. variable values for scripts */
int s_env_nalloc; /* # words avail at script_env */
#endif
#if 0
u_char outpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for outgoing packet */
u_char inpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for incoming packet */
#endif
#if 0
static int n_children; /* # child processes still running */
static int got_sigchld; /* set if we have received a SIGCHLD */
int privopen; /* don't lock, open device as root */
char *no_ppp_msg = "Sorry - this system lacks PPP kernel support\n";
#endif
#if 0 /* UNUSED */
GIDSET_TYPE groups[NGROUPS_MAX];/* groups the user is in */
int ngroups; /* How many groups valid in groups */
#endif /* UNUSED */
#if 0
//static struct timeval start_time; /* Time when link was started. */
//static struct pppd_stats old_link_stats;
@ -224,6 +246,7 @@ struct subprocess {
};
static struct subprocess *children;
#endif
/* Prototypes for procedures local to this file. */
@ -253,9 +276,11 @@ static void handle_events __P((void));
void print_link_stats __P((void));
#endif
#if 0
extern char *ttyname __P((int));
extern char *getlogin __P((void));
//int main __P((int, char *[]));
#endif
#ifdef ultrix
#undef O_NONBLOCK
@ -1821,3 +1846,5 @@ script_unsetenv(var)
}
}
#endif /* UNUSED */
#endif /* PPP.C DISABLED */

View File

@ -220,10 +220,10 @@ struct notifier {
*/
extern int hungup; /* Physical layer has disconnected */
extern int ifunit; /* Interface unit number */
extern char ifname[]; /* Interface name */
//extern int ifunit; /* Interface unit number */
//extern char ifname[]; /* Interface name */
extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
//extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int devfd; /* fd of underlying device */
extern int fd_ppp; /* fd for talking PPP */
extern int phase; /* Current state of link - see values below */
@ -233,7 +233,7 @@ extern int redirect_stderr;/* Connector's stderr should go to file */
extern char peer_authname[];/* Authenticated name of peer */
extern int auth_done[NUM_PPP]; /* Methods actually used for auth */
extern int privileged; /* We were run by real-uid root */
extern int need_holdoff; /* Need holdoff period after link terminates */
//extern int need_holdoff; /* Need holdoff period after link terminates */
extern char **script_env; /* Environment variables for scripts */
extern int detached; /* Have detached from controlling tty */
#if 0
@ -249,18 +249,18 @@ extern int using_pty; /* using pty as device (notty or pty opt.) */
extern int log_to_fd; /* logging to this fd as well as syslog */
extern bool log_default; /* log_to_fd is default (stdout) */
extern char *no_ppp_msg; /* message to print if ppp not in kernel */
extern volatile int status; /* exit status for pppd */
//extern volatile int status; /* exit status for pppd */
extern bool devnam_fixed; /* can no longer change devnam */
extern int unsuccess; /* # unsuccessful connection attempts */
//extern int unsuccess; /* # unsuccessful connection attempts */
extern int do_callback; /* set if we want to do callback next */
extern int doing_callback; /* set if this is a callback */
extern int error_count; /* # of times error() has been called */
extern char ppp_devnam[MAXPATHLEN];
//extern int error_count; /* # of times error() has been called */
//extern char ppp_devnam[MAXPATHLEN];
extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
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) */
//extern int listen_time; /* time to listen first (ms) */
extern bool doing_multilink;
extern bool multilink_master;
extern bool bundle_eof;
@ -466,6 +466,7 @@ struct protent {
extern struct protent *protocols[];
#endif
#if 0
/*
* This struct contains pointers to a set of procedures for
* doing operations on a "channel". A channel provides a way
@ -501,6 +502,7 @@ struct channel {
};
extern struct channel *the_channel;
#endif
/*
* Prototypes.
@ -768,6 +770,7 @@ int parse_dotted_ip __P((char *, u_int32_t *));
/*
* Hooks to enable plugins to change various things.
*/
#if 0
extern int (*new_phase_hook) __P((int));
extern int (*idle_time_hook) __P((struct ppp_idle *));
extern int (*holdoff_hook) __P((void));
@ -789,6 +792,7 @@ extern void (*multilink_join_hook) __P((void));
/* Let a plugin snoop sent and received packets. Useful for L2TP */
extern void (*snoop_recv_hook) __P((unsigned char *p, int len));
extern void (*snoop_send_hook) __P((unsigned char *p, int len));
#endif
/*
* Inline versions of get/put char/short/long.

View File

@ -39,8 +39,27 @@
#include "ecp.h"
#endif /* EAP_SUPPORT */
/* FIXME: add a phase per PPP session */
/*
* Global variables.
*/
/* FIXME: global variables per PPP session */
/* FIXME: clean global variables */
int phase; /* where the link is at */
int error_count; /* # of times error() has been called */
int unsuccess; /* # unsuccessful connection attempts */
int listen_time; /* time to listen first (ms) */
int status; /* exit status for pppd */
int need_holdoff; /* need holdoff period before restarting */
/* FIXME: remove ifunit */
int ifunit; /* Interface unit number */
/* FIXME: outpacket_buf per PPP session */
u_char outpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for outgoing packet */
#if PPPOS_SUPPORT
u_char inpacket_buf[PPP_MRU+PPP_HDRLEN]; /* buffer for incoming packet */
#endif /* PPPOS_SUPPORT */
/* FIXME: add stats per PPP session */
#if PPP_STATS_SUPPORT
@ -491,6 +510,7 @@ int ppp_init(void) {
struct protent *protp;
debug = 1;
ifunit = 1; /* FIXME: remove ifunit */
openlog("LWIP-PPP", LOG_PID | LOG_NDELAY, LOG_PPP);
setlogmask(LOG_UPTO(LOG_DEBUG));

View File

@ -21,6 +21,20 @@
typedef unsigned char bool;
#endif
/* FIXME: global variables per PPP session */
/*
* Global variables.
*/
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) */
extern int status; /* exit status for pppd */
extern int need_holdoff; /* Need holdoff period after link terminates */
/* FIXME: remove ifunit */
extern int ifunit; /* Interface unit number */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
/*
* The following struct gives the addresses of procedures to call
* for a particular protocol.