]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Give the RELEASE packet a chance to leave the kernel
authorRoy Marples <roy@marples.name>
Tue, 24 Nov 2009 01:15:08 +0000 (01:15 +0000)
committerRoy Marples <roy@marples.name>
Tue, 24 Nov 2009 01:15:08 +0000 (01:15 +0000)
before dropping the ip.

dhcpcd.c

index 3e058e9bc7a9b0bbdc4e3d9cf1190accd6b3387e..e69dbfb58ba499fc53908090a63d64c4093d1b5e 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -704,6 +704,8 @@ open_sockets(struct interface *iface)
 static void
 send_release(struct interface *iface)
 {
+       struct timespec ts;
+
        if (iface->state->lease.addr.s_addr &&
            !IN_LINKLOCAL(htonl(iface->state->lease.addr.s_addr)))
        {
@@ -712,6 +714,10 @@ send_release(struct interface *iface)
                open_sockets(iface);
                iface->state->xid = arc4random();
                send_message(iface, DHCP_RELEASE, NULL);
+               /* Give the packet a chance to go before dropping the ip */
+               ts.tv_sec = 1;
+               ts.tv_nsec = 0;
+               nanosleep(&ts, NULL);
                drop_config(iface, "RELEASE");
        }
        unlink(iface->leasefile);