ipv6rsfd = ipv6rs_open();
if (ipv6rsfd == -1) {
syslog(LOG_ERR, "ipv6rs: %m");
- options &= ~DHCPCD_IPV6RS;
+ options &= ~(DHCPCD_IPV6RS |
+ DHCPCD_IPV6RA_OWN | DHCPCD_IPV6RA_OWN_DEFAULT);
} else {
eloop_event_add(ipv6rsfd, ipv6rs_handledata, NULL);
// atexit(restore_rtadv);
int
check_ipv6(const char *ifname)
{
- int val;
+ int r;
/* BSD doesn't support these values per iface, so just return 1 */
if (ifname)
return 1;
- val = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
- if (val == 0)
+ r = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
+ if (r == -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_ACCEPT_RTADV: %m");
+ else if (r == 0)
options |= DHCPCD_IPV6RA_OWN;
else if (options & DHCPCD_IPV6RA_OWN) {
syslog(LOG_INFO, "disabling Kernel IPv6 RA support");
}
atexit(restore_kernel_ra);
}
-return 1;
- if (get_inet6_sysctl(IPV6CTL_FORWARDING) != 0) {
+
+ r = get_inet6_sysctl(IPV6CTL_FORWARDING);
+ if (r == -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 (r != 0) {
syslog(LOG_WARNING,
"Kernel is configured as a router, not a host");
return 0;
snprintf(path, sizeof(path), "%s/%s/accept_ra", prefix, ifname);
r = check_proc_int(path);
- if (r == 0)
+ if (r == -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 (r == 0)
options |= DHCPCD_IPV6RA_OWN;
else if (options & DHCPCD_IPV6RA_OWN) {
syslog(LOG_INFO, "%s: disabling Kernel IPv6 RA support",
if (r != 2) {
snprintf(path, sizeof(path), "%s/%s/forwarding",
prefix, ifname);
- if (check_proc_int(path) != 0) {
+ r = check_proc_int(path);
+ if (r == -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 (r != 0) {
syslog(LOG_WARNING,
"%s: configured as a router, not a host", ifname);
return 0;