summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-11-04 17:21:33 +0000
committerRoy Marples <roy@marples.name>2019-11-04 17:21:33 +0000
commit8c94248fe45c03f0e03f418f5d4bf2dea68cb41f (patch)
treefb0b948734fc01d32426ed4475d3e53278bfc10c /src/if-bsd.c
parent8830ff90cdef42d8c7e76295c51652e1ddca4e25 (diff)
downloaddhcpcd-8c94248fe45c03f0e03f418f5d4bf2dea68cb41f.tar.xz
BSD: Disable kernel RTADV sysctl earlier
Just makes life a bit easier.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index a2c613ed..d2e910ef 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -1620,6 +1620,22 @@ set_ifxflags(int s, const struct interface *ifp)
#endif
void
+if_disable_rtadv(void)
+{
+#if defined(IPV6CTL_ACCEPT_RTADV) && !defined(ND6_IFF_ACCEPT_RTADV)
+ int ra = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
+
+ if (ra == -1) {
+ if (errno != ENOENT)
+ logerr("IPV6CTL_ACCEPT_RTADV");
+ else if (ra != 0)
+ if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1)
+ logerr("IPV6CTL_ACCEPT_RTADV");
+ }
+#endif
+}
+
+void
if_setup_inet6(const struct interface *ifp)
{
struct priv *priv;
@@ -1690,21 +1706,6 @@ if_setup_inet6(const struct interface *ifp)
logerr("%s: set_ifxflags", ifp->name);
#endif
-#if defined(IPV6CTL_ACCEPT_RTADV) && !defined(ND6_IFF_ACCEPT_RTADV)
- /* If we cannot control ra per interface, disable it globally. */
- if (ifp->options->options & DHCPCD_IPV6RS) {
- int ra = get_inet6_sysctl(IPV6CTL_ACCEPT_RTADV);
-
- if (ra == -1) {
- if (errno != ENOENT)
- logerr("IPV6CTL_ACCEPT_RTADV");
- else if (ra != 0)
- if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1)
- logerr("IPV6CTL_ACCEPT_RTADV");
- }
- }
-#endif
-
#if defined(IPV6CTL_ACCEPT_RTADV) || defined(ND6_IFF_ACCEPT_RTADV)
/* Flush the kernel knowledge of advertised routers
* and prefixes so the kernel does not expire prefixes