Hi maintainer,

I’m submitting a patch for dhcpc that ensures compliance with RFC-3442.

This patch addresses the following.



The option 121(classless static route) in the DCHP request option has higher 
priority

over the option3(router) and the option 33(classful static routes).

This attached patch places the option121 before the option3 in the request list

according to RFC-3442.



Can I get your opinion for this?


BR-Matthew Chae
From 53bf2c068f66e416fc15ebcf1ca121a597bddeff Mon Sep 17 00:00:00 2001
From: Matthew Chae <matth...@axis.com>
Date: Wed, 10 Apr 2024 12:15:55 +0200
Subject: [PATCH] dhcpc: place option121 in DHCP request list based on RFC-3442

The option121(classless static route) in the DCHP request option has
higher priority over the option3(router) and the option33(classful
static routes). This places the option121 before the option3 in the
request list according to RFC-3442.

Change-Id: I57b87af9a9c8d3c36da209d1d54196082379d596
Reviewed-by: Christopher Wong <christopher.w...@axis.com>
Signed-off-by: Mustafa Albayati <mustafa.albay...@axis.com>
Co-developed-by: Matthew Chae <matth...@axis.com>
Signed-off-by: Matthew Chae <matth...@axis.com>
---
 networking/udhcp/dhcpc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 07e2eadfe..23d13a697 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -627,8 +627,20 @@ static void add_client_options(struct dhcp_packet *packet)
 	 * No bounds checking because it goes towards the head of the packet. */
 	end = udhcp_end_option(packet->options);
 	len = 0;
+
+	/* If option 121 requested, place it before option 3 in parameter request
+	 * list in accordance with RFC-3442 */
 	for (i = 1; i < DHCP_END; i++) {
+		if (i == 121)
+			continue;
+
 		if (client_data.opt_mask[i >> 3] & (1 << (i & 7))) {
+			if (i == 3) {
+				if (client_data.opt_mask[121 >> 3] & (1 << (121 & 7))) {
+					packet->options[end + OPT_DATA + len] = 121;
+					len++;
+				}
+			}
 			packet->options[end + OPT_DATA + len] = i;
 			len++;
 		}
-- 
2.30.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to