summaryrefslogtreecommitdiffstats
path: root/src/if-bsd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-01-26 02:13:29 +0000
committerRoy Marples <roy@marples.name>2019-01-26 02:13:29 +0000
commit47c4c88b802379aa15675bb6cbb32e36a4386b09 (patch)
tree6365f34d1a6265cbc9809d51594d2ca8d857a3b5 /src/if-bsd.c
parent734230f69b8f664883a684b6e2dfcc0823adfb1a (diff)
downloaddhcpcd-47c4c88b802379aa15675bb6cbb32e36a4386b09.tar.xz
FreeBSD: avoid kernel panics when adding on-link IPv6 routes
Also warn that OS does not support IPv6 address sharing.
Diffstat (limited to 'src/if-bsd.c')
-rw-r--r--src/if-bsd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/if-bsd.c b/src/if-bsd.c
index 5ec60eb5..0f4cc008 100644
--- a/src/if-bsd.c
+++ b/src/if-bsd.c
@@ -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;