]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Make the timings more random by using the full range of poll timeout.
authorRoy Marples <roy@marples.name>
Thu, 29 May 2008 19:26:16 +0000 (19:26 +0000)
committerRoy Marples <roy@marples.name>
Thu, 29 May 2008 19:26:16 +0000 (19:26 +0000)
client.c
net.c
net.h

index 79c2453c88abeb235642169da3eb0269adee94f6..db9e7e035b0caf217d3057ba90e034c71f322c60 100644 (file)
--- a/client.c
+++ b/client.c
@@ -58,8 +58,6 @@
  # error "IPv4LL requires ENABLE_ARP to work"
 # endif
 # define IPV4LL_LEASETIME      2
-# define MAX_CONFLICTS         10
-# define DEFEND_INTERVAL       10
 #endif
 
 /* Some platforms don't define INFTIM */
diff --git a/net.c b/net.c
index 13ffdd708b5784b491ab2f9136662dc191173c32..1deed0a103fe03c0370d9a9e4fa21678d57b3fb7 100644 (file)
--- a/net.c
+++ b/net.c
@@ -683,10 +683,8 @@ arp_claim(struct interface *iface, struct in_addr address)
                if (timeout > 0) {
                        /* Obey IPV4LL timings, but make us faster for
                         * routeable addresses */
-                       if (IN_LINKLOCAL(htonl(address.s_addr)))
-                               timeout *= 1000;
-                       else
-                               timeout *= 200;
+                       if (!IN_LINKLOCAL(htonl(address.s_addr)))
+                               timeout /= 6;
                        s = poll(fds, 2, timeout);
                        if (s == -1) {
                                if (errno != EINTR)
diff --git a/net.h b/net.h
index 77e4b6f9a65b26e555f9a7a6688d926f8bb67cc5..b8b6cb6c88ab6105afbf7bae3ac790e7eee14193 100644 (file)
--- a/net.h
+++ b/net.h
@@ -171,14 +171,15 @@ ssize_t send_raw_packet(const struct interface *, int,
 ssize_t get_packet(struct interface *, void *, ssize_t);
 
 #ifdef ENABLE_ARP
-/* These are really for IPV4LL */
-#define PROBE_WAIT             1
-#define PROBE_NUM              3
-#define PROBE_MIN              1
-#define PROBE_MAX              2
-#define ANNOUNCE_WAIT          2
-#define ANNOUNCE_NUM           2
-#define ANNOUNCE_INTERVAL      2
+/* These are really for IPV4LL, RFC 3927.
+ * We multiply some numbers by 1000 so they are suitable for use in poll(). */
+#define PROBE_WAIT              1 * 1000
+#define PROBE_NUM               3
+#define PROBE_MIN               1 * 1000
+#define PROBE_MAX               2 * 1000
+#define ANNOUNCE_WAIT           2 * 1000
+#define ANNOUNCE_NUM            2
+#define ANNOUNCE_INTERVAL       2 * 1000
 #define MAX_CONFLICTS          10
 #define RATE_LIMIT_INTERVAL    60
 #define DEFEND_INTERVAL                10