]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Make ipv6_newaddr static
authorRoy Marples <roy@marples.name>
Sun, 14 Feb 2016 09:05:46 +0000 (09:05 +0000)
committerRoy Marples <roy@marples.name>
Sun, 14 Feb 2016 09:05:46 +0000 (09:05 +0000)
ipv6.c
ipv6.h

diff --git a/ipv6.c b/ipv6.c
index 09c25525139fa0620435f4dc9ff06e6978064572..492f4b2e7ec998675aafc54408f328ceedebaf7f 100644 (file)
--- 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 a02f102abc9e560efa5d038efc4449b576e100e8..6b9030bebfd2caaaa9b85d0c31c404a4939be05e 100644 (file)
--- 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 *);