Module Name:    src
Committed By:   roy
Date:           Mon Jul 29 20:39:29 UTC 2013

Modified Files:
        src/external/bsd/dhcpcd/dist: dhcp.c dhcpcd-run-hooks.8.in dhcpcd.8.in
            dhcpcd.conf dhcpcd.conf.5.in

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/dhcpcd/dist/dhcpcd.8.in
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/dhcpcd.conf
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.5 src/external/bsd/dhcpcd/dist/dhcp.c:1.6
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.5	Fri Jun 21 19:40:20 2013
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Mon Jul 29 20:39:28 2013
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.5 2013/06/21 19:40:20 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.6 2013/07/29 20:39:28 roy Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -187,7 +187,7 @@ const struct dhcp_opt dhcp_opts[] = {
 	{ 76,	IPV4A,		"streettalk_directory_assistance_server" },
 	{ 77,	STRING,		"user_class" },
 	{ 80,	FLAG | NOREQ,	"rapid_commit" },
-	{ 81,	STRING | RFC3397,	"fqdn_name" },
+	{ 81,	STRING | RFC3397,	"fqdn" },
 	{ 85,	IPV4A,		"nds_servers" },
 	{ 86,	STRING,		"nds_tree_name" },
 	{ 87,	STRING,		"nds_context" },
@@ -848,7 +848,6 @@ make_message(struct dhcp_message **messa
 	uint32_t ul;
 	uint16_t sz;
 	size_t len;
-	const char *hp;
 	const struct dhcp_opt *opt;
 	const struct if_options *ifo = iface->options;
 	const struct dhcp_state *state = D_CSTATE(iface);
@@ -989,25 +988,11 @@ make_message(struct dhcp_message **messa
 			}
 		}
 
-		/* Regardless of RFC2132, we should always send a hostname
-		 * upto the first dot (the short hostname) as otherwise
-		 * confuses some DHCP servers when updating DNS.
-		 * The FQDN option should be used if a FQDN is required. */
 		if (ifo->hostname[0] == '\0')
-			hostname = get_hostname();
+			hostname = get_hostname(ifo->options &
+			    DHCPCD_HOSTNAME_SHORT ? 1 : 0);
 		else
 			hostname = ifo->hostname;
-		if (ifo->options & DHCPCD_HOSTNAME && hostname) {
-			*p++ = DHO_HOSTNAME;
-			hp = strchr(hostname, '.');
-			if (hp)
-				len = hp - hostname;
-			else
-				len = strlen(hostname);
-			*p++ = len;
-			memcpy(p, hostname, len);
-			p += len;
-		}
 		if (ifo->fqdn != FQDN_DISABLE) {
 			/* IETF DHC-FQDN option (81), RFC4702 */
 			*p++ = DHO_FQDN;
@@ -1034,6 +1019,12 @@ make_message(struct dhcp_message **messa
 				*lp += ul;
 				p += ul;
 			}
+		} else if (ifo->options & DHCPCD_HOSTNAME && hostname) {
+			*p++ = DHO_HOSTNAME;
+			len = strlen(hostname);
+			*p++ = len;
+			memcpy(p, hostname, len);
+			p += len;
 		}
 
 		/* vendor is already encoded correctly, so just add it */

Index: src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.4 src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.5
--- src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in:1.4	Sat Jul 20 21:40:04 2013
+++ src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in	Mon Jul 29 20:39:28 2013
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd-run-hooks.8.in,v 1.4 2013/07/20 21:40:04 wiz Exp $
+.\"     $NetBSD: dhcpcd-run-hooks.8.in,v 1.5 2013/07/29 20:39:28 roy Exp $
 .\" Copyright (c) 2006-2013 Roy Marples
 .\" All rights reserved
 .\"

Index: src/external/bsd/dhcpcd/dist/dhcpcd.8.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.20 src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.21
--- src/external/bsd/dhcpcd/dist/dhcpcd.8.in:1.20	Sat Jul 20 21:40:04 2013
+++ src/external/bsd/dhcpcd/dist/dhcpcd.8.in	Mon Jul 29 20:39:28 2013
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.8.in,v 1.20 2013/07/20 21:40:04 wiz Exp $
+.\"     $NetBSD: dhcpcd.8.in,v 1.21 2013/07/29 20:39:28 roy Exp $
 .\" Copyright (c) 2006-2013 Roy Marples
 .\" All rights reserved
 .\"

Index: src/external/bsd/dhcpcd/dist/dhcpcd.conf
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.conf:1.6 src/external/bsd/dhcpcd/dist/dhcpcd.conf:1.7
--- src/external/bsd/dhcpcd/dist/dhcpcd.conf:1.6	Fri Jun 21 19:40:20 2013
+++ src/external/bsd/dhcpcd/dist/dhcpcd.conf	Mon Jul 29 20:39:28 2013
@@ -1,17 +1,11 @@
-# $NetBSD: dhcpcd.conf,v 1.6 2013/06/21 19:40:20 roy Exp $
+# $NetBSD: dhcpcd.conf,v 1.7 2013/07/29 20:39:28 roy Exp $
 
 # A sample configuration for dhcpcd.
 # See dhcpcd.conf(5) for details.
 
-# Inform the DHCPv4 server of our hostname for DDNS.
-# This has been superceded by the FQDN option below, but is included
-# by default for servers which do not understand it.
+# Inform the DHCP server of our hostname for DDNS.
 hostname
 
-# Inform the DHCP server of our hostname for DDNS
-# and/or query for what it should be.
-fqdn
-
 # Use the hardware address of the interface for the Client ID.
 #clientid
 # or

Index: src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
diff -u src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.2 src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.3
--- src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in:1.2	Sat Jul 20 21:40:04 2013
+++ src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in	Mon Jul 29 20:39:28 2013
@@ -1,4 +1,4 @@
-.\"     $NetBSD: dhcpcd.conf.5.in,v 1.2 2013/07/20 21:40:04 wiz Exp $
+.\"     $NetBSD: dhcpcd.conf.5.in,v 1.3 2013/07/29 20:39:28 roy Exp $
 .\" Copyright (c) 2006-2013 Roy Marples
 .\" All rights reserved
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 19, 2013
+.Dd July 25, 2013
 .Dt DHCPCD.CONF 5 SMM
 .Os
 .Sh NAME
@@ -99,6 +99,20 @@ to the environment for use in
 For example, you can force the hostname hook to always set the hostname with
 .Ic env
 .Va force_hostname=YES .
+.Pp
+If the hostname is set, will be will set to the FQDN if possible as per
+RFC 4702 section 3.1.
+If the FQDN option is missing,
+.Nm dhcpcd
+will still try and set a FQDN from the hostname and domain options for
+consistency.
+To override this, set
+.Ic env
+.Va hostname_fqdn=[YES|NO|SERVER] .
+A value of server means just what the server says, don't manipulate it.
+This could lead to an inconsistent hostname on a DHCPv4 and DHCPv6 network
+where the DHCPv4 hostname is short and the DHCPv6 has an FQDN.
+DHCPv6 has no hostname option.
 .It Ic clientid Ar string
 Send the
 .Ar clientid .
@@ -116,9 +130,9 @@ Generate an
 .%T "RFC 4361"
 .Re
 compliant clientid.
-This requires persistent storage and not all DHCP servers work with it so it's
-not enabled by default.
-The duid generated will be held in
+If persistent storage is available then a DUID-LLT (link local address + time)
+is generated, otherwise DUID-LL is generated (link local address).
+The DUID-LLT generated will be held in
 .Pa @SYSCONFDIR@/dhcpcd.duid
 and should not be copied to other hosts.
 .It Ic fallback Ar profile
@@ -134,6 +148,14 @@ is an empty string then the current syst
 If
 .Ar hostname
 is a FQDN (ie, contains a .) then it will be encoded as such.
+.It Ic hostname_short
+Sends the short hostname to the DHCP server instead of the FQDN.
+This is useful because DHCP servers will not register the FQDN in their
+DNS if the domain part does not match theirs.
+.Pp
+Also, see the
+.Ic env
+option above to control how the hostname is set on the host.
 .It Ic ia_na Op Ar iaid
 Request a DHCPv6 Normal Address for
 .Ar iaid .

Reply via email to