Subject: bin/8134: patch to fix setting hostname support via ISC-DHCP
To: None <gnats-bugs@gnats.netbsd.org>
From: None <obrien@nuxi.com>
List: netbsd-bugs
Date: 08/02/1999 11:14:13
>Number:         8134
>Category:       bin
>Synopsis:       one cannot use ISC-DHCP to set hostname
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug  2 10:05:00 1999
>Last-Modified:
>Originator:     David O'Brien
>Organization:
self
>Release:        1.4.1
>Environment:
DECstation 5000/25
System: NetBSD pmax.nuxi.com 1.4.1 NetBSD 1.4.1 (PMAX) #0: Wed Jul 28 10:20:54 PDT 1999 rootk@pmax.NUXI.com:/usr/src/sys/arch/pmax/compile/PMAX pmax


>Description:
	With patch to usr.sbin/dhcp/client/scripts/netbsd it is impossible
	to set the hostname via DHCP.  With out the patch to
	usr.sbin/dhcp/common/tables.c, the hostname will be set to a hex dump
	of the hostname.  Ie, 
		$ hostname
		 "70:6d:61:78:2e:6e:75:78:69:2e:63:6f:6d"

>How-To-Repeat:
	
>Fix:

--- usr.sbin/dhcp/client/scripts/netbsd.orig	Fri Mar  5 14:37:43 1999
+++ usr.sbin/dhcp/client/scripts/netbsd	Mon Aug  2 05:18:26 1999
@@ -30,6 +30,13 @@
   fi
 fi
 
+if [ x$new_host_name != x ]; then
+  hostname $new_host_name
+fi
+if [ x$old_host_name != x ]; then
+  hostname $old_host_name
+fi
+
 if [ x$new_network_number != x ]; then
    echo New Network Number: $new_network_number
 fi


--- usr.sbin/dhcp/common/tables.c.orig	Thu Feb 18 13:48:51 1999
+++ usr.sbin/dhcp/common/tables.c	Mon Aug  2 09:49:30 1999
@@ -62,6 +62,7 @@
    t - ASCII text
    f - flag (true or false)
    A - array of whatever precedes (e.g., IA means array of IP addresses)
+   X - hex dump
 */
 
 struct universe dhcp_universe;
@@ -78,7 +79,7 @@
 	{ "lpr-servers", "IA",				&dhcp_universe, 9 },
 	{ "impress-servers", "IA",			&dhcp_universe, 10 },
 	{ "resource-location-servers", "IA",		&dhcp_universe, 11 },
-	{ "host-name", "X",				&dhcp_universe, 12 },
+	{ "host-name", "t",				&dhcp_universe, 12 },
 	{ "boot-size", "S",				&dhcp_universe, 13 },
 	{ "merit-dump", "t",				&dhcp_universe, 14 },
 	{ "domain-name", "t",				&dhcp_universe, 15 },
>Audit-Trail:
>Unformatted: