mirror of
https://github.com/xcat2/xNBA.git
synced 2025-02-12 16:48:11 +00:00
[dhcp] Send broadcast PXE boot server discovery requests to port 67
We currently send all boot server discovery requests to port 4011. Section 2.2.1 of the PXE spec states that boot server discovery packets should be "sent broadcast (port 67), multicast (port 4011), or unicast (port 4011)". Adjust our behaviour so that any boot server discovery packets that are sent to the broadcast address are directed to port 67 rather than port 4011. This is required for operation with dnsmasq as a PXE server, since dnsmasq listens only on port 67, and relies upon this (specified) behaviour. This change may break some setups using the (itself very broken) Linux PXE server from kano.org.uk. This server will, in its default configuration, listen only on port 4011. It never constructs a boot server list (PXE_BOOT_SERVERS, option 43.8), and uses the wrong definitions for the discovery control bits (PXE_DISCOVERY_CONTROL, option 43.6). The upshot is that it will always instruct the client to perform multicast and broadcast discovery only. In setups lacking a valid multicast route on the server side, this used to work because gPXE would eventually give up on the (non-responsive) multicast address and send a broadcast request to port 4011, which the Linux PXE server would respond to. Now that gPXE correctly sends this broadcast request to port 67 instead, it is never seen by the Linux PXE server, and the boot fails. The fix is to either (a) set up a multicast route correctly on the server side before starting the PXE server, or (b) edit /etc/pxe.conf to contain the server's unicast address in the "multicast_address" field (a hack that happens to work). Suggested-by: Simon Kelley <simon@thekelleys.org.uk>
This commit is contained in:
parent
9119b0c8af
commit
3961c1ca02
@ -670,8 +670,13 @@ static int dhcp_pxebs_tx ( struct dhcp_session *dhcp,
|
||||
struct dhcp_pxe_boot_menu_item menu_item = { 0, 0 };
|
||||
int rc;
|
||||
|
||||
/* Set server address */
|
||||
peer->sin_addr = *(dhcp->pxe_attempt);
|
||||
peer->sin_port = ( ( peer->sin_addr.s_addr == INADDR_BROADCAST ) ?
|
||||
htons ( BOOTPS_PORT ) : htons ( PXE_PORT ) );
|
||||
|
||||
DBGC ( dhcp, "DHCP %p PXEBS REQUEST to %s:%d for type %d\n",
|
||||
dhcp, inet_ntoa ( *(dhcp->pxe_attempt) ), PXE_PORT,
|
||||
dhcp, inet_ntoa ( peer->sin_addr ), ntohs ( peer->sin_port ),
|
||||
ntohs ( dhcp->pxe_type ) );
|
||||
|
||||
/* Set boot menu item */
|
||||
@ -680,10 +685,6 @@ static int dhcp_pxebs_tx ( struct dhcp_session *dhcp,
|
||||
&menu_item, sizeof ( menu_item ) ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Set server address */
|
||||
peer->sin_addr = *(dhcp->pxe_attempt);
|
||||
peer->sin_port = htons ( PXE_PORT );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -743,7 +744,8 @@ static void dhcp_pxebs_rx ( struct dhcp_session *dhcp,
|
||||
DBGC ( dhcp, "\n" );
|
||||
|
||||
/* Filter out unacceptable responses */
|
||||
if ( peer->sin_port != htons ( PXE_PORT ) )
|
||||
if ( ( peer->sin_port != htons ( BOOTPS_PORT ) ) &&
|
||||
( peer->sin_port != htons ( PXE_PORT ) ) )
|
||||
return;
|
||||
if ( msgtype != DHCPACK )
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user