Download raw body.
dhcpleased: patch xid problem
On 2024-02-11 16:22 +01, Florian Obser <florian@openbsd.org> wrote:
> Amazing that anything works at all, ever. As far as I can tell only
> table 5 suggests that we need to keep the xid for the whole DHCPDISCOVER
> / DHCPOFFER / DHCPREQUEST / DHCPACK exchange of messages.
>
> Oh well, Could you try this instead? This only creates a new xid when we
> start a new exchange of messages to get a new lease / renew an existing
> lease.
>
Andre confirmed that this fixes their issue (not sure why it didn't make
it to the list).
OK?
diff --git engine.c engine.c
index 6d371a5a112..0268b247938 100644
--- engine.c
+++ engine.c
@@ -1385,8 +1385,6 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
char ifnamebuf[IF_NAMESIZE], *if_name;
iface->state = new_state;
- if (new_state != old_state)
- iface->xid = arc4random();
switch (new_state) {
case IF_DOWN:
@@ -1426,6 +1424,7 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
case IF_DOWN:
case IF_IPV6_ONLY:
iface->timo.tv_sec = START_EXP_BACKOFF;
+ iface->xid = arc4random();
break;
case IF_BOUND:
fatal("invalid transition Bound -> Init");
@@ -1436,8 +1435,10 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
case IF_REBOOTING:
if (old_state == IF_REBOOTING)
iface->timo.tv_sec *= 2;
- else
+ else {
iface->timo.tv_sec = START_EXP_BACKOFF;
+ iface->xid = arc4random();
+ }
request_dhcp_request(iface);
break;
case IF_REQUESTING:
@@ -1458,6 +1459,7 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
if (old_state == IF_BOUND) {
iface->timo.tv_sec = (iface->rebinding_time -
iface->renewal_time) / 2; /* RFC 2131 4.4.5 */
+ iface->xid = arc4random();
} else
iface->timo.tv_sec /= 2;
--
In my defence, I have been left unsupervised.
dhcpleased: patch xid problem