From: Roy Marples Date: Sat, 26 Jan 2019 02:13:29 +0000 (+0000) Subject: FreeBSD: avoid kernel panics when adding on-link IPv6 routes X-Git-Tag: v7.1.1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5d6851a11522fa5f3f17cf6ecf9e3e5bf4bd625;p=thirdparty%2Fdhcpcd.git FreeBSD: avoid kernel panics when adding on-link IPv6 routes Also warn that OS does not support IPv6 address sharing. --- 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;