]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile on OpenBSD.
authorRoy Marples <roy@marples.name>
Fri, 16 Sep 2016 16:03:00 +0000 (16:03 +0000)
committerRoy Marples <roy@marples.name>
Fri, 16 Sep 2016 16:03:00 +0000 (16:03 +0000)
if-bsd.c
ipv6.c

index d197db53d064c7cdd79b87c757f36557128b617e..c1344a073a669dbd65bd29e401ee65f6cf77b2f3 100644 (file)
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -737,7 +737,7 @@ if_route(unsigned char cmd, const struct rt *rt)
 #endif
 
        addrs = 0;
-       flags = 0;
+       flags = (int)rt->flags;
 
        if (cmd == RTM_ADD || cmd == RTM_CHANGE) {
                addrs |= RTA_GATEWAY | RTA_IFP;
@@ -1490,7 +1490,7 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
                {
                        if (ifam->ifam_type != RTM_DELADDR || errno != EEXIST)
                                logger(ctx, LOG_ERR,
-                                   "%s: if_addrflags1: %s: %m",
+                                   "%s: if_addrflags: %s: %m",
                                    ifp->name, inet_ntoa(addr));
                        addrflags = 0;
                }
@@ -1520,8 +1520,8 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
                {
                        if (ifam->ifam_type != RTM_DELADDR || errno != EEXIST)
                                logger(ctx, LOG_ERR,
-                                   "%s: if_addrflags1: %s: %m",
-                                   ifp->name, inet_ntoa(addr));
+                                   "%s: if_addrflags: %m",
+                                   ifp->name);
                        addrflags = 0;
                }
 #endif
diff --git a/ipv6.c b/ipv6.c
index a49cffd05498f677c34ee5adaee70264a6bc8e69..9cdc2e91e5fad2afb21d882e8200da4f4c65e3a9 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -567,20 +567,25 @@ ipv6_checkaddrflags(void *arg)
 {
        struct ipv6_addr *ia;
        int flags;
+       const char *alias;
 
        ia = arg;
-       if ((flags = if_addrflags6(ia)) == -1) {
+#ifdef ALIAS_ADDR
+       alias = ia->alias;
+#else
+       alias = NULL;
+#endif
+       if ((flags = if_addrflags6(ia->iface, &ia->addr, alias)) == -1) {
                logger(ia->iface->ctx, LOG_ERR,
                    "%s: if_addrflags6: %m", ia->iface->name);
                return;
        }
 
-       ia->addr_flags = flags;
        if (!(ia->addr_flags & IN6_IFF_TENTATIVE)) {
                /* Simulate the kernel announcing the new address. */
                ipv6_handleifa(ia->iface->ctx, RTM_NEWADDR,
                    ia->iface->ctx->ifaces, ia->iface->name,
-                   &ia->addr, ia->prefix_len);
+                   &ia->addr, ia->prefix_len, flags);
        } else {
                /* Still tentative? Check again in a bit. */
                struct timespec tv;
@@ -1608,10 +1613,17 @@ ipv6_start(struct interface *ifp)
        /* We need to update the address flags. */
        if ((state = IPV6_STATE(ifp)) != NULL) {
                struct ipv6_addr *ia;
+               const char *alias;
                int flags;
 
                TAILQ_FOREACH(ia, &state->addrs, next) {
-                       if ((flags = if_addrflags6(ia)) != -1)
+#ifdef ALIAS_ADDR
+                       alias = ia->alias;
+#else
+                       alias = NULL;
+#endif
+                       flags = if_addrflags6(ia->iface, &ia->addr, alias);
+                       if (flags != -1)
                                ia->addr_flags = flags;
                }
        }