Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2012 01:06:25 GMT
From:      Maciej Kazulak <kazulakm@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/165700: [libstand] pxeboot discards network mask assigned via DHCP on supernets
Message-ID:  <201203050106.q2516PhP090182@red.freebsd.org>
Resent-Message-ID: <201203050110.q251ACSx047905@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         165700
>Category:       kern
>Synopsis:       [libstand] pxeboot discards network mask assigned via DHCP on supernets
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 05 01:10:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Maciej Kazulak
>Release:        9.0-RELEASE
>Organization:
>Environment:
FreeBSD gauss.local.spcsk.pl 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
pxeboot uses code in libstand to get information from DHCP. libstand in bootp.c contains logic which effectively breaks CIDR on supernets such as 192.168.0.0/23 and causes the network mask to be truncated to the native classfull mask (/24 in this case). This code is present at least since 3.0-RELEASE and is still in HEAD.

Sample scenario:
1. Setup standard FreeBSD network booting on a supernet such as 192.168.0.0/23
2. Boot a client on the same network via PXE with root on NFS
3. pxeboot is loaded via TFTP as per dhcpd.conf
4. pxeboot performs a DHCP request
5. pxeboot keeps the assigned IP but discards network mask as "bogus" and uses /24

(gateway might also be discarded if it ends up being in the other C network)

Case 1 - client and NFS server are on the same class C network
6. Client boots normally but after boot keeps the wrong netmask of /24

Case 2 - client and NFS server on different class C networks
6. Client hangs while trying to mount NFS root because it doesn't know how to contact the server

No errors or warnings are logged unless debugging is enabled in libstand. I find that plainly misleading. Even if I configure wrong network mask in DHCP I still don't expect that a client will silently discard it and use another one.

>How-To-Repeat:
1. Setup standard FreeBSD network booting on a supernet such as 192.168.0.0/23
2. PXE boot any machine on the same network
>Fix:
Expected behavior: pxeboot should respect network mask assigned via DHCP.

Proposed patch attached. Successfully tested on 9.0-RELEASE.

Patch attached with submission follows:

--- /repo/freebsd/base/release/9.0.0/lib/libstand/bootp.c	2012-03-02 18:04:38.914462827 +0100
+++ lib/libstand/bootp.c	2012-03-02 20:59:33.705461804 +0100
@@ -223,15 +223,6 @@
 		printf("'native netmask' is %s\n", intoa(nmask));
 #endif
 
-	/* Check subnet mask against net mask; toss if bogus */
-	if ((nmask & smask) != nmask) {
-#ifdef BOOTP_DEBUG
-		if (debug)
-			printf("subnet mask (%s) bad\n", intoa(smask));
-#endif
-		smask = 0;
-	}
-
 	/* Get subnet (or natural net) mask */
 	netmask = nmask;
 	if (smask)


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203050106.q2516PhP090182>