- Implement and use usage().

- Document the -C option.
- Allow rtadvd to be invoked without any interfaces on the command line,
  and document that possibility.

MFC after:	1 week
This commit is contained in:
Dag-Erling Smørgrav 2013-02-25 16:47:09 +00:00
parent f2e472dcf4
commit c1803a93a4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247270
2 changed files with 26 additions and 10 deletions

View File

@ -29,7 +29,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 14, 2011 .Dd February 25, 2013
.Dt RTADVD 8 .Dt RTADVD 8
.Os .Os
.Sh NAME .Sh NAME
@ -39,13 +39,19 @@
.Nm .Nm
.Op Fl dDfRs .Op Fl dDfRs
.Op Fl c Ar configfile .Op Fl c Ar configfile
.Op Fl C Ar ctlsock
.Op Fl M Ar ifname .Op Fl M Ar ifname
.Op Fl p Ar pidfile .Op Fl p Ar pidfile
.Ar interface ... .Op Ar interface ...
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
sends router advertisement packets to the specified sends router advertisement packets to the specified
.Ar interfaces . .Ar interfaces .
If no interfaces are specified,
.Nm
will still run, but will not advertise any routes until interfaces are
added using
.Xr rtadvctl 8 .
.Pp .Pp
The program will daemonize itself on invocation. The program will daemonize itself on invocation.
It will then send router advertisement packets periodically, as well It will then send router advertisement packets periodically, as well
@ -121,6 +127,11 @@ for the configuration file.
By default, By default,
.Pa /etc/rtadvd.conf .Pa /etc/rtadvd.conf
is used. is used.
.It Fl C
Specify an alternate location for the control socket used by
.Xr rtadvctl 8 .
The default is
.Pa /var/run/rtadvd.sock .
.It Fl d .It Fl d
Print debugging information. Print debugging information.
.It Fl D .It Fl D
@ -185,6 +196,7 @@ The default process ID file.
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO
.Xr rtadvd.conf 5 , .Xr rtadvd.conf 5 ,
.Xr rtadvctl 8 ,
.Xr rtsol 8 .Xr rtsol 8
.Rs .Rs
.%A Thomas Narten .%A Thomas Narten

View File

@ -166,6 +166,15 @@ static void rtmsg_input(struct sockinfo *);
static void set_short_delay(struct ifinfo *); static void set_short_delay(struct ifinfo *);
static int check_accept_rtadv(int); static int check_accept_rtadv(int);
static void
usage(void)
{
fprintf(stderr, "usage: rtadvd [-dDfRs] "
"[-c configfile] [-C ctlsock] [-M ifname] [-p pidfile]\n");
exit(1);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -177,7 +186,7 @@ main(int argc, char *argv[])
pid_t pid, otherpid; pid_t pid, otherpid;
/* get command line options and arguments */ /* get command line options and arguments */
while ((ch = getopt(argc, argv, "c:C:dDfM:p:Rs")) != -1) { while ((ch = getopt(argc, argv, "c:C:dDfhM:p:Rs")) != -1) {
switch (ch) { switch (ch) {
case 'c': case 'c':
conffile = optarg; conffile = optarg;
@ -209,17 +218,12 @@ main(int argc, char *argv[])
case 'p': case 'p':
pidfilename = optarg; pidfilename = optarg;
break; break;
default:
usage();
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc == 0) {
fprintf(stderr,
"usage: rtadvd [-dDfRs] [-c conffile] "
"[-C ctrlsockname] [-M ifname] "
"[-p pidfile] interfaces...\n");
exit(1);
}
logopt = LOG_NDELAY | LOG_PID; logopt = LOG_NDELAY | LOG_PID;
if (fflag) if (fflag)