int
check_ipv6(const char *ifname, int own)
{
- static int set_restore = 0, forward_warned = 0, global_ra = 0;
- int ra, forward;
+ static int set_restore = 0, global_ra = 0;
+ int ra;
/* BSD doesn't support these values per iface, so just return
* the global ra setting */
if (ifname == NULL)
global_ra = ra;
- if (!forward_warned) {
- forward = get_inet6_sysctl(IPV6CTL_FORWARDING);
- if (forward == -1)
- /* The sysctl probably doesn't exist, but this isn't an
- * error as such so just log it and continue */
- syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
- "IPV6CTL_FORWARDING: %m");
- else if (forward != 0) {
- forward_warned = 1;
- syslog(LOG_WARNING,
- "Kernel is configured as a router, not a host");
- }
- }
-
/* Flush the kernel knowledge of advertised routers */
ipv6_ra_flush();
check_ipv6(const char *ifname, int own)
{
static int ipv6_checked = 0;
- int ra, forward, ex, i;
+ int ra, ex, i;
char path[256], *p, **nrest;
if (ifname == NULL) {
p = strdup(ifname);
if (p == NULL) {
syslog(LOG_ERR, "%s: %m", __func__);
- goto forward;
+ return ra;
}
nrest = realloc(restore,
(nrestore + 1) * sizeof(char *));
if (nrest == NULL) {
syslog(LOG_ERR, "%s: %m", __func__);
- goto forward;
+ return ra;
}
restore = nrest;
restore[nrestore++] = p;
atexit(restore_kernel_ra);
}
-forward:
- if (ra != 2) {
- snprintf(path, sizeof(path), "%s/%s/forwarding",
- prefix, ifname);
- forward = check_proc_int(path);
- if (forward == -1) {
- /* The sysctl probably doesn't exist, but this isn't an
- * error as such so just log it and continue */
- syslog(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
- "%s: %m", path);
- } else if (forward != 0) {
- syslog(LOG_WARNING,
- "%s: configured as a router, not a host", ifname);
- return 0;
- }
- }
return ra;
}