mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2003-04-10 Joel Sherrill <joel@OARcorp.com>
PR 371/pppd * pppd/auth.c, pppd/chat.c, pppd/demand.c, pppd/fsm.c, pppd/lcp.c, pppd/options.c, pppd/pppd.h, pppd/rtemsmain.c, pppd/rtemspppd.c: Change many symbols to static. There are still global symbols in rtemspppd.h which might need to be changed or converted into member of a structure which is dereferenced with a pointer that is managed as a per task variable. But this patch should avoid many conflicts.
This commit is contained in:
@@ -249,7 +249,7 @@ void
|
|||||||
link_terminated(unit)
|
link_terminated(unit)
|
||||||
int unit;
|
int unit;
|
||||||
{
|
{
|
||||||
if (phase == PHASE_DEAD)
|
if (pppd_phase == PHASE_DEAD)
|
||||||
return;
|
return;
|
||||||
if (pap_logout_hook) {
|
if (pap_logout_hook) {
|
||||||
pap_logout_hook();
|
pap_logout_hook();
|
||||||
@@ -283,7 +283,7 @@ link_down(unit)
|
|||||||
}
|
}
|
||||||
num_np_open = 0;
|
num_np_open = 0;
|
||||||
num_np_up = 0;
|
num_np_up = 0;
|
||||||
if (phase != PHASE_DEAD)
|
if (pppd_phase != PHASE_DEAD)
|
||||||
new_phase(PHASE_TERMINATE);
|
new_phase(PHASE_TERMINATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ link_established(unit)
|
|||||||
} else if (!wo->neg_upap || !null_login(unit)) {
|
} else if (!wo->neg_upap || !null_login(unit)) {
|
||||||
warn("peer refused to authenticate: terminating link");
|
warn("peer refused to authenticate: terminating link");
|
||||||
lcp_close(unit, "peer refused to authenticate");
|
lcp_close(unit, "peer refused to authenticate");
|
||||||
status = EXIT_PEER_AUTH_FAILED;
|
pppd_status = EXIT_PEER_AUTH_FAILED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ auth_peer_fail(unit, protocol)
|
|||||||
* Authentication failure: take the link down
|
* Authentication failure: take the link down
|
||||||
*/
|
*/
|
||||||
lcp_close(unit, "Authentication failed");
|
lcp_close(unit, "Authentication failed");
|
||||||
status = EXIT_PEER_AUTH_FAILED;
|
pppd_status = EXIT_PEER_AUTH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -483,7 +483,7 @@ auth_withpeer_fail(unit, protocol)
|
|||||||
* authentication secrets.
|
* authentication secrets.
|
||||||
*/
|
*/
|
||||||
lcp_close(unit, "Failed to authenticate ourselves to peer");
|
lcp_close(unit, "Failed to authenticate ourselves to peer");
|
||||||
status = EXIT_AUTH_TOPEER_FAILED;
|
pppd_status = EXIT_AUTH_TOPEER_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -531,7 +531,7 @@ np_up(unit, proto)
|
|||||||
/*
|
/*
|
||||||
* At this point we consider that the link has come up successfully.
|
* At this point we consider that the link has come up successfully.
|
||||||
*/
|
*/
|
||||||
status = EXIT_OK;
|
pppd_status = EXIT_OK;
|
||||||
unsuccess = 0;
|
unsuccess = 0;
|
||||||
new_phase(PHASE_RUNNING);
|
new_phase(PHASE_RUNNING);
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ check_idle(arg)
|
|||||||
notice("Terminating connection due to lack of activity.");
|
notice("Terminating connection due to lack of activity.");
|
||||||
lcp_close(0, "Link inactive");
|
lcp_close(0, "Link inactive");
|
||||||
need_holdoff = 0;
|
need_holdoff = 0;
|
||||||
status = EXIT_IDLE_TIMEOUT;
|
pppd_status = EXIT_IDLE_TIMEOUT;
|
||||||
} else {
|
} else {
|
||||||
TIMEOUT(check_idle, NULL, tlim);
|
TIMEOUT(check_idle, NULL, tlim);
|
||||||
}
|
}
|
||||||
@@ -618,7 +618,7 @@ connect_time_expired(arg)
|
|||||||
{
|
{
|
||||||
info("Connect time expired");
|
info("Connect time expired");
|
||||||
lcp_close(0, "Connect time expired"); /* Close connection */
|
lcp_close(0, "Connect time expired"); /* Close connection */
|
||||||
status = EXIT_CONNECT_TIME;
|
pppd_status = EXIT_CONNECT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -140,22 +140,17 @@ static int _O = 0; /* Internal state */
|
|||||||
#endif
|
#endif
|
||||||
/*************** Micro getopt() *********************************************/
|
/*************** Micro getopt() *********************************************/
|
||||||
|
|
||||||
char *program_name;
|
|
||||||
|
|
||||||
#define MAX_ABORTS 16
|
#define MAX_ABORTS 16
|
||||||
#define MAX_REPORTS 16
|
#define MAX_REPORTS 16
|
||||||
#define DEFAULT_CHAT_TIMEOUT 45
|
#define DEFAULT_CHAT_TIMEOUT 45
|
||||||
#define MAX_TIMEOUTS 10
|
#define MAX_TIMEOUTS 10
|
||||||
|
|
||||||
int echo = 0;
|
static int echo = 0;
|
||||||
int quiet = 0;
|
static int quiet = 0;
|
||||||
int report = 0;
|
static int use_env = 0;
|
||||||
int use_env = 0;
|
static int exit_code = 0;
|
||||||
int exit_code = 0;
|
static char *phone_num = (char *) 0;
|
||||||
char *report_file = (char *) 0;
|
static char *phone_num2 = (char *) 0;
|
||||||
char *chat_file = (char *) 0;
|
|
||||||
char *phone_num = (char *) 0;
|
|
||||||
char *phone_num2 = (char *) 0;
|
|
||||||
static int ttyfd;
|
static int ttyfd;
|
||||||
static int timeout = DEFAULT_CHAT_TIMEOUT;
|
static int timeout = DEFAULT_CHAT_TIMEOUT;
|
||||||
|
|
||||||
|
|||||||
@@ -45,12 +45,12 @@
|
|||||||
|
|
||||||
static const char rcsid[] = RCSID;
|
static const char rcsid[] = RCSID;
|
||||||
|
|
||||||
char *frame;
|
static char *frame;
|
||||||
int framelen;
|
static int framelen;
|
||||||
int framemax;
|
static int framemax;
|
||||||
int escape_flag;
|
static int escape_flag;
|
||||||
int flush_flag;
|
static int flush_flag;
|
||||||
int fcs;
|
static int fcs;
|
||||||
|
|
||||||
struct packet {
|
struct packet {
|
||||||
int length;
|
int length;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ static void fsm_sconfreq __P((fsm *, int));
|
|||||||
|
|
||||||
#define PROTO_NAME(f) ((f)->callbacks->proto_name)
|
#define PROTO_NAME(f) ((f)->callbacks->proto_name)
|
||||||
|
|
||||||
int peer_mru[NUM_PPP];
|
static int peer_mru[NUM_PPP];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ static const char rcsid[] = RCSID;
|
|||||||
/*
|
/*
|
||||||
* LCP-related command-line options.
|
* LCP-related command-line options.
|
||||||
*/
|
*/
|
||||||
int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
|
static int lcp_echo_interval = 0; /* Interval between LCP echo-requests */
|
||||||
int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
|
static int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */
|
||||||
bool lax_recv = 0; /* accept control chars in asyncmap */
|
static bool lax_recv = 0; /* accept control chars in asyncmap */
|
||||||
|
|
||||||
static int setescape __P((char **));
|
static int setescape __P((char **));
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ lcp_close(unit, reason)
|
|||||||
{
|
{
|
||||||
fsm *f = &lcp_fsm[unit];
|
fsm *f = &lcp_fsm[unit];
|
||||||
|
|
||||||
if (phase != PHASE_DEAD)
|
if (pppd_phase != PHASE_DEAD)
|
||||||
new_phase(PHASE_TERMINATE);
|
new_phase(PHASE_TERMINATE);
|
||||||
if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
|
if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
|
||||||
/*
|
/*
|
||||||
@@ -1063,7 +1063,7 @@ lcp_nakci(f, p, len)
|
|||||||
if (++try.numloops >= lcp_loopbackfail) {
|
if (++try.numloops >= lcp_loopbackfail) {
|
||||||
notice("Serial line is looped back.");
|
notice("Serial line is looped back.");
|
||||||
lcp_close(f->unit, "Loopback detected");
|
lcp_close(f->unit, "Loopback detected");
|
||||||
status = EXIT_LOOPBACK;
|
pppd_status = EXIT_LOOPBACK;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
try.numloops = 0;
|
try.numloops = 0;
|
||||||
@@ -1815,7 +1815,7 @@ void LcpLinkFailure (f)
|
|||||||
info("No response to %d echo-requests", lcp_echos_pending);
|
info("No response to %d echo-requests", lcp_echos_pending);
|
||||||
notice("Serial link appears to be disconnected.");
|
notice("Serial link appears to be disconnected.");
|
||||||
lcp_close(f->unit, "Peer not responding");
|
lcp_close(f->unit, "Peer not responding");
|
||||||
status = EXIT_PEER_DEAD;
|
pppd_status = EXIT_PEER_DEAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ process_option(opt, argv)
|
|||||||
|
|
||||||
if ((opt->flags & OPT_PREPASS) == 0 && prepass)
|
if ((opt->flags & OPT_PREPASS) == 0 && prepass)
|
||||||
return 1;
|
return 1;
|
||||||
if ((opt->flags & OPT_INITONLY) && phase != PHASE_INITIALIZE) {
|
if ((opt->flags & OPT_INITONLY) && pppd_phase != PHASE_INITIALIZE) {
|
||||||
option_error("it's too late to use the %s option", opt->name);
|
option_error("it's too late to use the %s option", opt->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -777,15 +777,15 @@ add_options(opt)
|
|||||||
static void
|
static void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
if (phase == PHASE_INITIALIZE)
|
if (pppd_phase == PHASE_INITIALIZE)
|
||||||
fprintf(stderr, usage_string, VERSION, PATCHLEVEL, IMPLEMENTATION,
|
fprintf(stderr, usage_string, VERSION, PATCHLEVEL, IMPLEMENTATION,
|
||||||
progname);
|
"rtems_pppd");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* option_error - print a message about an error in an option.
|
* option_error - print a message about an error in an option.
|
||||||
* The message is logged, and also sent to
|
* The message is logged, and also sent to
|
||||||
* stderr if phase == PHASE_INITIALIZE.
|
* stderr if pppd_phase == PHASE_INITIALIZE.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
option_error __V((char *fmt, ...))
|
option_error __V((char *fmt, ...))
|
||||||
@@ -1322,7 +1322,7 @@ setdevname(cp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (phase != PHASE_INITIALIZE) {
|
if (pppd_phase != PHASE_INITIALIZE) {
|
||||||
option_error("device name cannot be changed after initialization");
|
option_error("device name cannot be changed after initialization");
|
||||||
return -1;
|
return -1;
|
||||||
} else if (devnam_fixed) {
|
} else if (devnam_fixed) {
|
||||||
|
|||||||
@@ -137,16 +137,15 @@ struct wordlist {
|
|||||||
* Global variables.
|
* Global variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int kill_link; /* Signal to terminate processing loop */
|
extern int pppd_kill_link; /* Signal to terminate processing loop */
|
||||||
extern int hungup; /* Physical layer has disconnected */
|
extern int hungup; /* Physical layer has disconnected */
|
||||||
extern int pppifunit; /* Interface unit number */
|
extern int pppifunit; /* Interface unit number */
|
||||||
extern char ifname[]; /* Interface name */
|
extern char ifname[]; /* Interface name */
|
||||||
extern int ttyfd; /* Serial device file descriptor */
|
extern int ttyfd; /* Serial device file descriptor */
|
||||||
extern char hostname[]; /* Our hostname */
|
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 phase; /* Current state of link - see values below */
|
extern int pppd_phase; /* Current state of link - see values below */
|
||||||
extern int baud_rate; /* Current link speed in bits/sec */
|
extern int baud_rate; /* Current link speed in bits/sec */
|
||||||
extern char *progname; /* Name of this program */
|
|
||||||
extern int redirect_stderr;/* Connector's stderr should go to file */
|
extern int redirect_stderr;/* Connector's stderr should go to file */
|
||||||
extern char peer_authname[];/* Authenticated name of peer */
|
extern char peer_authname[];/* Authenticated name of peer */
|
||||||
extern int privileged; /* We were run by real-uid root */
|
extern int privileged; /* We were run by real-uid root */
|
||||||
@@ -159,7 +158,7 @@ extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
|
|||||||
extern int using_pty; /* using pty as device (notty or pty opt.) */
|
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 int log_to_fd; /* logging to this fd as well as syslog */
|
||||||
extern char *no_ppp_msg; /* message to print if ppp not in kernel */
|
extern char *no_ppp_msg; /* message to print if ppp not in kernel */
|
||||||
extern volatile int status; /* exit status for pppd */
|
extern volatile int pppd_status; /* exit status for pppd */
|
||||||
extern int devnam_fixed; /* can no longer change devnam */
|
extern int 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 do_callback; /* set if we want to do callback next */
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ static const char rcsid[] = RCSID;
|
|||||||
char ifname[32]; /* Interface name */
|
char ifname[32]; /* Interface name */
|
||||||
int pppifunit; /* Interface unit number */
|
int pppifunit; /* Interface unit number */
|
||||||
|
|
||||||
char *progname; /* Name of this program */
|
|
||||||
char hostname[MAXNAMELEN]; /* Our hostname */
|
char hostname[MAXNAMELEN]; /* Our hostname */
|
||||||
static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
|
static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
|
||||||
|
|
||||||
@@ -87,7 +86,7 @@ int detached; /* have detached from terminal */
|
|||||||
struct stat devstat; /* result of stat() on devnam */
|
struct stat devstat; /* result of stat() on devnam */
|
||||||
int prepass = 0; /* doing prepass to find device name */
|
int prepass = 0; /* doing prepass to find device name */
|
||||||
int devnam_fixed; /* set while in options.ttyxx file */
|
int devnam_fixed; /* set while in options.ttyxx file */
|
||||||
volatile int status; /* exit status for pppd */
|
volatile int pppd_status; /* exit status for pppd */
|
||||||
int unsuccess; /* # unsuccessful connection attempts */
|
int unsuccess; /* # unsuccessful connection attempts */
|
||||||
int do_callback; /* != 0 if we should do callback next */
|
int do_callback; /* != 0 if we should do callback next */
|
||||||
int doing_callback; /* != 0 if we are doing callback */
|
int doing_callback; /* != 0 if we are doing callback */
|
||||||
@@ -102,8 +101,8 @@ static int pty_master; /* fd for master side of pty */
|
|||||||
static int pty_slave; /* fd for slave side of pty */
|
static int pty_slave; /* fd for slave side of pty */
|
||||||
static int real_ttyfd; /* fd for actual serial port (not pty) */
|
static int real_ttyfd; /* fd for actual serial port (not pty) */
|
||||||
|
|
||||||
int phase; /* where the link is at */
|
int pppd_phase; /* where the link is at */
|
||||||
int kill_link;
|
int pppd_kill_link;
|
||||||
int open_ccp_flag;
|
int open_ccp_flag;
|
||||||
|
|
||||||
char **script_env; /* Env. variable values for scripts */
|
char **script_env; /* Env. variable values for scripts */
|
||||||
@@ -195,8 +194,6 @@ pppdmain(argc, argv)
|
|||||||
(*protp->init)(0);
|
(*protp->init)(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
progname = *argv;
|
|
||||||
|
|
||||||
|
|
||||||
if (!ppp_available()) {
|
if (!ppp_available()) {
|
||||||
option_error(no_ppp_msg);
|
option_error(no_ppp_msg);
|
||||||
@@ -237,7 +234,7 @@ pppdmain(argc, argv)
|
|||||||
need_holdoff = 1;
|
need_holdoff = 1;
|
||||||
ttyfd = -1;
|
ttyfd = -1;
|
||||||
real_ttyfd = -1;
|
real_ttyfd = -1;
|
||||||
status = EXIT_OK;
|
pppd_status = EXIT_OK;
|
||||||
++unsuccess;
|
++unsuccess;
|
||||||
doing_callback = do_callback;
|
doing_callback = do_callback;
|
||||||
do_callback = 0;
|
do_callback = 0;
|
||||||
@@ -260,7 +257,7 @@ pppdmain(argc, argv)
|
|||||||
* in order to wait for the carrier detect signal from the modem.
|
* in order to wait for the carrier detect signal from the modem.
|
||||||
*/
|
*/
|
||||||
hungup = 0;
|
hungup = 0;
|
||||||
kill_link = 0;
|
pppd_kill_link = 0;
|
||||||
connector = doing_callback? callback_script: connect_script;
|
connector = doing_callback? callback_script: connect_script;
|
||||||
if (devnam[0] != 0) {
|
if (devnam[0] != 0) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -275,7 +272,7 @@ pppdmain(argc, argv)
|
|||||||
errno = err;
|
errno = err;
|
||||||
if (err != EINTR) {
|
if (err != EINTR) {
|
||||||
error("Failed to open %s: %m", devnam);
|
error("Failed to open %s: %m", devnam);
|
||||||
status = EXIT_OPEN_FAILED;
|
pppd_status = EXIT_OPEN_FAILED;
|
||||||
}
|
}
|
||||||
if (!persist || err != EINTR)
|
if (!persist || err != EINTR)
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -313,10 +310,10 @@ pppdmain(argc, argv)
|
|||||||
if (initializer && initializer[0]) {
|
if (initializer && initializer[0]) {
|
||||||
if (device_script(ttyfd, DIALER_INIT, initializer) < 0) {
|
if (device_script(ttyfd, DIALER_INIT, initializer) < 0) {
|
||||||
error("Initializer script failed");
|
error("Initializer script failed");
|
||||||
status = EXIT_INIT_FAILED;
|
pppd_status = EXIT_INIT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (kill_link)
|
if (pppd_kill_link)
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
|
|
||||||
info("Serial port initialized.");
|
info("Serial port initialized.");
|
||||||
@@ -325,10 +322,10 @@ pppdmain(argc, argv)
|
|||||||
if (connector && connector[0]) {
|
if (connector && connector[0]) {
|
||||||
if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) {
|
if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) {
|
||||||
error("Connect script failed");
|
error("Connect script failed");
|
||||||
status = EXIT_CONNECT_FAILED;
|
pppd_status = EXIT_CONNECT_FAILED;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (kill_link)
|
if (pppd_kill_link)
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
|
|
||||||
info("Serial connection established.");
|
info("Serial connection established.");
|
||||||
@@ -350,9 +347,9 @@ pppdmain(argc, argv)
|
|||||||
break;
|
break;
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
error("Failed to reopen %s: %m", devnam);
|
error("Failed to reopen %s: %m", devnam);
|
||||||
status = EXIT_OPEN_FAILED;
|
pppd_status = EXIT_OPEN_FAILED;
|
||||||
}
|
}
|
||||||
if (!persist || errno != EINTR || hungup || kill_link)
|
if (!persist || errno != EINTR || hungup || pppd_kill_link)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
close(i);
|
close(i);
|
||||||
@@ -370,7 +367,7 @@ pppdmain(argc, argv)
|
|||||||
/* set up the serial device as a ppp interface */
|
/* set up the serial device as a ppp interface */
|
||||||
fd_ppp = establish_ppp(ttyfd);
|
fd_ppp = establish_ppp(ttyfd);
|
||||||
if (fd_ppp < 0) {
|
if (fd_ppp < 0) {
|
||||||
status = EXIT_FATAL_ERROR;
|
pppd_status = EXIT_FATAL_ERROR;
|
||||||
goto disconnect;
|
goto disconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,19 +387,19 @@ pppdmain(argc, argv)
|
|||||||
lcp_open(0); /* Start protocol */
|
lcp_open(0); /* Start protocol */
|
||||||
|
|
||||||
open_ccp_flag = 0;
|
open_ccp_flag = 0;
|
||||||
status = EXIT_NEGOTIATION_FAILED;
|
pppd_status = EXIT_NEGOTIATION_FAILED;
|
||||||
new_phase(PHASE_ESTABLISH);
|
new_phase(PHASE_ESTABLISH);
|
||||||
while (phase != PHASE_DEAD) {
|
while (pppd_phase != PHASE_DEAD) {
|
||||||
wait_input(timeleft(&timo));
|
wait_input(timeleft(&timo));
|
||||||
calltimeout();
|
calltimeout();
|
||||||
get_input();
|
get_input();
|
||||||
|
|
||||||
if (kill_link) {
|
if (pppd_kill_link) {
|
||||||
lcp_close(0, "User request");
|
lcp_close(0, "User request");
|
||||||
kill_link = 0;
|
pppd_kill_link = 0;
|
||||||
}
|
}
|
||||||
if (open_ccp_flag) {
|
if (open_ccp_flag) {
|
||||||
if (phase == PHASE_NETWORK || phase == PHASE_RUNNING) {
|
if (pppd_phase == PHASE_NETWORK || pppd_phase == PHASE_RUNNING) {
|
||||||
ccp_fsm[0].flags = OPT_RESTART; /* clears OPT_SILENT */
|
ccp_fsm[0].flags = OPT_RESTART; /* clears OPT_SILENT */
|
||||||
(*ccp_protent.open)(0);
|
(*ccp_protent.open)(0);
|
||||||
}
|
}
|
||||||
@@ -450,7 +447,7 @@ pppdmain(argc, argv)
|
|||||||
if (!persist || (maxfail > 0 && unsuccess >= maxfail))
|
if (!persist || (maxfail > 0 && unsuccess >= maxfail))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
kill_link = 0;
|
pppd_kill_link = 0;
|
||||||
if (demand)
|
if (demand)
|
||||||
demand_discard();
|
demand_discard();
|
||||||
t = need_holdoff? holdoff: 0;
|
t = need_holdoff? holdoff: 0;
|
||||||
@@ -463,18 +460,18 @@ pppdmain(argc, argv)
|
|||||||
wait_input(timeleft(&timo));
|
wait_input(timeleft(&timo));
|
||||||
|
|
||||||
calltimeout();
|
calltimeout();
|
||||||
if (kill_link) {
|
if (pppd_kill_link) {
|
||||||
kill_link = 0;
|
pppd_kill_link = 0;
|
||||||
new_phase(PHASE_DORMANT); /* allow signal to end holdoff */
|
new_phase(PHASE_DORMANT); /* allow signal to end holdoff */
|
||||||
}
|
}
|
||||||
} while (phase == PHASE_HOLDOFF);
|
} while (pppd_phase == PHASE_HOLDOFF);
|
||||||
if (!persist)
|
if (!persist)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
die(status);
|
die(pppd_status);
|
||||||
return status;
|
return pppd_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -591,7 +588,7 @@ get_input(void)
|
|||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
notice("Modem hangup");
|
notice("Modem hangup");
|
||||||
hungup = 1;
|
hungup = 1;
|
||||||
status = EXIT_HANGUP;
|
pppd_status = EXIT_HANGUP;
|
||||||
lcp_lowerdown(0); /* serial link is no longer available */
|
lcp_lowerdown(0); /* serial link is no longer available */
|
||||||
link_terminated(0);
|
link_terminated(0);
|
||||||
return;
|
return;
|
||||||
@@ -621,11 +618,11 @@ get_input(void)
|
|||||||
* Until we get past the authentication phase, toss all packets
|
* Until we get past the authentication phase, toss all packets
|
||||||
* except LCP, LQR and authentication packets.
|
* except LCP, LQR and authentication packets.
|
||||||
*/
|
*/
|
||||||
if (phase <= PHASE_AUTHENTICATE
|
if (pppd_phase <= PHASE_AUTHENTICATE
|
||||||
&& !(protocol == PPP_LCP || protocol == PPP_LQR
|
&& !(protocol == PPP_LCP || protocol == PPP_LQR
|
||||||
|| protocol == PPP_PAP || protocol == PPP_CHAP)) {
|
|| protocol == PPP_PAP || protocol == PPP_CHAP)) {
|
||||||
MAINDEBUG(("get_input: discarding proto 0x%x in phase %d",
|
MAINDEBUG(("get_input: discarding proto 0x%x in phase %d",
|
||||||
protocol, phase));
|
protocol, pppd_phase));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +660,7 @@ void
|
|||||||
new_phase(p)
|
new_phase(p)
|
||||||
int p;
|
int p;
|
||||||
{
|
{
|
||||||
phase = p;
|
pppd_phase = p;
|
||||||
if (new_phase_hook)
|
if (new_phase_hook)
|
||||||
(*new_phase_hook)(p);
|
(*new_phase_hook)(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,12 +177,12 @@ int rtems_pppd_set_option(const char *pOption, const char *pValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* save current phase value */
|
/* save current phase value */
|
||||||
prevPhase = phase;
|
prevPhase = pppd_phase;
|
||||||
phase = PHASE_INITIALIZE;
|
pppd_phase = PHASE_INITIALIZE;
|
||||||
|
|
||||||
/* process option and reset phase value */
|
/* process option and reset phase value */
|
||||||
iReturn = options_from_list(&option, 1);
|
iReturn = options_from_list(&option, 1);
|
||||||
phase = prevPhase;
|
pppd_phase = prevPhase;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( iReturn );
|
return ( iReturn );
|
||||||
@@ -200,7 +200,7 @@ static void timeout_terminate(void *arg)
|
|||||||
{
|
{
|
||||||
/* set pppd global variables to disconnect */
|
/* set pppd global variables to disconnect */
|
||||||
persist = 0;
|
persist = 0;
|
||||||
kill_link = 1;
|
pppd_kill_link = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtems_pppd_disconnect(void)
|
int rtems_pppd_disconnect(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user