[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] Include option 61 (Client Identifier) in the DHCPRELEASE
From:       Richard van Paasen <rvpaasen () t3i ! nl>
Date:       2021-05-20 14:26:44
Message-ID: 74001a347a20ae8cad9c01b77d92b996 () t3i ! nl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi, 

I included a patch for the udhcpc applet. RFC 2131 section 3.1.6 clearly
states: "If the client used a 'client identifier' when it obtained the
lease, it MUST use the same 'client identifier' in the DHCPRELEASE
message." Currently the udhcpc applet does not do that for client
identifiers provided using option -x 61:<hex string>. This patch fixes
that.

Met vriendelijke groet / Kind regards,

 Richard van Paasen
[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" \
/></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'> \
<p>Hi,</p> <p>I included a patch for the udhcpc applet. RFC 2131 section 3.1.6 \
clearly states: "If the client used a 'client identifier' when it obtained the lease, \
it MUST use the same 'client identifier' in the DHCPRELEASE message." Currently the \
udhcpc applet does not do that for client identifiers provided using option -x \
61:&lt;hex string&gt;. This patch fixes that.</p> <div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span \
style="font-family: verdana, geneva, sans-serif; font-size: 10pt;">Met vriendelijke \
groet / Kind regards,</span><br /> <br /><span style="font-family: verdana, geneva, \
sans-serif; font-size: 10pt;"> Richard van Paasen</span></div> </div>
</body></html>


["udhcp_clientid_in_dhcprelease.patch" (text/x-diff)]

From fa6def4efe2d442d1f85a336d852c507d8723e0d Mon Sep 17 00:00:00 2001
From: Richard van Paasen <rvpaasen@t3i.nl>
Date: Thu, 20 May 2021 14:42:56 +0200
Subject: [PATCH] Include option 61 (Client Identifier) in the DHCPRELEASE
 message according RFC2131

---
 networking/udhcp/dhcpc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 6666cbce6..2db88252d 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -876,6 +876,20 @@ int send_release(uint32_t server, uint32_t ciaddr)
 
 	udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
 
+	{	// RFC 2131 section 3.1.6 states:
+		// If the client used a 'client identifier' when it obtained the lease,
+		// it MUST use the same 'client identifier' in the DHCPRELEASE message.
+		struct option_set *curr = client_data.options;
+		while (curr) {
+			uint8_t code = curr->data[OPT_CODE];
+			if (code == 0x3d) {
+				udhcp_add_binary_option(&packet, curr->data);
+				break;
+			}
+			curr = curr->next;
+		}
+	}
+
 	bb_info_msg("sending %s", "release");
 	/* Note: normally we unicast here since "server" is not zero.
 	 * However, there _are_ people who run "address-less" DHCP servers,
-- 
2.14.1



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic