From: Roy Marples Date: Sun, 14 Feb 2016 09:05:46 +0000 (+0000) Subject: Make ipv6_newaddr static X-Git-Tag: v6.10.2~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a20f950d2ddc619f94bfd59d32076a2280677fe5;p=thirdparty%2Fdhcpcd.git Make ipv6_newaddr static --- diff --git a/ipv6.c b/ipv6.c index 09c25525..492f4b2e 100644 --- a/ipv6.c +++ b/ipv6.c @@ -1299,13 +1299,12 @@ ipv6_tryaddlinklocal(struct interface *ifp) return ipv6_addlinklocal(ifp); } -struct ipv6_addr * +static struct ipv6_addr * ipv6_newaddr(struct interface *ifp, struct in6_addr *addr, uint8_t prefix_len) { struct ipv6_addr *ia; char buf[INET6_ADDRSTRLEN]; const char *cbp; - struct ipv6_state *state; if ((ia = calloc(1, sizeof(*ia))) == NULL) return NULL; @@ -1324,9 +1323,6 @@ ipv6_newaddr(struct interface *ifp, struct in6_addr *addr, uint8_t prefix_len) cbp, ia->prefix_len); else ia->saddr[0] = '\0'; - - state = IPV6_STATE(ifp); - TAILQ_INSERT_TAIL(&state->addrs, ia, next); return ia; } @@ -1404,10 +1400,14 @@ ipv6_startstatic(struct interface *ifp) ia = NULL; } if (ia == NULL) { + struct ipv6_state *state; + ia = ipv6_newaddr(ifp, &ifp->options->req_addr6, ifp->options->req_prefix_len); if (ia == NULL) return -1; + state = IPV6_STATE(ifp); + TAILQ_INSERT_TAIL(&state->addrs, ia, next); run_script = 0; } else run_script = 1; diff --git a/ipv6.h b/ipv6.h index a02f102a..6b9030be 100644 --- a/ipv6.h +++ b/ipv6.h @@ -281,7 +281,6 @@ void ipv6_handleifa(struct dhcpcd_ctx *ctx, int, struct if_head *, int ipv6_handleifa_addrs(int, struct ipv6_addrhead *, const struct in6_addr *, int); int ipv6_publicaddr(const struct ipv6_addr *); -struct ipv6_addr *ipv6_newaddr(struct interface *, struct in6_addr *, uint8_t); struct ipv6_addr *ipv6_iffindaddr(struct interface *, const struct in6_addr *, int); int ipv6_hasaddr(const struct interface *);