mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-05 12:56:08 +00:00
add -F flag, which configures sysctl(8) setting by rtsold
itself (rather than warn about the current setting). Obtained from: KAME
This commit is contained in:
parent
8e7409eda3
commit
fcdaee3127
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124525
@ -300,6 +300,22 @@ getinet6sysctl(int code)
|
||||
return value;
|
||||
}
|
||||
|
||||
int
|
||||
setinet6sysctl(int code, int newval)
|
||||
{
|
||||
int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
|
||||
int value;
|
||||
size_t size;
|
||||
|
||||
mib[3] = code;
|
||||
size = sizeof(value);
|
||||
if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size,
|
||||
&newval, sizeof(newval)) < 0)
|
||||
return -1;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
/* get ia6_flags for link-local addr on if. returns -1 on error. */
|
||||
|
@ -39,15 +39,15 @@
|
||||
.\"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl dDfm1
|
||||
.Op Fl dDfFm1
|
||||
.Op Fl O Ar script-name
|
||||
.Ar interface ...
|
||||
.Nm
|
||||
.Op Fl dDfm1
|
||||
.Op Fl dDfFm1
|
||||
.Op Fl O Ar script-name
|
||||
.Fl a
|
||||
.Nm rtsol
|
||||
.Op Fl dD
|
||||
.Op Fl dDF
|
||||
.Op Fl O Ar script-name
|
||||
.Ar interface ...
|
||||
.Nm rtsol
|
||||
@ -176,6 +176,18 @@ from becoming a daemon (foreground mode).
|
||||
Warning messages are generated to standard error
|
||||
instead of
|
||||
.Xr syslog 3 .
|
||||
.It Fl F
|
||||
Configure
|
||||
.Xr sysctl 8
|
||||
variable related to
|
||||
.Nm
|
||||
by itself.
|
||||
Without
|
||||
.Fl F ,
|
||||
.Nm
|
||||
will not alter and obey the current
|
||||
.Xr sysctl 8
|
||||
settings.
|
||||
.It Fl m
|
||||
Enable mobility support.
|
||||
If this option is specified,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ extern int lladdropt_length __P((struct sockaddr_dl *));
|
||||
extern void lladdropt_fill __P((struct sockaddr_dl *, struct nd_opt_hdr *));
|
||||
extern struct sockaddr_dl *if_nametosdl __P((char *));
|
||||
extern int getinet6sysctl __P((int));
|
||||
extern int setinet6sysctl __P((int, int));
|
||||
|
||||
/* rtsol.c */
|
||||
extern int sockopen __P((void));
|
||||
|
Loading…
Reference in New Issue
Block a user