]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Send the IPv4LL interface to listeners.
authorRoy Marples <roy@marples.name>
Mon, 29 Jun 2015 15:31:33 +0000 (15:31 +0000)
committerRoy Marples <roy@marples.name>
Mon, 29 Jun 2015 15:31:33 +0000 (15:31 +0000)
Send the expired IP in the old_ prefix.

dhcpcd.c
ipv4ll.c
ipv4ll.h
script.c

index 305eb2d8a0b4b4a32723d169d835a5bfd3569ad3..a692465fe13ce8cb76f7ea55a4c77b959eca6e8a 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1238,6 +1238,8 @@ dhcpcd_getinterfaces(void *arg)
                len++;
                if (D_STATE_RUNNING(ifp))
                        len++;
+               if (IPV4LL_STATE_RUNNING(ifp))
+                       len++;
                if (RS_STATE_RUNNING(ifp))
                        len++;
                if (D6_STATE_RUNNING(ifp))
index 6a8af8115b9fb2e83a89ab1b3a8c38b615e647d4..87e598bf65676d3cd4c3097b8b97a1c501d51947 100644 (file)
--- a/ipv4ll.c
+++ b/ipv4ll.c
@@ -229,8 +229,9 @@ ipv4ll_conflicted(struct arp_state *astate, const struct arp_msg *amsg)
                            ifp->name, DEFEND_INTERVAL,
                            inet_ntoa(state->addr));
                        ipv4_deladdr(ifp, &state->addr, &inaddr_llmask, 1);
-                       state->addr.s_addr = INADDR_ANY;
+                       state->down = 1;
                        script_runreason(ifp, "IPV4LL");
+                       state->addr.s_addr = INADDR_ANY;
                } else {
                        logger(ifp->ctx, LOG_DEBUG,
                            "%s: defended IPv4LL address %s",
index eeebb958ab7ce62ebb43049d02ca6d511a7afd68..32390216a00e8895274abad07a63162a91c22508 100644 (file)
--- a/ipv4ll.h
+++ b/ipv4ll.h
@@ -44,6 +44,7 @@ struct ipv4ll_state {
        unsigned int conflicts;
        struct timespec defend;
        char randomstate[128];
+       uint8_t down;
 };
 
 #define IPV4LL_STATE(ifp)                                                     \
@@ -51,7 +52,7 @@ struct ipv4ll_state {
 #define IPV4LL_CSTATE(ifp)                                                    \
        ((const struct ipv4ll_state *)(ifp)->if_data[IF_DATA_IPV4LL])
 #define IPV4LL_STATE_RUNNING(ifp)                                             \
-       (IPV4LL_CSTATE((ifp)) &&                                               \
+       (IPV4LL_CSTATE((ifp)) && !IPV4LL_CSTATE((ifp))->down &&        \
        IN_LINKLOCAL(ntohl(IPV4LL_CSTATE((ifp))->addr.s_addr)))
 
 struct rt* ipv4ll_subnet_route(const struct interface *);
index 9033e57509b29280c266e0cc770167f08abf5303..be1e3ad317e050d1e9d6ca7caa710755f0b42243 100644 (file)
--- a/script.c
+++ b/script.c
@@ -235,6 +235,7 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
 #ifdef INET
        int dhcp, ipv4ll;
        const struct dhcp_state *state;
+       const struct ipv4ll_state *istate;
 #endif
 #ifdef INET6
        const struct dhcp6_state *d6_state;
@@ -244,6 +245,7 @@ make_env(const struct interface *ifp, const char *reason, char ***argv)
 #ifdef INET
        dhcp = ipv4ll = 0;
        state = D_STATE(ifp);
+       istate = IPV4LL_CSTATE(ifp);
 #endif
 #ifdef INET6
        dhcp6 = ra = 0;
@@ -463,7 +465,8 @@ dumplease:
                        if (nenv == NULL)
                                goto eexit;
                        env = nenv;
-                       if ((n = ipv4ll_env(env + elen, "new", ifp)) == -1)
+                       if ((n = ipv4ll_env(env + elen,
+                           istate->down ? "old" : "new", ifp)) == -1)
                                goto eexit;
                        elen += (size_t)n;
                }
@@ -609,6 +612,10 @@ send_interface(struct fd_list *fd, const struct interface *ifp)
                if (send_interface1(fd, ifp, d->reason) == -1)
                        retval = -1;
        }
+       if (IPV4LL_STATE_RUNNING(ifp)) {
+               if (send_interface1(fd, ifp, "IPV4LL") == -1)
+                       retval = -1;
+       }
 #endif
 
 #ifdef INET6