Bug 165700 - [libstand] [patch] pxeboot discards network mask assigned via DHCP on supernets
Summary: [libstand] [patch] pxeboot discards network mask assigned via DHCP on supernets
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2012-03-05 01:10 UTC by Maciej Kazulak
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:

file.diff (517 bytes, patch)
2012-03-05 01:10 UTC, Maciej Kazulak
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Kazulak 2012-03-05 01:10:12 UTC
pxeboot uses code in libstand to get information from DHCP. libstand in bootp.c contains logic which effectively breaks CIDR on supernets such as 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
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.

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:
How-To-Repeat: 1. Setup standard FreeBSD network booting on a supernet such as
2. PXE boot any machine on the same network
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:51 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped