summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/bundle.c36
-rw-r--r--usr.sbin/ppp/command.c11
-rw-r--r--usr.sbin/ppp/datalink.c23
-rw-r--r--usr.sbin/ppp/defs.c10
-rw-r--r--usr.sbin/ppp/defs.h18
-rw-r--r--usr.sbin/ppp/ipcp.c8
-rw-r--r--usr.sbin/ppp/main.c82
7 files changed, 90 insertions, 98 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 474e895..48f996e 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: bundle.c,v 1.9 1998/05/28 23:15:29 brian Exp $
+ * $Id: bundle.c,v 1.10 1998/05/28 23:17:31 brian Exp $
*/
#include <sys/param.h>
@@ -216,13 +216,13 @@ bundle_AutoLoadTimeout(void *v)
if (bundle->autoload.comingup) {
log_Printf(LogPHASE, "autoload: Another link is required\n");
/* bundle_Open() stops the timer */
- bundle_Open(bundle, NULL, PHYS_DEMAND);
+ bundle_Open(bundle, NULL, PHYS_AUTO);
} else {
struct datalink *dl, *last;
timer_Stop(&bundle->autoload.timer);
for (last = NULL, dl = bundle->links; dl; dl = dl->next)
- if (dl->physical->type == PHYS_DEMAND && dl->state == DATALINK_OPEN)
+ if (dl->physical->type == PHYS_AUTO && dl->state == DATALINK_OPEN)
last = dl;
if (last)
@@ -242,7 +242,7 @@ bundle_StartAutoLoadTimer(struct bundle *bundle, int up)
bundle->autoload.running = 0;
} else if (up) {
for (dl = bundle->links; dl; dl = dl->next)
- if (dl->state == DATALINK_CLOSED && dl->physical->type == PHYS_DEMAND) {
+ if (dl->state == DATALINK_CLOSED && dl->physical->type == PHYS_AUTO) {
if (bundle->cfg.autoload.max.timeout) {
bundle->autoload.timer.func = bundle_AutoLoadTimeout;
bundle->autoload.timer.name = "autoload up";
@@ -262,7 +262,7 @@ bundle_StartAutoLoadTimer(struct bundle *bundle, int up)
for (nlinks = 0, adl = NULL, dl = bundle->links; dl; dl = dl->next)
if (dl->state == DATALINK_OPEN) {
- if (dl->physical->type == PHYS_DEMAND)
+ if (dl->physical->type == PHYS_AUTO)
adl = dl;
if (++nlinks > 1 && adl) {
if (bundle->cfg.autoload.min.timeout) {
@@ -504,7 +504,7 @@ bundle_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
}
if (r &&
- (bundle->phase == PHASE_NETWORK || bundle->phys_type & PHYS_DEMAND)) {
+ (bundle->phase == PHASE_NETWORK || bundle->phys_type & PHYS_AUTO)) {
/* enough surplus so that we can tell if we're getting swamped */
want = bundle->cfg.autoload.max.packets + nlinks * 2;
/* but at least 20 packets ! */
@@ -613,7 +613,7 @@ bundle_DescriptorRead(struct descriptor *d, struct bundle *bundle,
* *not* be UP and we can't receive data
*/
if ((pri = PacketCheck(bundle, tun.data, n, &bundle->filter.dial)) >= 0)
- bundle_Open(bundle, NULL, PHYS_DEMAND);
+ bundle_Open(bundle, NULL, PHYS_AUTO);
else
/*
* Drop the packet. If we were to queue it, we'd just end up with
@@ -1025,7 +1025,7 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
/*
* Our datalink has closed.
* CleanDatalinks() (called from DoLoop()) will remove closed
- * 1OFF and DIRECT links.
+ * BACKGROUND and DIRECT links.
* If it's the last data link, enter phase DEAD.
*
* NOTE: dl may not be in our list (bundle_SendDatalink()) !
@@ -1040,7 +1040,7 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
other_links++;
if (!other_links) {
- if (dl->physical->type != PHYS_DEMAND) /* Not in -auto mode */
+ if (dl->physical->type != PHYS_AUTO) /* Not in -auto mode */
bundle_DownInterface(bundle);
if (bundle->ncp.ipcp.fsm.state > ST_CLOSED ||
bundle->ncp.ipcp.fsm.state == ST_STARTING) {
@@ -1068,8 +1068,8 @@ bundle_Open(struct bundle *bundle, const char *name, int mask)
if (name == NULL || !strcasecmp(dl->name, name)) {
if (dl->state == DATALINK_CLOSED && (mask & dl->physical->type)) {
datalink_Up(dl, 1, 1);
- if (mask == PHYS_DEMAND)
- /* Only one DEMAND link at a time (see the AutoLoad timer) */
+ if (mask == PHYS_AUTO)
+ /* Only one AUTO link at a time (see the AutoLoad timer) */
break;
}
if (name != NULL)
@@ -1220,7 +1220,7 @@ void
bundle_StartIdleTimer(struct bundle *bundle)
{
timer_Stop(&bundle->idle.timer);
- if ((bundle->phys_type & (PHYS_DEDICATED|PHYS_PERM)) != bundle->phys_type &&
+ if ((bundle->phys_type & (PHYS_DEDICATED|PHYS_DDIAL)) != bundle->phys_type &&
bundle->cfg.idle_timeout) {
bundle->idle.timer.func = bundle_IdleTimeout;
bundle->idle.timer.name = "idle";
@@ -1264,7 +1264,7 @@ static void
bundle_LinkAdded(struct bundle *bundle, struct datalink *dl)
{
bundle->phys_type |= dl->physical->type;
- if (dl->physical->type == PHYS_DEMAND &&
+ if (dl->physical->type == PHYS_AUTO &&
bundle->autoload.timer.state == TIMER_STOPPED &&
bundle->phase == PHASE_NETWORK)
bundle->autoload.running = 1;
@@ -1279,7 +1279,7 @@ bundle_LinksRemoved(struct bundle *bundle)
for (dl = bundle->links; dl; dl = dl->next)
bundle_LinkAdded(bundle, dl);
- if ((bundle->phys_type & (PHYS_DEDICATED|PHYS_PERM)) == bundle->phys_type)
+ if ((bundle->phys_type & (PHYS_DEDICATED|PHYS_DDIAL)) == bundle->phys_type)
timer_Stop(&bundle->idle.timer);
}
@@ -1321,7 +1321,7 @@ bundle_CleanDatalinks(struct bundle *bundle)
while (*dlp)
if ((*dlp)->state == DATALINK_CLOSED &&
- (*dlp)->physical->type & (PHYS_DIRECT|PHYS_1OFF)) {
+ (*dlp)->physical->type & (PHYS_DIRECT|PHYS_BACKGROUND)) {
*dlp = datalink_Destroy(*dlp);
found++;
} else
@@ -1544,7 +1544,7 @@ bundle_SetMode(struct bundle *bundle, struct datalink *dl, int mode)
if (omode == mode)
return 1;
- if (mode == PHYS_DEMAND && !(bundle->phys_type & PHYS_DEMAND))
+ if (mode == PHYS_AUTO && !(bundle->phys_type & PHYS_AUTO))
/* Changing to demand-dial mode */
if (bundle->ncp.ipcp.peer_ip.s_addr == INADDR_ANY) {
log_Printf(LogWARN, "You must `set ifaddr' before changing mode to %s\n",
@@ -1555,13 +1555,13 @@ bundle_SetMode(struct bundle *bundle, struct datalink *dl, int mode)
if (!datalink_SetMode(dl, mode))
return 0;
- if (mode == PHYS_DEMAND && !(bundle->phys_type & PHYS_DEMAND))
+ if (mode == PHYS_AUTO && !(bundle->phys_type & PHYS_AUTO))
ipcp_InterfaceUp(&bundle->ncp.ipcp);
/* Regenerate phys_type and adjust autoload & idle timers */
bundle_LinksRemoved(bundle);
- if (omode == PHYS_DEMAND && !(bundle->phys_type & PHYS_DEMAND))
+ if (omode == PHYS_AUTO && !(bundle->phys_type & PHYS_AUTO))
/* Changing from demand-dial mode */
ipcp_CleanInterface(&bundle->ncp.ipcp);
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index dcaa0ec..65bf922 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: command.c,v 1.131.2.88 1998/05/21 01:13:26 brian Exp $
+ * $Id: command.c,v 1.135 1998/05/21 21:44:44 brian Exp $
*
*/
#include <sys/types.h>
@@ -124,7 +124,7 @@
#define NEG_DNS 50
const char Version[] = "2.0-beta";
-const char VersionDate[] = "$Date: 1998/05/21 01:13:26 $";
+const char VersionDate[] = "$Date: 1998/05/21 21:44:44 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -296,8 +296,9 @@ DialCommand(struct cmdargs const *arg)
{
int res;
- if ((arg->cx && !(arg->cx->physical->type & (PHYS_MANUAL|PHYS_DEMAND)))
- || (!arg->cx && (arg->bundle->phys_type & ~(PHYS_MANUAL|PHYS_DEMAND)))) {
+ if ((arg->cx && !(arg->cx->physical->type & (PHYS_INTERACTIVE|PHYS_AUTO)))
+ || (!arg->cx &&
+ (arg->bundle->phys_type & ~(PHYS_INTERACTIVE|PHYS_AUTO)))) {
log_Printf(LogWARN, "Manual dial is only available for auto and"
" interactive links\n");
return 1;
@@ -1140,7 +1141,7 @@ SetInterfaceAddr(struct cmdargs const *arg)
}
if (hisaddr && !ipcp_UseHisaddr(arg->bundle, hisaddr,
- arg->bundle->phys_type & PHYS_DEMAND))
+ arg->bundle->phys_type & PHYS_AUTO))
return 4;
return 0;
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c
index c7eafab..a754c75 100644
--- a/usr.sbin/ppp/datalink.c
+++ b/usr.sbin/ppp/datalink.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: datalink.c,v 1.5 1998/05/25 02:22:32 brian Exp $
+ * $Id: datalink.c,v 1.6 1998/05/28 23:15:33 brian Exp $
*/
#include <sys/types.h>
@@ -119,7 +119,7 @@ datalink_HangupDone(struct datalink *dl)
if (dl->bundle->CleaningUp ||
(dl->physical->type == PHYS_DIRECT) ||
((!dl->dial_tries || (dl->dial_tries < 0 && !dl->reconnect_tries)) &&
- !(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)))) {
+ !(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)))) {
datalink_NewState(dl, DATALINK_CLOSED);
dl->dial_tries = -1;
dl->reconnect_tries = 0;
@@ -206,12 +206,13 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
result = 0;
switch (dl->state) {
case DATALINK_CLOSED:
- if ((dl->physical->type & (PHYS_DIRECT|PHYS_DEDICATED|PHYS_1OFF)) &&
+ if ((dl->physical->type &
+ (PHYS_DIRECT|PHYS_DEDICATED|PHYS_BACKGROUND|PHYS_DDIAL)) &&
!bundle_IsDead(dl->bundle))
/*
- * Our first time in - DEDICATED never comes down, and STDIN & 1OFF
- * get deleted when they enter DATALINK_CLOSED. Go to
- * DATALINK_OPENING via datalink_Up() and fall through.
+ * Our first time in - DEDICATED & DDIAL never come down, and
+ * DIRECT & BACKGROUND get deleted when they enter DATALINK_CLOSED.
+ * Go to DATALINK_OPENING via datalink_Up() and fall through.
*/
datalink_Up(dl, 1, 1);
else
@@ -227,7 +228,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
datalink_NewState(dl, DATALINK_DIAL);
chat_Init(&dl->chat, dl->physical, dl->cfg.script.dial, 1,
datalink_ChoosePhoneNumber(dl));
- if (!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
+ if (!(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)) &&
dl->cfg.dial.max)
log_Printf(LogCHAT, "%s: Dial attempt %u of %d\n",
dl->name, dl->cfg.dial.max - dl->dial_tries,
@@ -236,7 +237,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
} else
datalink_LoginDone(dl);
} else {
- if (!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
+ if (!(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)) &&
dl->cfg.dial.max)
log_Printf(LogCHAT, "Failed to open modem (attempt %u of %d)\n",
dl->cfg.dial.max - dl->dial_tries, dl->cfg.dial.max);
@@ -244,7 +245,7 @@ datalink_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e,
log_Printf(LogCHAT, "Failed to open modem\n");
if (dl->bundle->CleaningUp ||
- (!(dl->physical->type & (PHYS_PERM|PHYS_DEDICATED)) &&
+ (!(dl->physical->type & (PHYS_DDIAL|PHYS_DEDICATED)) &&
dl->cfg.dial.max && dl->dial_tries == 0)) {
datalink_NewState(dl, DATALINK_CLOSED);
dl->reconnect_tries = 0;
@@ -642,7 +643,7 @@ datalink_Clone(struct datalink *odl, const char *name)
auth_Init(&dl->chap.auth);
dl->chap.auth.cfg.fsmretry = odl->chap.auth.cfg.fsmretry;
- if ((dl->physical = modem_Create(dl, PHYS_MANUAL)) == NULL) {
+ if ((dl->physical = modem_Create(dl, PHYS_INTERACTIVE)) == NULL) {
free(dl->name);
free(dl);
return NULL;
@@ -1094,7 +1095,7 @@ datalink_SetMode(struct datalink *dl, int mode)
dl->script.run = 0;
if (dl->physical->type == PHYS_DIRECT)
dl->reconnect_tries = 0;
- if (mode & (PHYS_PERM|PHYS_1OFF) && dl->state <= DATALINK_READY)
+ if (mode & (PHYS_DDIAL|PHYS_BACKGROUND) && dl->state <= DATALINK_READY)
datalink_Up(dl, 1, 1);
return 1;
}
diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c
index 85ccbcf..d228eb3 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: defs.c,v 1.13 1998/05/21 21:45:03 brian Exp $
+ * $Id: defs.c,v 1.14 1998/05/29 00:03:00 brian Exp $
*/
@@ -72,12 +72,12 @@ static struct {
int mode;
const char *name;
} modes[] = {
- { PHYS_MANUAL, "interactive" },
- { PHYS_DEMAND, "auto" },
+ { PHYS_INTERACTIVE, "interactive" },
+ { PHYS_AUTO, "auto" },
{ PHYS_DIRECT, "direct" },
{ PHYS_DEDICATED, "dedicated" },
- { PHYS_PERM, "ddial" },
- { PHYS_1OFF, "background" },
+ { PHYS_DDIAL, "ddial" },
+ { PHYS_BACKGROUND, "background" },
{ PHYS_ALL, "*" },
{ 0, 0 }
};
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index 877b7dd..b14f5e9 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: defs.h,v 1.30 1998/05/21 21:45:05 brian Exp $
+ * $Id: defs.h,v 1.31 1998/05/28 23:17:40 brian Exp $
*
* TODO:
*/
@@ -72,14 +72,14 @@
#define EX_NOLOGIN 13
/* physical::type values (OR'd in bundle::phys_type) */
-#define PHYS_NONE 0
-#define PHYS_MANUAL 1 /* Manual link */
-#define PHYS_DEMAND 2 /* Dial-on-demand link (-auto) */
-#define PHYS_DIRECT 4 /* Incoming link (-direct) */
-#define PHYS_DEDICATED 8 /* Dedicated link (-dedicated) */
-#define PHYS_PERM 16 /* Dial immediately, stay connected (-ddial) */
-#define PHYS_1OFF 32 /* Dial immediately, delete when done. (-background) */
-#define PHYS_ALL 63
+#define PHYS_NONE 0
+#define PHYS_INTERACTIVE 1 /* Manual link */
+#define PHYS_AUTO 2 /* Dial-on-demand link */
+#define PHYS_DIRECT 4 /* Incoming link, deleted when closed */
+#define PHYS_DEDICATED 8 /* Dedicated link */
+#define PHYS_DDIAL 16 /* Dial immediately, stay connected */
+#define PHYS_BACKGROUND 32 /* Dial immediately, deleted when closed */
+#define PHYS_ALL 63
extern void randinit(void);
extern ssize_t fullread(int, void *, size_t);
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c
index 444e93c..e7ce60b 100644
--- a/usr.sbin/ppp/ipcp.c
+++ b/usr.sbin/ppp/ipcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ipcp.c,v 1.51 1998/05/21 21:45:46 brian Exp $
+ * $Id: ipcp.c,v 1.52 1998/05/23 22:24:39 brian Exp $
*
* TODO:
* o More RFC1772 backwoard compatibility
@@ -611,7 +611,7 @@ IpcpLayerStart(struct fsm * fp)
/* We're about to start up ! */
log_Printf(LogIPCP, "%s: IpcpLayerStart.\n", fp->link->name);
- /* This is where we should be setting up the interface in DEMAND mode */
+ /* This is where we should be setting up the interface in AUTO mode */
}
static void
@@ -685,7 +685,7 @@ IpcpLayerDown(struct fsm *fp)
system_Select(fp->bundle, "MYADDR", LINKDOWNFILE, NULL);
}
- if (!(ipcp->fsm.bundle->phys_type & PHYS_DEMAND))
+ if (!(ipcp->fsm.bundle->phys_type & PHYS_AUTO))
ipcp_CleanInterface(ipcp);
}
@@ -800,7 +800,7 @@ IpcpDecodeConfig(struct fsm *fp, u_char * cp, int plen, int mode_type,
if (iplist_ip2pos(&ipcp->cfg.peer_list, ipcp->peer_ifip) >= 0)
/*
* If we've already got a valid address configured for the peer
- * (in DEMAND mode), try NAKing with that so that we don't
+ * (in AUTO mode), try NAKing with that so that we don't
* have to upset things too much.
*/
ipcp->peer_ip = ipcp->peer_ifip;
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index e794a15..f782a55 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.126 1998/05/27 22:43:31 brian Exp $
+ * $Id: main.c,v 1.127 1998/05/28 23:17:48 brian Exp $
*
* TODO:
*/
@@ -182,38 +182,44 @@ Usage(void)
static char *
ProcessArgs(int argc, char **argv, int *mode)
{
- int optc, labelrequired;
+ int optc, labelrequired, newmode;
char *cp;
optc = labelrequired = 0;
- *mode = PHYS_MANUAL;
+ *mode = PHYS_INTERACTIVE;
while (argc > 0 && **argv == '-') {
cp = *argv + 1;
- if (strcmp(cp, "auto") == 0) {
- *mode = PHYS_DEMAND;
- labelrequired = 1;
- } else if (strcmp(cp, "background") == 0) {
- *mode = PHYS_1OFF;
- labelrequired = 1;
- } else if (strcmp(cp, "direct") == 0)
- *mode = PHYS_DIRECT;
- else if (strcmp(cp, "dedicated") == 0)
- *mode = PHYS_DEDICATED;
- else if (strcmp(cp, "ddial") == 0) {
- *mode = PHYS_PERM;
- labelrequired = 1;
- } else if (strcmp(cp, "alias") == 0) {
+ newmode = Nam2mode(cp);
+ switch (newmode) {
+ case PHYS_NONE:
+ if (strcmp(cp, "alias") == 0) {
#ifndef NOALIAS
- if (alias_Load() != 0)
+ if (alias_Load() != 0)
#endif
- log_Printf(LogWARN, "Cannot load alias library\n");
- optc--; /* this option isn't exclusive */
- } else
- Usage();
+ log_Printf(LogWARN, "Cannot load alias library\n");
+ optc--; /* this option isn't exclusive */
+ } else
+ Usage();
+ break;
+
+ case PHYS_ALL:
+ Usage();
+ break;
+
+ case PHYS_AUTO:
+ case PHYS_BACKGROUND:
+ case PHYS_DDIAL:
+ labelrequired = 1;
+ /* fall through */
+
+ default:
+ *mode = newmode;
+ }
optc++;
argv++;
argc--;
}
+
if (argc > 1) {
fprintf(stderr, "You may specify only one system label.\n");
exit(EX_START);
@@ -266,7 +272,7 @@ main(int argc, char **argv)
* routing table and then run ppp in interactive mode. The `show route'
* command will drop chunks of data !!!
*/
- if (mode == PHYS_MANUAL) {
+ if (mode == PHYS_INTERACTIVE) {
close(STDIN_FILENO);
if (open(_PATH_TTY, O_RDONLY) != STDIN_FILENO) {
fprintf(stderr, "Cannot open %s for input !\n", _PATH_TTY);
@@ -279,24 +285,8 @@ main(int argc, char **argv)
if (mode == PHYS_DIRECT)
prompt = NULL;
else {
- const char *m;
-
SignalPrompt = prompt = prompt_Create(NULL, NULL, PROMPT_STD);
- if (mode == PHYS_PERM)
- m = "direct dial";
- else if (mode & PHYS_1OFF)
- m = "background";
- else if (mode & PHYS_DEMAND)
- m = "auto";
- else if (mode & PHYS_DEDICATED)
- m = "dedicated";
- else if (mode & PHYS_MANUAL)
- m = "interactive";
- else
- m = NULL;
-
- if (m)
- prompt_Printf(prompt, "Working in %s mode\n", m);
+ prompt_Printf(prompt, "Working in %s mode\n", mode2Nam(mode));
}
ID0init();
@@ -346,7 +336,7 @@ main(int argc, char **argv)
sig_signal(SIGALRM, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
- if (mode == PHYS_MANUAL)
+ if (mode == PHYS_INTERACTIVE)
sig_signal(SIGTSTP, TerminalStop);
sig_signal(SIGUSR2, BringDownServer);
@@ -364,7 +354,7 @@ main(int argc, char **argv)
AbortProgram(EX_START);
}
bundle_SetLabel(bundle, label);
- if (mode == PHYS_DEMAND &&
+ if (mode == PHYS_AUTO &&
bundle->ncp.ipcp.cfg.peer_range.ipaddr.s_addr == INADDR_ANY) {
prompt_Printf(prompt, "You must \"set ifaddr\" with a peer address "
"in label %s for auto mode.\n", label);
@@ -372,12 +362,12 @@ main(int argc, char **argv)
}
}
- if (mode != PHYS_MANUAL) {
+ if (mode != PHYS_INTERACTIVE) {
if (mode != PHYS_DIRECT) {
int bgpipe[2];
pid_t bgpid;
- if (mode == PHYS_1OFF && pipe(bgpipe)) {
+ if (mode == PHYS_BACKGROUND && pipe(bgpipe)) {
log_Printf(LogERROR, "pipe: %s\n", strerror(errno));
AbortProgram(EX_SOCK);
}
@@ -391,7 +381,7 @@ main(int argc, char **argv)
if (bgpid) {
char c = EX_NORMAL;
- if (mode == PHYS_1OFF) {
+ if (mode == PHYS_BACKGROUND) {
close(bgpipe[1]);
BGPid = bgpid;
/* If we get a signal, kill the child */
@@ -415,7 +405,7 @@ main(int argc, char **argv)
close(bgpipe[0]);
}
return c;
- } else if (mode == PHYS_1OFF) {
+ } else if (mode == PHYS_BACKGROUND) {
close(bgpipe[0]);
bundle->notify.fd = bgpipe[1];
}
OpenPOWER on IntegriCloud