Hello,

The attached patch is for to fix new IP selection in case of collision.

When the IP that is preferred equals the IP that is selected, the
same IP is requested again. Retry the IP selection in that case until
a different IP is selected. This avoids a scenario where two collisions
happen in a row because the same IP is selected again.
Notice: Due to the seeding of the rng with the mac address, the same
IP is selected again in the next lifecycle.

example sequence:
device collides with another device and gets the first randomly
generated IP. This IP is persisted to be used as the preferred IP (-r).
On a new lifecycle, the device collides again. As the rng is seeded,
the same IP is selected again. Only on a third try a truly new IP is
used.

Kindly check the patch.


Thanks & Regards,
Pawan
​KPIT Technologies,Pune
This message contains information that may be privileged or confidential and is 
the property of the KPIT Technologies Ltd. It is intended only for the person 
to whom it is addressed. If you are not the intended recipient, you are not 
authorized to read, print, retain copy, disseminate, distribute, or use this 
message or any part thereof. If you receive this message in error, please 
notify the sender immediately and delete all copies of this message. KPIT 
Technologies Ltd. does not accept any liability for virus infected mails.
From 5d9867ac714f739c8b9d5239c770656db38c0fd7 Mon Sep 17 00:00:00 2001
From: timschneider <[email protected]>
Date: Mon, 16 Dec 2024 12:33:41 +0100
Subject: [PATCH] zcip: change new ip selection

When the Ip that is preferred equals the Ip that is selected, the
same Ip is requested again. Retry the Ip selection in that case until
a different Ip is selected. This avoids a scenario where two collisions
happen in a row because the same Ip is selected again.
Notice: Due to the seeding of the rng with the mac address, the same
Ip is selected again in the next lifecycle.

example sequence:
device collides with another device and gets the first randomly
generated Ip. This Ip is persisted to be used as the preferred Ip (-r).
On a new lifecycle, the device collides again. As the rng is seeded,
the same Ip is selected again. Only on a third try a truly new Ip is
used.

Upstream-Status: Pending
---
 networking/zcip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/networking/zcip.c b/networking/zcip.c
index 2f120a5db..db0c96cae 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -383,7 +383,10 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
 	// - revents & POLLERR (link down). run "<script> deconfig" first
 	if (chosen_nip == 0) {
  new_nip_and_PROBE:
-		chosen_nip = pick_nip();
+		int new_nip = chosen_nip;
+		while (new_nip == chosen_nip) {
+			chosen_nip = pick_nip();
+		}
 	}
 	nsent = 0;
 	state = PROBE;
-- 
2.34.1

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to