Skip to content

Commit

Permalink
[dhcp] Allow for missing server ID in ProxyDHCPACK
Browse files Browse the repository at this point in the history
The Linux PXE server (http://www.kano.org.uk/projects/pxe) does not
set the server identifier in its ProxyDHCP responses.  If the server
ID is missing, do not treat this as an error.

This resolves the "vague and unsettling memory" mentioned in commit
fdb8481 ("[dhcp] Verify server identifier on ProxyDHCPACKs").

Note that we already accept ProxyDHCPOFFERs without a server
identifier; they get treated as potential BOOTP packets.
  • Loading branch information
Michael Brown committed Jan 21, 2009
1 parent 08f6d22 commit d7de30e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/net/udp/dhcp.c
Expand Up @@ -845,16 +845,20 @@ static void dhcp_rx_proxydhcpack ( struct dhcp_session *dhcp,
struct in_addr ack_server_id = { 0 };
int rc;

/* Verify server ID matches */
/* Verify server ID matches, if present */
assert ( dhcp->proxydhcpoffer != NULL );
dhcppkt_fetch ( &dhcp->proxydhcpoffer->dhcppkt, DHCP_SERVER_IDENTIFIER,
&offer_server_id, sizeof ( offer_server_id ) );
dhcppkt_fetch ( &proxydhcpack->dhcppkt, DHCP_SERVER_IDENTIFIER,
&ack_server_id, sizeof ( ack_server_id ) );
if ( offer_server_id.s_addr != ack_server_id.s_addr ) {
DBGC ( dhcp, "DHCP %p ignoring ProxyDHCPACK with wrong server "
"ID %s\n", dhcp, inet_ntoa ( ack_server_id ) );
return;
if ( ( rc = dhcppkt_fetch ( &proxydhcpack->dhcppkt,
DHCP_SERVER_IDENTIFIER, &ack_server_id,
sizeof ( ack_server_id ) ) ) > 0 ) {
dhcppkt_fetch ( &dhcp->proxydhcpoffer->dhcppkt,
DHCP_SERVER_IDENTIFIER, &offer_server_id,
sizeof ( offer_server_id ) );
if ( offer_server_id.s_addr != ack_server_id.s_addr ) {
DBGC ( dhcp, "DHCP %p ignoring ProxyDHCPACK with "
"wrong server ID %s\n",
dhcp, inet_ntoa ( ack_server_id ) );
return;
}
}

/* Rename settings */
Expand Down

0 comments on commit d7de30e

Please sign in to comment.