[PATCH] dhcp: Decrease re-try delay after initial discovery message
by Tim Kourt
Some of the routers require ‘setup’ time between the moment when
connection is established and before they are ready to respond to
the DHCP discovery messages. This used to cause the DHCP clients
to wait a full delay of +-4 seconds for the next attempt to
rediscover DHCP servers. To address this issue, the time delay
between the initial discovery message and its retransmission is
shorten to milliseconds to give enough time to the routers to get
ready and minimize the delay for the clients.
---
ell/dhcp.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/ell/dhcp.c b/ell/dhcp.c
index 57d5ae2..ca81311 100644
--- a/ell/dhcp.c
+++ b/ell/dhcp.c
@@ -485,6 +485,23 @@ static uint64_t dhcp_fuzz_secs(uint32_t secs)
return ms;
}
+/*
+ * Takes a time in milliseconds and produces a fuzzed value that can be directly
+ * used by l_timeout_modify_ms. The fluctuation of the random noise added is
+ * from -63 to 63 milliseconds.
+ */
+static uint64_t dhcp_fuzz_msecs(uint64_t ms)
+{
+ uint32_t r = l_getrandom_uint32();
+
+ if (r & 0x80000000)
+ ms += r & 0x3f;
+ else
+ ms -= r & 0x3f;
+
+ return ms;
+}
+
static uint32_t dhcp_rebind_renew_retry_time(uint64_t start_t, uint32_t expiry)
{
uint64_t now = l_time_now();
@@ -1191,7 +1208,7 @@ LIB_EXPORT bool l_dhcp_client_start(struct l_dhcp_client *client)
if (err < 0)
return false;
- client->timeout_resend = l_timeout_create_ms(dhcp_fuzz_secs(4),
+ client->timeout_resend = l_timeout_create_ms(dhcp_fuzz_msecs(600),
dhcp_client_timeout_resend,
client, NULL);
CLIENT_ENTER_STATE(DHCP_STATE_SELECTING);
--
2.13.6
1 year, 5 months
[PATCH] util: Fix increased alignment error in l_container_of
by Michał Lowas-Rzechonek
From: Michał 'Khorne' Lowas-Rzechonek <michal(a)rzechonek.net>
This fixes build failures when building with -Wcast-align -Werror on
some platforms (most notably: 32bit ARM).
---
ell/util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/util.h b/ell/util.h
index 4f20ef0..fe7c7e2 100644
--- a/ell/util.h
+++ b/ell/util.h
@@ -37,7 +37,7 @@ extern "C" {
#define l_container_of(ptr, type, member) ({ \
const __typeof__(((type *) 0)->member) *__mptr = (ptr); \
- (type *)((char *) __mptr - offsetof(type, member)); \
+ (type *)(void *)((char *) __mptr - offsetof(type, member)); \
})
#define likely(x) __builtin_expect(!!(x), 1)
--
2.22.0
1 year, 6 months
[PATCH] genl: Correct bad l_genl_family_info free.
by Ossama Othman
---
ell/genl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/genl.c b/ell/genl.c
index ea9d182..01e58dd 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -1181,7 +1181,7 @@ static void dump_family_callback(struct l_genl_msg *msg, void *user_data)
discovery->cmd_id = 0;
if (parse_cmd_newfamily(info, msg) < 0) {
- family_info_free(&info);
+ family_info_free(info);
return;
}
--
2.20.1
1 year, 6 months
[PATCH] genl: Deallocate genl family name
by Ossama Othman
---
ell/genl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ell/genl.c b/ell/genl.c
index ea9d182..0f65db2 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -496,6 +496,7 @@ static void family_watch_free(void *data)
if (watch->destroy)
watch->destroy(watch->user_data);
+ l_free(watch->name);
l_free(watch);
}
--
2.20.1
1 year, 6 months