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
This commit is contained in:
Brian Somers 2001-07-31 11:45:53 +00:00
parent 008969f3d3
commit e9ffffff4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80728
2 changed files with 54 additions and 27 deletions

View File

@ -1,5 +1,5 @@
.\"- .\"-
.\" Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> .\" Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
.\" All rights reserved. .\" All rights reserved.
.\" .\"
.\" Redistribution and use in source and binary forms, with or without .\" Redistribution and use in source and binary forms, with or without
@ -36,7 +36,7 @@
.Op Fl Fd\& .Op Fl Fd\&
.Op Fl P Ar pidfile .Op Fl P Ar pidfile
.Op Fl a Ar name .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 n Ar ngdebug
.Op Fl p Ar provider .Op Fl p Ar provider
.Ar interface .Ar interface
@ -48,9 +48,11 @@ program listens to the given
for PPP over Ethernet (PPPoE) service request packets, and actions them for PPP over Ethernet (PPPoE) service request packets, and actions them
by negotiating a session then envoking a by negotiating a session then envoking a
.Em PPP .Em PPP
program. The negotiation is implemented by the program.
The negotiation is implemented by the
.Dq pppoe .Dq pppoe
netgraph node. See netgraph node.
See
.Xr ng_pppoe 4 .Xr ng_pppoe 4
for details. for details.
.Pp .Pp
@ -64,30 +66,40 @@ is given, any PPPoE requests will be offered service.
.Pp .Pp
The supplied The supplied
.Ar name .Ar name
will be given as the access concentrator name when establishing the will be given as the access concentrator name when establishing the connection.
connection. If no If no
.Ar name .Ar name
is given, the current base hostname is used. is given, the current base hostname is used.
.Pp .Pp
After receiving a request (PADI) from the PPPoE netgraph node, After receiving a request (PADI) from the PPPoE netgraph node,
.Nm .Nm
.Xr fork 2 Ns No s .Xr fork 2 Ns No s
a child process and returns to service further requests. The child process a child process and returns to service further requests.
offers service The child process offers service
.Pq using Ar name .Pq using Ar name
and waits for a and waits for a
.Dv SUCCESS .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 .Nm
will execute will execute
.Pp .Pp
.D1 Ic exec /usr/sbin/ppp -direct Ar provider .D1 Ic exec /usr/sbin/ppp -direct Ar label
.Pp .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 .Ar exec
argument. This is mandatory if argument.
This is mandatory if
.Ar provider .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 attached to the same
.Xr netgraph 4 .Xr netgraph 4
data socket data socket
@ -106,12 +118,14 @@ as the node name, and then connect that
.Dq pppoe .Dq pppoe
node to a local node to a local
.Dq socket .Dq socket
node. If the node.
If the
.Fl F .Fl F
flag has not been given, flag has not been given,
.Nm .Nm
will then go into the background and disassociate itself from the controlling will then go into the background and disassociate itself from the controlling
terminal. When the terminal.
When the
.Fl F .Fl F
flag is given, flag is given,
.Nm .Nm
@ -141,7 +155,8 @@ nodes as described above,
.Nm .Nm
uses uses
.Xr syslogd 8 .Xr syslogd 8
to report all incoming connections. If the to report all incoming connections.
If the
.Fl d .Fl d
flag is given, flag is given,
.Nm .Nm
@ -176,9 +191,11 @@ and the following to
.Sh BUGS .Sh BUGS
If another netgraph node is using the given interface, If another netgraph node is using the given interface,
.Nm .Nm
will fail to start. This is because will fail to start.
This is because
.Xr netgraph 4 .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 .Sh HISTORY
The The
.Nm .Nm

View File

@ -1,5 +1,5 @@
/*- /*-
* Copyright (c) 1999 Brian Somers <brian@Awfulhak.org> * Copyright (c) 1999-2001 Brian Somers <brian@Awfulhak.org>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -68,7 +68,7 @@ static int ReceivedSignal;
static int static int
usage(const char *prog) 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); " [-p provider] interface\n", prog);
return EX_USAGE; return EX_USAGE;
} }
@ -466,7 +466,7 @@ main(int argc, char **argv)
{ {
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1]; char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1];
unsigned char response[1024]; unsigned char response[1024];
const char *prog, *provider, *acname; const char *label, *prog, *provider, *acname;
struct ngm_connect ngc; struct ngm_connect ngc;
struct sigaction act; struct sigaction act;
int ch, cs, ds, ret, optF, optd, optn, sz, f; 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]; prog = prog ? prog + 1 : argv[0];
pidfile = NULL; pidfile = NULL;
exec = NULL; exec = NULL;
label = NULL;
acname = NULL; acname = NULL;
provider = ""; provider = "";
optF = optd = optn = 0; 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) { switch (ch) {
case 'F': case 'F':
optF = 1; optF = 1;
@ -502,6 +503,10 @@ main(int argc, char **argv)
exec = optarg; exec = optarg;
break; break;
case 'l':
label = optarg;
break;
case 'n': case 'n':
optn = 1; optn = 1;
NgSetDebug(atoi(optarg)); NgSetDebug(atoi(optarg));
@ -519,20 +524,25 @@ main(int argc, char **argv)
if (optind >= argc || optind + 2 < argc) if (optind >= argc || optind + 2 < argc)
return usage(prog); return usage(prog);
if (exec != NULL && label != NULL)
return usage(prog);
if (exec == NULL) { if (exec == NULL) {
if (provider == NULL) { if (label == NULL)
fprintf(stderr, "%s: Either a provider or an exec command" label = provider;
if (label == NULL) {
fprintf(stderr, "%s: Either a provider, a label or an exec command"
" must be given\n", prog); " must be given\n", prog);
return usage(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) { if (exec == NULL) {
fprintf(stderr, "%s: Cannot allocate %d bytes\n", prog, 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; return EX_OSERR;
} }
strcpy(exec, DEFAULT_EXEC_PREFIX); strcpy(exec, DEFAULT_EXEC_PREFIX);
strcpy(exec + sizeof DEFAULT_EXEC_PREFIX - 1, provider); strcpy(exec + sizeof DEFAULT_EXEC_PREFIX - 1, label);
} }
if (acname == NULL) { if (acname == NULL) {