Bladeren bron

[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 jaren geleden
bovenliggende
commit
d7de30e5e4
1 gewijzigde bestanden met toevoegingen van 13 en 9 verwijderingen
  1. 13
    9
      src/net/udp/dhcp.c

+ 13
- 9
src/net/udp/dhcp.c Bestand weergeven

@@ -845,16 +845,20 @@ static void dhcp_rx_proxydhcpack ( struct dhcp_session *dhcp,
845 845
 	struct in_addr ack_server_id = { 0 };
846 846
 	int rc;
847 847
 
848
-	/* Verify server ID matches */
848
+	/* Verify server ID matches, if present */
849 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 864
 	/* Rename settings */

Laden…
Annuleren
Opslaan