Kaynağa Gözat

[dhcp] Handle missing ProxyDHCP servers

It is possible to configure a DHCP server to hand out PXE options
without a ProxyDHCP server present.  This requires setting option 60
to "PXEClient", which will cause gPXE to attempt ProxyDHCP.

We assume in several places that dhcp->proxydhcpack is set to the
DHCPACK packet containing option 60 set to "PXEClient".  When we
transition into ProxyDHCPREQUEST, set dhcp->proxydhcpack=dhcp->dhcpack
so that this assumption holds true.

We ought to rename several references to "proxydhcp" to something more
accurate, such as "pxedhcp".  Treating a single DHCP response as
potentially both DHCPOFFER and ProxyDHCPOFFER does make the code
smaller, but the variable names get confusing.
tags/v0.9.7
Michael Brown 15 yıl önce
ebeveyn
işleme
773d9631ef
1 değiştirilmiş dosya ile 8 ekleme ve 1 silme
  1. 8
    1
      src/net/udp/dhcp.c

+ 8
- 1
src/net/udp/dhcp.c Dosyayı Görüntüle

@@ -745,6 +745,13 @@ static void dhcp_next_state ( struct dhcp_session *dhcp ) {
745 745
 		break;
746 746
 	case DHCP_STATE_REQUEST:
747 747
 		if ( dhcp->proxydhcpoffer ) {
748
+			/* Store DHCPACK as ProxyDHCPACK.  This
749
+			 * handles the case in which the DHCP server
750
+			 * itself responds with "PXEClient" and PXE
751
+			 * options but there is no actual ProxyDHCP
752
+			 * server resident on the machine.
753
+			 */
754
+			dhcp->proxydhcpack = dhcpset_get ( dhcp->dhcpack );
748 755
 			dhcp_set_state ( dhcp, DHCP_STATE_PROXYREQUEST );
749 756
 			break;
750 757
 		}
@@ -990,7 +997,7 @@ static void dhcp_rx_proxydhcpack ( struct dhcp_session *dhcp,
990 997
 	proxydhcpack->settings.name = PROXYDHCP_SETTINGS_NAME;
991 998
 
992 999
 	/* Record ProxyDHCPACK */
993
-	assert ( dhcp->proxydhcpack == NULL );
1000
+	dhcpset_put ( dhcp->proxydhcpack );
994 1001
 	dhcp->proxydhcpack = dhcpset_get ( proxydhcpack );
995 1002
 
996 1003
 	/* Register settings */

Loading…
İptal
Kaydet