Subject: bin/18574: bootpd behavior inconsistent with manual
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kirill@lava.net>
List: netbsd-bugs
Date: 10/07/2002 12:58:51
>Number:         18574
>Category:       bin
>Synopsis:       bootpd behavior inconsistent with manual
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 07 12:59:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Kirill Levchenko
>Release:        NetBSD 1.6
>Organization:
	
>Environment:
	
	
System: NetBSD kronos.ouranos 1.6 NetBSD 1.6 (kronos) #1: Fri Sep 27 16:14:00 PDT 2002 root@kronos.ouranos:/usr/src/sys/arch/i386/compile/kronos i386
Architecture: i386
Machine: i386
>Description:
	Manual for bootptab states, in the paragraph about ht and ha fields,
	that if the type is ethernet or ieee802 and the hardware address is
	not specified, then bootpd will determine the hardware address using
	ether_hostton (i.e., /etc/ethers).

	The current implementation appears to be looking for the host name
	in the ha tag.
>How-To-Repeat:
	Specify ht=ethernet and omit the ha tag in a bootptab entry. Then
	start bootpd and send USR1 signal to dump entries. Observe that
	the ethernet address is not present.
>Fix:
	Apply the following patch to bootp/common/readfile.c.

--- /usr/src/usr.sbin/bootp/common/readfile.c	Mon Aug 20 05:00:57 2001
+++ readfile.c	Fri Oct  4 01:12:29 2002
@@ -437,0 +438,12 @@
+#ifdef	ETC_ETHERS
+			/* Lookup hardware address. */
+			if (hp->flags.htype && hp->flags.haddr == 0 &&
+					(hp->htype == HTYPE_ETHERNET || hp->htype == HTYPE_IEEE802)) {
+				char *ha;
+				ha = lookup_hwa(hn, hp->htype);
+				if (ha) {
+					bcopy(ha, &hp->haddr, haddrlength(hp->htype));
+					hp->flags.haddr = TRUE;
+				}
+			}
+#endif /* ETC_ETHERS */
@@ -1796,11 +1807,0 @@
-
-#if 1	/* XXX - experimental */
-	/* If it's a valid host name, try to lookup the HW address. */
-	if (goodname(p)) {
-		/* Lookup Hardware Address for hostname. */
-		if ((hap = lookup_hwa(p, htype)) != NULL)
-			return hap; /* success */
-		report(LOG_ERR, "Add 0x prefix if hex value starts with A-F");
-		/* OK, assume it must be numeric. */
-	}
-#endif
>Release-Note:
>Audit-Trail:
>Unformatted: