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

List:       busybox
Subject:    [PATCH]networking: Allow dot at the end of the domain name in dhcp response
From:       Balaji Punnuru <balaji.punnuru () gmail ! com>
Date:       2016-02-03 20:40:15
Message-ID: CAM4Bj6uBMzD7bZtxTrzc2MGOPFD2Mn-caK9c0oVKzkD8bRQLQQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


When a dhcp server responds with a domain name that ends with a ".",
domain name validation is failing which leads to populating domain bad in
resolv.conf

Domain name ending with . is a valid syntax according RFC-1034.

The Patch fixes the domain name validation which ends with "."
The test results are as follows:

1. if DNS server returns with domain name "foo.test.com." , resolv.conf
gets populated with "domain foo.test.com."

2. if DNS server returns with domain name "foo.test.com" , resolv.conf gets
populated with "domain foo.test.com"

Without this Patch:
1. if DNS server returns with domain name "foo.test.com." , resolv.conf
gets populated with "domain bad <http://foo.test.com>"

2. if DNS server returns with domain name "foo.test.com" , resolv.conf gets
populated with "domain foo.test.com"

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div><div>When a dhcp server responds with a domain \
name that ends with a &quot;.&quot;, <br>domain name validation is failing which \
leads to populating domain bad in resolv.conf<br><br></div>Domain name ending with . \
is a valid syntax according RFC-1034.<br><br></div>The Patch fixes the domain name \
validation which ends with &quot;.&quot;<br></div>The test results are as \
follows:<br><br></div><div>1. if DNS server returns with domain name &quot;<a \
href="http://foo.test.com" target="_blank">foo.test.com</a>.&quot; , resolv.conf gets \
populated with &quot;domain <a href="http://foo.test.com" \
target="_blank">foo.test.com</a>.&quot;<br><br></div>2. if DNS server returns with \
domain name &quot;<a href="http://foo.test.com" \
target="_blank">foo.test.com</a>&quot; , resolv.conf gets populated with &quot;domain \
<a href="http://foo.test.com" \
target="_blank">foo.test.com</a>&quot;<br><br></div>Without this Patch:<br>1. if DNS \
server returns with domain name &quot;<a href="http://foo.test.com" \
target="_blank">foo.test.com</a>.&quot; , resolv.conf gets populated with \
&quot;domain <a href="http://foo.test.com" target="_blank">bad</a>&quot;<br><br>2. if \
DNS server returns with domain name &quot;<a href="http://foo.test.com" \
target="_blank">foo.test.com</a>&quot; , resolv.conf gets populated with &quot;domain \
<a href="http://foo.test.com" target="_blank">foo.test.com</a>&quot;<br><br></div>


["0001-networking-Fixed-issue-with-domain-name-validation-i.patch" (text/x-patch)]

From 3b87f7407f2be34e1f3da1a17c0da20b64626704 Mon Sep 17 00:00:00 2001
From: Balaji Punnuru <balaji_punnuru@cable.comcast.com>
Date: Wed, 3 Feb 2016 13:07:26 -0500
Subject: [PATCH] networking: Fixed issue with domain name validation in dhcp
 response.

Details: In Some instances where DNS Servers sends out domain name
         in answer with a terminating ".", the validation logic for
         domain name is returning as bad domain.

         According to RFC 1034 Section 3.1, a character string
         which represents a complete domain name(often called "absolute").
         For example, "poneria.ISI.EDU."

         The fix done is to add a check for end of string after
         processing node which allows for presence of "." at the end of the string

Signed-off-by: Balaji Punnuru <balaji_punnuru@cable.comcast.com>
---
 networking/udhcp/dhcpc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 915f659..3d5b245 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -201,6 +201,18 @@ static int good_hostname(const char *name)
 			//Do we want this?
 			//return ((name - start) < 1025); /* NS_MAXDNAME */
 		name++;
+                /*
+                   According to RFC 1034, section 3.1, trailing dots is allowed,
+
+                   Quoting from RFC 1034:
+                   ----------------------
+                   The most common interpretation uses the root "." as either the
+                   single origin or as one of the members of the search list, so
+                   a multi-label relative name is often one where the trailing dot
+                   has been omitted to save typing.
+                */
+		if (*name == '\0')
+			return 1;
 	}
 }
 #else
-- 
2.1.4



_______________________________________________
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