]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
FreeBSD: avoid kernel panics when adding on-link IPv6 routes
authorRoy Marples <roy@marples.name>
Sat, 26 Jan 2019 02:13:29 +0000 (02:13 +0000)
committerRoy Marples <roy@marples.name>
Sat, 26 Jan 2019 02:13:29 +0000 (02:13 +0000)
Also warn that OS does not support IPv6 address sharing.

src/if-bsd.c

index 5ec60eb5c1312526f56b1a3f71a509e3c998822e..0f4cc00815a2d880e539fc6fd68bf7e23f9e3f06 100644 (file)
@@ -501,7 +501,17 @@ if_route(unsigned char cmd, const struct rt *rt)
                    !sa_is_loopback(&rt->rt_gateway))
                {
                        rtm->rtm_index = (unsigned short)rt->rt_ifp->index;
-#ifdef __OpenBSD__
+/*
+ * OpenBSD rejects the message for on-link routes.
+ * FreeBSD-12 kernel apparently panics.
+ * I can't replicate the panic, but better safe than sorry!
+ * https://roy.marples.name/archives/dhcpcd-discuss/0002286.html
+ *
+ * Neither OS currently allows IPv6 address sharing anyway, so let's
+ * try to encourage someone to fix that by logging a waring during compile.
+ */
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#warning OS does not allow IPv6 address sharing
                        if (!gateway_unspec || rt->rt_dest.sa_family!=AF_INET6)
 #endif
                        rtm->rtm_addrs |= RTA_IFP;