From: Roy Marples Date: Sun, 16 Dec 2018 08:56:06 +0000 (+0000) Subject: BSD: SIOCSRTRFLUSH_IN6 and SIOCSPFXFLUSH_IN6 require in6_ifreq X-Git-Tag: v7.1.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dfea515c0d37df361aee97c2a70b7797d23360f;p=thirdparty%2Fdhcpcd.git BSD: SIOCSRTRFLUSH_IN6 and SIOCSPFXFLUSH_IN6 require in6_ifreq and not a character array of the interface name. This only worked previously because the first member of in6_ifreq is the interface name. --- diff --git a/src/if-bsd.c b/src/if-bsd.c index b1d65a88..fbb30bb4 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1507,13 +1507,14 @@ if_setup_inet6(const struct interface *ifp) * and prefixes so the kernel does not expire prefixes * and default routes we are trying to own. */ if (ifp->options->options & DHCPCD_IPV6RS) { - char ifname[IFNAMSIZ + 8]; + struct in6_ifreq ifr; - strlcpy(ifname, ifp->name, sizeof(ifname)); - if (ioctl(s, SIOCSRTRFLUSH_IN6, (void *)&ifname) == -1 && + memset(&ifr, 0, sizeof(ifr)); + strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCSRTRFLUSH_IN6, &ifr) == -1 && errno != ENOTSUP) logwarn("SIOCSRTRFLUSH_IN6"); - if (ioctl(s, SIOCSPFXFLUSH_IN6, (void *)&ifname) == -1 && + if (ioctl(s, SIOCSPFXFLUSH_IN6, &ifr) == -1 && errno != ENOTSUP) logwarn("SIOCSPFXFLUSH_IN6"); }