package: busybox
version: 1.36.1

Busybox DHCP client is RFC-3442 (option 121) compliant according to the 
documentations. However, it's stated under section "DHCP Client Behavior" that

"
 DHCP clients that support this option and send a parameter request
   list MAY also request the Static Routes option, for compatibility
   with older servers that don't support Classless Static Routes.  The
   Classless Static Routes option code MUST appear in the parameter
   request list prior to both the Router option code and the Static
   Routes option code, if present.
"This requirement is currently not fulfilled. Instead, the "add_client_options" 
function pulls the options from the struct in common.c, in the same order as 
they are defined. Placing option 121 further down. The patch attached to this 
email solves this issue by modifying the placement of the option while 
generating the request section in the "add_client_options" function. As this 
ordering requirement is only true when option 121 is selected, I choose to not 
modify the order in the struct. Aside from the risk of breaking other 
functionality.
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index c757fb37c..9bc0039bf 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 and 33 in parameter
+	 * request list in accordance with RFC-3442 */
 	for (i = 1; i < DHCP_END; i++) {
+		if (i == 121) {
+			/* Skipping 121 as it's placed before option 3 (when i == 3) */
+			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++;
 		}
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to