]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Send and release if we have an address to send to.
authorRoy Marples <roy@marples.name>
Fri, 29 May 2015 20:05:04 +0000 (20:05 +0000)
committerRoy Marples <roy@marples.name>
Fri, 29 May 2015 20:05:04 +0000 (20:05 +0000)
dhcp.c

diff --git a/dhcp.c b/dhcp.c
index 5eb7f466e86cc9a44eb8b4f687996f4e1e9d5ef3..1bd14775881aba1d4f0312c8d3ccdf7b33976ba2 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -1644,7 +1644,7 @@ send_message(struct interface *ifp, uint8_t type,
            ((ia = ipv4_iffindaddr(ifp, &state->addr, NULL)) &&
            !(ia->addr_flags & IN_IFF_NOTUSEABLE)) &&
 #endif
-           (state->new->cookie == htonl(MAGIC_COOKIE) ||
+           (state->lease.server.s_addr ||
            ifp->options->options & DHCPCD_INFORM))
        {
                s = dhcp_openudp(ifp);
@@ -2344,7 +2344,7 @@ dhcp_drop(struct interface *ifp, const char *reason)
                unlink(state->leasefile);
                if (ifp->carrier != LINK_DOWN &&
                    state->new != NULL &&
-                   state->new->cookie == htonl(MAGIC_COOKIE))
+                   state->lease.server.s_addr != INADDR_ANY)
                {
                        logger(ifp->ctx, LOG_INFO, "%s: releasing lease of %s",
                            ifp->name, inet_ntoa(state->lease.addr));