diff options
| author | Roy Marples <roy@marples.name> | 2018-12-16 08:56:06 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2018-12-16 08:56:06 +0000 |
| commit | 33689570d1be1defa91431639b4de7f06f75145a (patch) | |
| tree | 33b9f32890532aa728c5b86d406de718ab62a716 /src/if-bsd.c | |
| parent | c3537b8de61cf6002718a4b8cb4a588a0256b07d (diff) | |
| download | dhcpcd-33689570d1be1defa91431639b4de7f06f75145a.tar.xz | |
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.
Diffstat (limited to 'src/if-bsd.c')
| -rw-r--r-- | src/if-bsd.c | 9 |
1 files changed, 5 insertions, 4 deletions
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"); } |
