]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Change define KERNEL_MANAGETEMPADD to IPV6_MANAGETEMPADDR.
authorRoy Marples <roy@marples.name>
Mon, 19 Jan 2015 13:24:39 +0000 (13:24 +0000)
committerRoy Marples <roy@marples.name>
Mon, 19 Jan 2015 13:24:39 +0000 (13:24 +0000)
Use this to block out actual address additions so we don't get bogus errors
about not being able to create temporary addresses.

ipv6.c
ipv6.h
ipv6nd.c

diff --git a/ipv6.c b/ipv6.c
index c4a06f7f0c41bf89c11552c223367175637e1f22..f33079363dfbceb4af797f6bed997c2136558a97 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
 #endif
 
 
-#ifdef KERNEL_MANAGETEMPADDR
-#define ipv6_regentempifid(a) {}
-#else
+#ifdef IPV6_MANAGETEMPADDR
 static void ipv6_regentempifid(void *);
 static void ipv6_regentempaddr(void *);
+#else
+#define ipv6_regentempifid(a) {}
 #endif
 
 struct ipv6_ctx *
@@ -705,7 +705,7 @@ ipv6_addaddr(struct ipv6_addr *ap, const struct timeval *now)
                return -1;
        }
 
-#ifndef KERNEL_MANAGETEMPADDR
+#ifdef IPV6_MANAGETEMPADDR
        /* RFC4941 Section 3.4 */
        if (ap->flags & IPV6_AF_TEMPORARY &&
            ap->prefix_pltime &&
@@ -1323,7 +1323,7 @@ ipv6_handleifa_addrs(int cmd,
        return alldadcompleted ? found : 0;
 }
 
-#ifndef KERNEL_MANAGETEMPADDR
+#ifdef IPV6_MANAGETEMPADDR
 static const struct ipv6_addr *
 ipv6_findaddrid(struct dhcpcd_ctx *ctx, uint8_t *addr)
 {
@@ -1676,7 +1676,7 @@ ipv6_regentempifid(void *arg)
 
        ipv6_regen_desync(ifp, 1);
 }
-#endif /* !KERNEL_MANAGETEMPADDR */
+#endif /* IPV6_MANAGETEMPADDR */
 
 static struct rt6 *
 find_route6(struct rt6_head *rts, const struct rt6 *r)
diff --git a/ipv6.h b/ipv6.h
index 7ecc9fcbfb2e4c49cd6079c2539db51291c95abc..26f00a4d8582e9c3bd9ec1e0b8d65fcd56e05dc5 100644 (file)
--- a/ipv6.h
+++ b/ipv6.h
@@ -87,9 +87,9 @@
 
 /* Linux-3.18 can manage temporary addresses even with RA
  * processing disabled. */
-//#undef IFA_F_MANAGETEMPADDR
-#ifdef IFA_F_MANAGETEMPADDR
-#define KERNEL_MANAGETEMPADDR
+#undef IFA_F_MANAGETEMPADDR
+#ifndef IFA_F_MANAGETEMPADDR
+#define IPV6_MANAGETEMPADDR
 #endif
 
 struct ipv6_addr {
@@ -155,10 +155,12 @@ struct ipv6_state {
        struct ipv6_addrhead addrs;
        struct ll_callback_head ll_callbacks;
 
+#ifdef IPV6_MANAGETEMPADDR
        time_t desync_factor;
        uint8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
        uint8_t randomseed1[8]; /* lower 64 bits */
        uint8_t randomid[8];
+#endif
 };
 
 #define IPV6_STATE(ifp)                                                               \
@@ -235,19 +237,16 @@ struct ipv6_addr *ipv6_findaddr(struct dhcpcd_ctx *,
 int ipv6_addlinklocalcallback(struct interface *, void (*)(void *), void *);
 void ipv6_drop(struct interface *);
 
-#ifdef KERNEL_MANAGETEMPADDR
-#define ipv6_gentempifid(a) {}
-#define ipv6_settempstale(a) {}
-#define ipv6_createtempaddr(a, b) (NULL)
-#define ipv6_settemptime(a, b) (NULL)
-#define ipv6_addtempaddrs(a, b) {}
-#else
+#ifdef IPV6_MANAGETEMPADDR
 void ipv6_gentempifid(struct interface *);
 void ipv6_settempstale(struct interface *);
 struct ipv6_addr *ipv6_createtempaddr(struct ipv6_addr *,
     const struct timeval *);
 struct ipv6_addr *ipv6_settemptime(struct ipv6_addr *, int);
 void ipv6_addtempaddrs(struct interface *, const struct timeval *);
+#else
+#define ipv6_gentempifid(a) {}
+#define ipv6_settempstale(a) {}
 #endif
 
 int ipv6_start(struct interface *);
index ed9bb2cc639debeebeae26333f8eadf1905cb9dd..d296dda48897cf10883d2e4dbe333e42a3216515 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -691,7 +691,10 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
        struct ipv6_addr *ap;
        char *opt, *opt2, *tmp;
        struct timeval expire;
-       uint8_t new_rap, new_data, new_ap;
+       uint8_t new_rap, new_data;
+#ifdef IPV6_MANAGETEMPADDR
+       uint8_t new_ap;
+#endif
 
        if (len < sizeof(struct nd_router_advert)) {
                syslog(LOG_ERR, "IPv6 RA packet too short from %s", ctx->sfrom);
@@ -898,6 +901,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                ap->created = ap->acquired = rap->received;
                                TAILQ_INSERT_TAIL(&rap->addrs, ap, next);
 
+#ifdef IPV6_MANAGETEMPADDR
                                /* New address to dhcpcd RA handling.
                                 * If the address already exists and a valid
                                 * temporary address also exists then
@@ -908,8 +912,11 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                        new_ap = 0;
                                else
                                        new_ap = 1;
+#endif
                        } else {
+#ifdef IPV6_MANAGETEMPADDR
                                new_ap = 0;
+#endif
                                ap->flags &= ~IPV6_AF_STALE;
                                ap->acquired = rap->received;
                        }
@@ -932,6 +939,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                }
                        }
 
+#ifdef IPV6_MANAGETEMPADDR
                        /* RFC4941 Section 3.3.3 */
                        if (ap->flags & IPV6_AF_AUTOCONF &&
                            ap->iface->options->options & DHCPCD_IPV6RA_OWN &&
@@ -948,6 +956,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                                                    "ipv6_createtempaddr: %m");
                                }
                        }
+#endif
 
                        lifetime = ap->prefix_vltime;
                        break;
@@ -1100,7 +1109,9 @@ extra_opt:
                goto handle_flag;
        }
        ipv6_addaddrs(&rap->addrs);
+#ifdef IPV6_MANAGETEMPADDR
        ipv6_addtempaddrs(ifp, &rap->received);
+#endif
        ipv6_buildroutes(ifp->ctx);
        if (ipv6nd_scriptrun(rap))
                return;