Browse Source

[dhcp] Honor PXEBS_SKIP option in discovery control

It is permissible for a DHCP packet containing PXE options to specify
only "discovery control", instead of the more typical boot menu +
prompt options. This is the strategy used by older versions of
dnsmasq; by specifying the discovery control as PXEBS_SKIP, they cause
vendor PXE ROMs to ignore boot server discovery and just use the
filename and next-server options in the initial (Proxy)DHCP packet.
Modify iPXE to accept this behavior, to be more compatible with the
Intel firmware.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Tested-by: Kyle Kienapfel <kyle@shadowmage.org>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Joshua Oreman 14 years ago
parent
commit
620b98ee4b
1 changed files with 26 additions and 2 deletions
  1. 26
    2
      src/net/udp/dhcp.c

+ 26
- 2
src/net/udp/dhcp.c View File

@@ -401,6 +401,7 @@ static void dhcp_rx_offer ( struct dhcp_session *dhcp,
401 401
 	int has_pxeclient;
402 402
 	int pxeopts_len;
403 403
 	int has_pxeopts;
404
+	uint8_t discovery_control = 0;
404 405
 	struct dhcp_offer *offer;
405 406
 	int i;
406 407
 
@@ -439,9 +440,32 @@ static void dhcp_rx_offer ( struct dhcp_session *dhcp,
439 440
 	has_pxeclient = ( ( vci_len >= ( int ) sizeof ( vci ) ) &&
440 441
 			  ( strncmp ( "PXEClient", vci, sizeof (vci) ) == 0 ));
441 442
 
442
-	/* Identify presence of PXE-specific options */
443
+	/*
444
+	 * Identify presence of PXE-specific options
445
+	 *
446
+	 * The Intel firmware appears to check for:
447
+	 * - PXE_DISCOVERY_CONTROL exists and has bit 3 set, or
448
+	 * - both PXE_BOOT_MENU and PXE_BOOT_MENU_PROMPT exist
449
+	 *
450
+	 * If DISCOVERY_CONTROL bit 3 is set, the firmware treats this
451
+	 * packet like a "normal" non-PXE DHCP packet with respect to
452
+	 * boot filename, except that it can come from ProxyDHCP. This
453
+	 * is the scheme that dnsmasq uses in the simple case.
454
+	 *
455
+	 * Otherwise, if one of the boot menu / boot menu prompt
456
+	 * options exists but not both, the firmware signals an
457
+	 * error. If neither exists, the packet is not considered to
458
+	 * contain DHCP options.
459
+	 *
460
+	 * In an effort to preserve semantics but be more flexible, we
461
+	 * check only for bit 3 of DISCOVERY_CONTROL or the presence
462
+	 * of BOOT_MENU. We don't care (yet) about the menu prompt.
463
+	 */
443 464
 	pxeopts_len = dhcppkt_fetch ( dhcppkt, DHCP_PXE_BOOT_MENU, NULL, 0 );
444
-	has_pxeopts = ( pxeopts_len >= 0 );
465
+	dhcppkt_fetch ( dhcppkt, DHCP_PXE_DISCOVERY_CONTROL,
466
+			&discovery_control, sizeof ( discovery_control ) );
467
+	has_pxeopts = ( ( pxeopts_len >= 0 ) ||
468
+			( discovery_control & PXEBS_SKIP ) );
445 469
 	if ( has_pxeclient )
446 470
 		DBGC ( dhcp, "%s", ( has_pxeopts ? " pxe" : " proxy" ) );
447 471
 

Loading…
Cancel
Save