diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-04-10 13:19:23 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-04-10 13:19:23 +0000 |
commit | 565e35e50e2cdac423588a3d18742544bde128b0 (patch) | |
tree | 4fd95655022372ca2d6e72fd41d3d7d073afa866 /usr.sbin/ppp/systems.c | |
parent | c06d604b0351800163c0b058cf6c47e036543c24 (diff) | |
download | src-565e35e50e2cdac423588a3d18742544bde128b0.tar.gz src-565e35e50e2cdac423588a3d18742544bde128b0.zip |
o Remove the `mode' global - it's now per physical device.
o Shuffle things that live at the datalink level into
``show link'' rather than ``show modem''.
o Make both ``show'' commands prettier and more consistent,
and display carrier status, link type and our name in
``show modem''.
o Show redial and reconnect information in ``show link''
and remove ``show redial'' and ``show reconnect''.
o Down the correct link in bundle_LinkLost().
o Remove stale -direct and -background links at the end
of our main loop, not when we know they're going. This
prevents unexpected pointer-invalidations...
o If we ``set server'' with the same values twice, notice
and don't moan about failure.
o Record dial script despite our link mode. The mode may
be changed later (next mod) :-) We never run scripts
in -direct and -dedicated modes.
o Make ``set server none'' functional again.
o Correct datalink state array so that we don't report an
``unknown'' state.
o Pass struct ipcp to IpcpCleanInterface, not struct fsm.
o Create TUN_PREFIX define rather than hard-coding in main.c
o prompt_TtyInit now handles a NULL prompt for -direct mode
rather than having to create one then destroy it uncleanly.
o Mention our mode in the "PPP Started" LogPHASE message.
o Bring all auto links up when we have something to send.
o Remove some redundant Physical_*() functions.
o Show which connection is running a command when logging
commands.
o Initialise throughput uptime correctly.
Notes
Notes:
svn path=/cvs2svn/branches/MP/; revision=35118
Diffstat (limited to 'usr.sbin/ppp/systems.c')
-rw-r--r-- | usr.sbin/ppp/systems.c | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index ef9ef0778406..e1aef8e634ea 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: systems.c,v 1.35.2.4 1998/04/03 19:25:58 brian Exp $ + * $Id: systems.c,v 1.35.2.5 1998/04/06 09:12:37 brian Exp $ * * TODO: */ @@ -157,7 +157,10 @@ DecodeCtrlCommand(char *line, char *arg) return CTRL_UNKNOWN; } +/* Initialised in ValidSystem(), set in ReadSystem(), used by ValidSystem() */ +static int modeok; static int userok; +static int modereq; int AllowUsers(struct cmdargs const *arg) @@ -182,17 +185,27 @@ static struct { int mode; const char *name; } modes[] = { - { MODE_INTER, "interactive" }, - { MODE_AUTO, "auto" }, - { MODE_DIRECT, "direct" }, - { MODE_DEDICATED, "dedicated" }, - { MODE_DDIAL, "ddial" }, - { MODE_BACKGROUND, "background" }, - { ~0, "*" }, + { PHYS_MANUAL, "interactive" }, + { PHYS_DEMAND, "auto" }, + { PHYS_STDIN, "direct" }, + { PHYS_DEDICATED, "dedicated" }, + { PHYS_PERM, "ddial" }, + { PHYS_1OFF, "background" }, + { PHYS_ALL, "*" }, { 0, 0 } }; -static int modeok; +const char * +mode2Nam(int mode) +{ + int m; + + for (m = 0; modes[m].mode; m++) + if (modes[m].mode == mode) + return modes[m].name; + + return "unknown"; +} int AllowModes(struct cmdargs const *arg) @@ -213,7 +226,7 @@ AllowModes(struct cmdargs const *arg) LogPrintf(LogWARN, "allow modes: %s: Invalid mode\n", arg->argv[f]); } - modeok = (mode | allowed) == allowed ? 1 : 0; + modeok = modereq & allowed ? 1 : 0; return 0; } @@ -354,7 +367,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, } int -ValidSystem(const char *name, struct prompt *prompt) +ValidSystem(const char *name, struct prompt *prompt, int mode) { /* * Note: The ReadSystem() calls only result in calls to the Allow* @@ -364,6 +377,7 @@ ValidSystem(const char *name, struct prompt *prompt) return userok = modeok = 1; userok = 0; modeok = 1; + modereq = mode; ReadSystem(NULL, "default", CONFFILE, 0, prompt); if (name != NULL) ReadSystem(NULL, name, CONFFILE, 0, prompt); @@ -375,33 +389,6 @@ SelectSystem(struct bundle *bundle, const char *name, const char *file, struct prompt *prompt) { userok = modeok = 1; + modereq = PHYS_ALL; return ReadSystem(bundle, name, file, 1, prompt); } - -int -LoadCommand(struct cmdargs const *arg) -{ - const char *name; - - if (arg->argc > 0) - name = *arg->argv; - else - name = "default"; - - if (!ValidSystem(name, arg->prompt)) { - LogPrintf(LogERROR, "%s: Label not allowed\n", name); - return 1; - } else if (SelectSystem(arg->bundle, name, CONFFILE, arg->prompt) < 0) { - LogPrintf(LogWARN, "%s: label not found.\n", name); - return -1; - } else - SetLabel(arg->argc ? name : NULL); - return 0; -} - -int -SaveCommand(struct cmdargs const *arg) -{ - LogPrintf(LogWARN, "save command is not implemented (yet).\n"); - return 1; -} |