summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtsold/rtsold.c
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2004-01-14 17:42:03 +0000
committerume <ume@FreeBSD.org>2004-01-14 17:42:03 +0000
commit7fa7bd6ad2ca27f28c91cc116d9cad1aabbf9e73 (patch)
treecccc02033f7c2ccb5644562f4c92694699fc5194 /usr.sbin/rtsold/rtsold.c
parentab3e3db491512f6183cc555d21572b96c642da08 (diff)
downloadFreeBSD-src-7fa7bd6ad2ca27f28c91cc116d9cad1aabbf9e73.zip
FreeBSD-src-7fa7bd6ad2ca27f28c91cc116d9cad1aabbf9e73.tar.gz
add -F flag, which configures sysctl(8) setting by rtsold
itself (rather than warn about the current setting). Obtained from: KAME
Diffstat (limited to 'usr.sbin/rtsold/rtsold.c')
-rw-r--r--usr.sbin/rtsold/rtsold.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c
index e058dd7..bfdbc68 100644
--- a/usr.sbin/rtsold/rtsold.c
+++ b/usr.sbin/rtsold/rtsold.c
@@ -62,6 +62,7 @@ struct ifinfo *iflist;
struct timeval tm_max = {0x7fffffff, 0x7fffffff};
static int log_upto = 999;
static int fflag = 0;
+static int Fflag = 0; /* force setting sysctl parameters */
int aflag = 0;
int dflag = 0;
@@ -120,9 +121,9 @@ main(int argc, char **argv)
if (argv0 && argv0[strlen(argv0) - 1] != 'd') {
fflag = 1;
once = 1;
- opts = "adDO:";
+ opts = "adDFO:";
} else
- opts = "adDfm1O:";
+ opts = "adDfFm1O:";
while ((ch = getopt(argc, argv, opts)) != -1) {
switch (ch) {
@@ -138,6 +139,9 @@ main(int argc, char **argv)
case 'f':
fflag = 1;
break;
+ case 'F':
+ Fflag = 1;
+ break;
case 'm':
mobile_node = 1;
break;
@@ -186,12 +190,17 @@ main(int argc, char **argv)
srandom((u_long)time(NULL));
#endif
- /* warn if accept_rtadv is down */
- if (!getinet6sysctl(IPV6CTL_ACCEPT_RTADV))
- warnx("kernel is configured not to accept RAs");
- /* warn if forwarding is up */
- if (getinet6sysctl(IPV6CTL_FORWARDING))
- warnx("kernel is configured as a router, not a host");
+ if (Fflag) {
+ setinet6sysctl(IPV6CTL_ACCEPT_RTADV, 1);
+ setinet6sysctl(IPV6CTL_FORWARDING, 0);
+ } else {
+ /* warn if accept_rtadv is down */
+ if (!getinet6sysctl(IPV6CTL_ACCEPT_RTADV))
+ warnx("kernel is configured not to accept RAs");
+ /* warn if forwarding is up */
+ if (getinet6sysctl(IPV6CTL_FORWARDING))
+ warnx("kernel is configured as a router, not a host");
+ }
/* initialization to dump internal status to a file */
signal(SIGUSR1, rtsold_set_dump_file);
@@ -720,11 +729,11 @@ static void
usage(char *progname)
{
if (progname && progname[strlen(progname) - 1] != 'd') {
- fprintf(stderr, "usage: rtsol [-dD] interfaces...\n");
- fprintf(stderr, "usage: rtsol [-dD] -a\n");
+ fprintf(stderr, "usage: rtsol [-dDF] interfaces...\n");
+ fprintf(stderr, "usage: rtsol [-dDF] -a\n");
} else {
- fprintf(stderr, "usage: rtsold [-adDfm1] interfaces...\n");
- fprintf(stderr, "usage: rtsold [-dDfm1] -a\n");
+ fprintf(stderr, "usage: rtsold [-adDfFm1] interfaces...\n");
+ fprintf(stderr, "usage: rtsold [-dDfFm1] -a\n");
}
exit(1);
}
OpenPOWER on IntegriCloud