From: Roy Marples Date: Fri, 24 Mar 2017 21:57:25 +0000 (+0000) Subject: Fix compile on OpenBSD. X-Git-Tag: v7.0.0-beta1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f3874cac2ccefb7befbcda98d4f7354911a0c1e;p=thirdparty%2Fdhcpcd.git Fix compile on OpenBSD. --- diff --git a/src/if-bsd.c b/src/if-bsd.c index e3c6b889..15d16e52 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -1270,18 +1270,11 @@ af_attach(int s, const struct interface *ifp, int af) #ifdef SIOCGIFXFLAGS static int -set_ifxflags(int s, const struct interface *ifp, int own) +set_ifxflags(int s, const struct interface *ifp) { struct ifreq ifr; int flags; -#ifndef IFXF_NOINET6 - /* No point in removing the no inet6 flag if it doesn't - * exist and we're not owning inet6. */ - if (! own) - return 0; -#endif - strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFXFLAGS, (void *)&ifr) == -1) return -1; @@ -1289,10 +1282,14 @@ set_ifxflags(int s, const struct interface *ifp, int own) #ifdef IFXF_NOINET6 flags &= ~IFXF_NOINET6; #endif - if (own) + if (!(ifp->ctx->options & DHCPCD_TEST)) flags &= ~IFXF_AUTOCONF6; if (ifr.ifr_flags == flags) return 0; + if (ifp->ctx->options & DHCPCD_TEST) { + errno = EPERM; + return -1; + } ifr.ifr_flags = flags; return ioctl(s, SIOCSIFXFLAGS, (void *)&ifr); } @@ -1381,7 +1378,7 @@ if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp) #endif #ifdef SIOCGIFXFLAGS - if (set_ifxflags(s, ifp, own) == -1) { + if (set_ifxflags(s, ifp) == -1) { syslog(LOG_ERR, "%s: set_ifxflags: %m", ifp->name); return -1; }