]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Check the interface has an IPv4 state before enumarting addresses.
authorRoy Marples <roy@marples.name>
Tue, 16 Jun 2015 09:34:23 +0000 (09:34 +0000)
committerRoy Marples <roy@marples.name>
Tue, 16 Jun 2015 09:34:23 +0000 (09:34 +0000)
ipv4ll.c

index 48c18b8ed07c6b65c4d5c97ab35c14e2f0e28bfb..fee857f6cef63f4142781abf5ba0d37fe20990e2 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -344,7 +344,6 @@ ipv4ll_freedrop(struct interface *ifp, int drop)
         * because we piggy back on the state of DHCP. */
        if (drop && (ifp->options->options & DHCPCD_NODROP) != DHCPCD_NODROP) {
                struct ipv4_state *istate;
-               struct ipv4_addr *ia, *ian;
 
                if (state && state->addr.s_addr != INADDR_ANY) {
                        ipv4_deladdr(ifp, &state->addr, &inaddr_llmask);
@@ -352,10 +351,13 @@ ipv4ll_freedrop(struct interface *ifp, int drop)
                }
 
                /* Free any other link local addresses that might exist. */
-               istate = IPV4_STATE(ifp);
-               TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) {
-                       if (IN_LINKLOCAL(ntohl(ia->addr.s_addr)))
-                               ipv4_deladdr(ifp, &ia->addr, &ia->net);
+               if ((istate = IPV4_STATE(ifp)) != NULL) {
+                       struct ipv4_addr *ia, *ian;
+
+                       TAILQ_FOREACH_SAFE(ia, &istate->addrs, next, ian) {
+                               if (IN_LINKLOCAL(ntohl(ia->addr.s_addr)))
+                                       ipv4_deladdr(ifp, &ia->addr, &ia->net);
+                       }
                }
        }