Browse Source

[dhcp] Allow for missing server ID in ProxyDHCPACK

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
fdb8481d ("[dhcp] Verify server identifier on ProxyDHCPACKs").

Note that we already accept ProxyDHCPOFFERs without a server
identifier; they get treated as potential BOOTP packets.
tags/v0.9.7
Michael Brown 16 years ago
parent
commit
d7de30e5e4
1 changed files with 13 additions and 9 deletions
  1. 13
    9
      src/net/udp/dhcp.c

+ 13
- 9
src/net/udp/dhcp.c View File

845
 	struct in_addr ack_server_id = { 0 };
845
 	struct in_addr ack_server_id = { 0 };
846
 	int rc;
846
 	int rc;
847
 
847
 
848
-	/* Verify server ID matches */
848
+	/* Verify server ID matches, if present */
849
 	assert ( dhcp->proxydhcpoffer != NULL );
849
 	assert ( dhcp->proxydhcpoffer != NULL );
850
-	dhcppkt_fetch ( &dhcp->proxydhcpoffer->dhcppkt, DHCP_SERVER_IDENTIFIER,
851
-			&offer_server_id, sizeof ( offer_server_id ) );
852
-	dhcppkt_fetch ( &proxydhcpack->dhcppkt, DHCP_SERVER_IDENTIFIER,
853
-			&ack_server_id, sizeof ( ack_server_id ) );
854
-	if ( offer_server_id.s_addr != ack_server_id.s_addr ) {
855
-		DBGC ( dhcp, "DHCP %p ignoring ProxyDHCPACK with wrong server "
856
-		       "ID %s\n", dhcp, inet_ntoa ( ack_server_id ) );
857
-		return;
850
+	if ( ( rc = dhcppkt_fetch ( &proxydhcpack->dhcppkt,
851
+				    DHCP_SERVER_IDENTIFIER, &ack_server_id,
852
+				    sizeof ( ack_server_id ) ) ) > 0 ) {
853
+		dhcppkt_fetch ( &dhcp->proxydhcpoffer->dhcppkt,
854
+				DHCP_SERVER_IDENTIFIER, &offer_server_id,
855
+				sizeof ( offer_server_id ) );
856
+		if ( offer_server_id.s_addr != ack_server_id.s_addr ) {
857
+			DBGC ( dhcp, "DHCP %p ignoring ProxyDHCPACK with "
858
+			       "wrong server ID %s\n",
859
+			       dhcp, inet_ntoa ( ack_server_id ) );
860
+			return;
861
+		}
858
 	}
862
 	}
859
 
863
 
860
 	/* Rename settings */
864
 	/* Rename settings */

Loading…
Cancel
Save