summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-11-28 15:50:08 +0000
committerbrian <brian@FreeBSD.org>1999-11-28 15:50:08 +0000
commit08e4eaabf2d6188141c3ef36a4a5250ae7ac2782 (patch)
tree2ff6d4532f47c2ee0b240dc4de85ac37083ea5c0 /usr.sbin/ppp
parent987e083f00337d507f142a6cd79653fa2bdec0cd (diff)
downloadFreeBSD-src-08e4eaabf2d6188141c3ef36a4a5250ae7ac2782.zip
FreeBSD-src-08e4eaabf2d6188141c3ef36a4a5250ae7ac2782.tar.gz
Make -foreground a proper option (allowing ``allow mode foreground'',
``set mode foreground'' etc.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/bundle.c5
-rw-r--r--usr.sbin/ppp/datalink.c12
-rw-r--r--usr.sbin/ppp/defs.c1
-rw-r--r--usr.sbin/ppp/defs.h3
-rw-r--r--usr.sbin/ppp/main.c5
-rw-r--r--usr.sbin/ppp/physical.c1
6 files changed, 16 insertions, 11 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c
index 0f62c7b..bc11ed5 100644
--- a/usr.sbin/ppp/bundle.c
+++ b/usr.sbin/ppp/bundle.c
@@ -966,7 +966,7 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
/*
* Our datalink has closed.
* CleanDatalinks() (called from DoLoop()) will remove closed
- * BACKGROUND and DIRECT links.
+ * BACKGROUND, FOREGROUND and DIRECT links.
* If it's the last data link, enter phase DEAD.
*
* NOTE: dl may not be in our list (bundle_SendDatalink()) !
@@ -1282,7 +1282,8 @@ bundle_CleanDatalinks(struct bundle *bundle)
while (*dlp)
if ((*dlp)->state == DATALINK_CLOSED &&
- (*dlp)->physical->type & (PHYS_DIRECT|PHYS_BACKGROUND)) {
+ (*dlp)->physical->type &
+ (PHYS_DIRECT|PHYS_BACKGROUND|PHYS_FOREGROUND)) {
*dlp = datalink_Destroy(*dlp);
found++;
} else
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c
index 9df91c8..a050e25 100644
--- a/usr.sbin/ppp/datalink.c
+++ b/usr.sbin/ppp/datalink.c
@@ -249,13 +249,14 @@ 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_BACKGROUND|PHYS_DDIAL)) &&
+ if ((dl->physical->type & (PHYS_DIRECT|PHYS_DEDICATED|PHYS_BACKGROUND|
+ PHYS_FOREGROUND|PHYS_DDIAL)) &&
!dl->bundle->CleaningUp)
/*
* 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.
+ * DIRECT, FOREGROUND & BACKGROUND get deleted when they enter
+ * DATALINK_CLOSED. Go to DATALINK_OPENING via datalink_Up()
+ * and fall through.
*/
datalink_Up(dl, 1, 1);
else
@@ -1410,7 +1411,8 @@ datalink_SetMode(struct datalink *dl, int mode)
dl->script.run = 0;
if (dl->physical->type == PHYS_DIRECT)
dl->reconnect_tries = 0;
- if (mode & (PHYS_DDIAL|PHYS_BACKGROUND) && dl->state <= DATALINK_READY)
+ if (mode & (PHYS_DDIAL|PHYS_BACKGROUND|PHYS_FOREGROUND) &&
+ 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 740fc62..4cb6de6 100644
--- a/usr.sbin/ppp/defs.c
+++ b/usr.sbin/ppp/defs.c
@@ -90,6 +90,7 @@ static struct {
{ PHYS_DEDICATED, "dedicated" },
{ PHYS_DDIAL, "ddial" },
{ PHYS_BACKGROUND, "background" },
+ { PHYS_FOREGROUND, "foreground" },
{ PHYS_ALL, "*" },
{ 0, 0 }
};
diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h
index 4ee2660..4999f8b 100644
--- a/usr.sbin/ppp/defs.h
+++ b/usr.sbin/ppp/defs.h
@@ -88,7 +88,8 @@
#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
+#define PHYS_FOREGROUND 64 /* Pseudo mode, same as background */
+#define PHYS_ALL 127
extern void randinit(void);
extern ssize_t fullread(int, void *, size_t);
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index a108f93..63ea644 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -245,9 +245,6 @@ ProcessArgs(int argc, char **argv, struct switches *sw)
} else if (strcmp(cp, "quiet") == 0) {
sw->quiet = 1;
optc--; /* this option isn't exclusive */
- } else if (strcmp(cp, "foreground") == 0) {
- sw->mode = PHYS_BACKGROUND; /* Kinda like background mode */
- sw->fg = 1;
} else
Usage();
break;
@@ -258,6 +255,8 @@ ProcessArgs(int argc, char **argv, struct switches *sw)
default:
sw->mode = newmode;
+ if (newmode == PHYS_FOREGROUND)
+ sw->fg = 1;
}
}
diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c
index e402633..61e22a4 100644
--- a/usr.sbin/ppp/physical.c
+++ b/usr.sbin/ppp/physical.c
@@ -890,6 +890,7 @@ physical_SetMode(struct physical *p, int mode)
if ((p->type & (PHYS_DIRECT|PHYS_DEDICATED) ||
mode & (PHYS_DIRECT|PHYS_DEDICATED)) &&
(!(p->type & PHYS_DIRECT) || !(mode & PHYS_BACKGROUND))) {
+ /* Note: The -direct -> -background is for callback ! */
log_Printf(LogWARN, "%s: Cannot change mode %s to %s\n", p->link.name,
mode2Nam(p->type), mode2Nam(mode));
return 0;
OpenPOWER on IntegriCloud