summaryrefslogtreecommitdiffstats
path: root/libexec/pppoed
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-07-31 11:45:53 +0000
committerbrian <brian@FreeBSD.org>2001-07-31 11:45:53 +0000
commite516ca8abdf9eab75239fa4d93ea00f83f8212e6 (patch)
treee35326a252bf8974562af04f0353c806689452b5 /libexec/pppoed
parent06710de6d1a79e84c2ff09b30a5d0aa80612acd1 (diff)
downloadFreeBSD-src-e516ca8abdf9eab75239fa4d93ea00f83f8212e6.zip
FreeBSD-src-e516ca8abdf9eab75239fa4d93ea00f83f8212e6.tar.gz
Add a -l flag used to specify a label when no -p flag is given.
Start new sentences on new lines in pppoed.8. MFC after: 1 week
Diffstat (limited to 'libexec/pppoed')
-rw-r--r--libexec/pppoed/pppoed.853
-rw-r--r--libexec/pppoed/pppoed.c28
2 files changed, 54 insertions, 27 deletions
diff --git a/libexec/pppoed/pppoed.8 b/libexec/pppoed/pppoed.8
index 9529675..6376cfc 100644
--- a/libexec/pppoed/pppoed.8
+++ b/libexec/pppoed/pppoed.8
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 1999 Brian Somers <brian@Awfulhak.org>
+.\" Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
.Op Fl Fd\&
.Op Fl P Ar pidfile
.Op Fl a Ar name
-.Op Fl e Ar exec
+.Op Fl e Ar exec No \&| Fl l Ar label
.Op Fl n Ar ngdebug
.Op Fl p Ar provider
.Ar interface
@@ -48,9 +48,11 @@ program listens to the given
for PPP over Ethernet (PPPoE) service request packets, and actions them
by negotiating a session then envoking a
.Em PPP
-program. The negotiation is implemented by the
+program.
+The negotiation is implemented by the
.Dq pppoe
-netgraph node. See
+netgraph node.
+See
.Xr ng_pppoe 4
for details.
.Pp
@@ -64,30 +66,40 @@ is given, any PPPoE requests will be offered service.
.Pp
The supplied
.Ar name
-will be given as the access concentrator name when establishing the
-connection. If no
+will be given as the access concentrator name when establishing the connection.
+If no
.Ar name
is given, the current base hostname is used.
.Pp
After receiving a request (PADI) from the PPPoE netgraph node,
.Nm
.Xr fork 2 Ns No s
-a child process and returns to service further requests. The child process
-offers service
+a child process and returns to service further requests.
+The child process offers service
.Pq using Ar name
and waits for a
.Dv SUCCESS
-indication from the PPPoE node. On receipt of the SUCCESS indication,
+indication from the PPPoE node.
+On receipt of the SUCCESS indication,
.Nm
will execute
.Pp
-.D1 Ic exec /usr/sbin/ppp -direct Ar provider
+.D1 Ic exec /usr/sbin/ppp -direct Ar label
.Pp
-as a shell sub-process. It is possible to specify another command using the
+as a shell sub-process.
+If
+.Ar label
+has not been specified, it defaults to
+.Ar provider .
+It is possible to specify another command using the
.Ar exec
-argument. This is mandatory if
+argument.
+This is mandatory if
.Ar provider
-is not given. The child process will have standard input and standard output
+and
+.Ar label
+are not given.
+The child process will have standard input and standard output
attached to the same
.Xr netgraph 4
data socket
@@ -106,12 +118,14 @@ as the node name, and then connect that
.Dq pppoe
node to a local
.Dq socket
-node. If the
+node.
+If the
.Fl F
flag has not been given,
.Nm
will then go into the background and disassociate itself from the controlling
-terminal. When the
+terminal.
+When the
.Fl F
flag is given,
.Nm
@@ -141,7 +155,8 @@ nodes as described above,
.Nm
uses
.Xr syslogd 8
-to report all incoming connections. If the
+to report all incoming connections.
+If the
.Fl d
flag is given,
.Nm
@@ -176,9 +191,11 @@ and the following to
.Sh BUGS
If another netgraph node is using the given interface,
.Nm
-will fail to start. This is because
+will fail to start.
+This is because
.Xr netgraph 4
-does not currently allow node chaining. This may change in the future.
+does not currently allow node chaining.
+This may change in the future.
.Sh HISTORY
The
.Nm
diff --git a/libexec/pppoed/pppoed.c b/libexec/pppoed/pppoed.c
index f6b4907..177ccf8 100644
--- a/libexec/pppoed/pppoed.c
+++ b/libexec/pppoed/pppoed.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1999 Brian Somers <brian@Awfulhak.org>
+ * Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ static int ReceivedSignal;
static int
usage(const char *prog)
{
- fprintf(stderr, "Usage: %s [-Fd] [-P pidfile] [-a name] [-e exec]"
+ fprintf(stderr, "Usage: %s [-Fd] [-P pidfile] [-a name] [-e exec | -l label]"
" [-p provider] interface\n", prog);
return EX_USAGE;
}
@@ -466,7 +466,7 @@ main(int argc, char **argv)
{
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1];
unsigned char response[1024];
- const char *prog, *provider, *acname;
+ const char *label, *prog, *provider, *acname;
struct ngm_connect ngc;
struct sigaction act;
int ch, cs, ds, ret, optF, optd, optn, sz, f;
@@ -476,11 +476,12 @@ main(int argc, char **argv)
prog = prog ? prog + 1 : argv[0];
pidfile = NULL;
exec = NULL;
+ label = NULL;
acname = NULL;
provider = "";
optF = optd = optn = 0;
- while ((ch = getopt(argc, argv, "FP:a:de:n:p:")) != -1) {
+ while ((ch = getopt(argc, argv, "FP:a:de:l:n:p:")) != -1) {
switch (ch) {
case 'F':
optF = 1;
@@ -502,6 +503,10 @@ main(int argc, char **argv)
exec = optarg;
break;
+ case 'l':
+ label = optarg;
+ break;
+
case 'n':
optn = 1;
NgSetDebug(atoi(optarg));
@@ -519,20 +524,25 @@ main(int argc, char **argv)
if (optind >= argc || optind + 2 < argc)
return usage(prog);
+ if (exec != NULL && label != NULL)
+ return usage(prog);
+
if (exec == NULL) {
- if (provider == NULL) {
- fprintf(stderr, "%s: Either a provider or an exec command"
+ if (label == NULL)
+ label = provider;
+ if (label == NULL) {
+ fprintf(stderr, "%s: Either a provider, a label or an exec command"
" must be given\n", prog);
return usage(prog);
}
- exec = (char *)alloca(sizeof DEFAULT_EXEC_PREFIX + strlen(provider));
+ exec = (char *)alloca(sizeof DEFAULT_EXEC_PREFIX + strlen(label));
if (exec == NULL) {
fprintf(stderr, "%s: Cannot allocate %d bytes\n", prog,
- (int)(sizeof DEFAULT_EXEC_PREFIX) + strlen(provider));
+ (int)(sizeof DEFAULT_EXEC_PREFIX) + strlen(label));
return EX_OSERR;
}
strcpy(exec, DEFAULT_EXEC_PREFIX);
- strcpy(exec + sizeof DEFAULT_EXEC_PREFIX - 1, provider);
+ strcpy(exec + sizeof DEFAULT_EXEC_PREFIX - 1, label);
}
if (acname == NULL) {
OpenPOWER on IntegriCloud