]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Wait 1/100th of a second before release as testing shows the
authorRoy Marples <roy@marples.name>
Thu, 3 Dec 2009 13:30:09 +0000 (13:30 +0000)
committerRoy Marples <roy@marples.name>
Thu, 3 Dec 2009 13:30:09 +0000 (13:30 +0000)
release is sent correctly even in a heavy load.

dhcpcd.c

index e69dbfb58ba499fc53908090a63d64c4093d1b5e..4e095e05c81f656563aca91d246ac59ea59ccf24 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -72,6 +72,11 @@ const char copyright[] = "Copyright (c) 2006-2009 Roy Marples";
 /* We should define a maximum for the NAK exponential backoff */ 
 #define NAKOFF_MAX              60
 
+/* Wait N nanoseconds between sending a RELEASE and dropping the address.
+ * This gives the kernel enough time to actually send it. */
+#define RELEASE_DELAY_S                0
+#define RELEASE_DELAY_NS       10000000
+
 int options = 0;
 int pidfd = -1;
 struct interface *ifaces = NULL;
@@ -715,8 +720,8 @@ send_release(struct interface *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;
+               ts.tv_sec = RELEASE_DELAY_S;
+               ts.tv_nsec = RELEASE_DELAY_NS;
                nanosleep(&ts, NULL);
                drop_config(iface, "RELEASE");
        }