Skip to content

Commit

Permalink
wicked: fix occasional hang during DHCPv6 solicitation
Browse files Browse the repository at this point in the history
This fixes an occasional hang during DHCPv6 solicitation when the
randomized initial soliciation delay happened to be exactly 0 ms.

The patch can be upstreamed.

Signed-off-by: Markus Boehme <[email protected]>
  • Loading branch information
markusboehme committed Jun 2, 2023
1 parent 3c822fb commit 53fe4ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 1a913cf6bae1e170229c1ddb49d0c2a099eb8789 Mon Sep 17 00:00:00 2001
From: Markus Boehme <[email protected]>
Date: Fri, 26 May 2023 13:27:28 +0200
Subject: [PATCH] dhpc6: don't cancel transmission if random delay happens to
be 0 ms

If the randomized transmission delay in ni_dhcp6_device_transmit_arm_delay
happens to be 0 ms including jitter then ni_dhcp6_fsm_set_timeout_msec will
interpret that as the request to cancel the timer and no message will be
sent. In the case of a Solicitation message, no lease will ever be
acquired. Fix this by signaling the intent to transmit immediately to the
caller if the delay happens to be 0 ms.

Reported-by: Zac Mrowicki <[email protected]>
Signed-off-by: Markus Boehme <[email protected]>
---
src/dhcp6/device.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/dhcp6/device.c b/src/dhcp6/device.c
index f36b16c..e5ee99e 100644
--- a/src/dhcp6/device.c
+++ b/src/dhcp6/device.c
@@ -790,6 +790,8 @@ ni_dhcp6_device_transmit_arm_delay(ni_dhcp6_device_t *dev)
jitter.min = 0;
jitter.max = dev->retrans.delay;
delay = ni_timeout_randomize(0, &jitter);
+ if (delay == 0)
+ return FALSE;

ni_debug_dhcp("%s: setting initial transmit delay of 0 .. %u.%03us",
dev->ifname, NI_TIMEOUT_SEC(delay), NI_TIMEOUT_MSEC(delay));
--
2.40.1

1 change: 1 addition & 0 deletions packages/wicked/wicked.spec
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Patch1003: 1003-ship-mkconst-and-schema-sources-for-runtime-use.patch
Patch1004: 1004-adjust-safeguard-for-dhcp6-defer-timeout.patch
Patch1005: 1005-client-validate-ethernet-namespace-node.patch
Patch1006: 1006-server-discover-hardware-address-of-unconfigured-int.patch
Patch1007: 1007-dhpc6-don-t-cancel-transmission-if-random-delay-happ.patch

BuildRequires: %{_cross_os}glibc-devel
BuildRequires: %{_cross_os}libdbus-devel
Expand Down

0 comments on commit 53fe4ae

Please sign in to comment.