[ipxe-devel] [PATCH] [dhcp] When starting the DHCP process, clean all previous settings which were done by another net device.

Wissam Shoukair wissams at mellanox.com
Tue Feb 11 12:53:23 UTC 2014


There was an issue when the first port saved the settings of the proxy DHCP server but didn't complete the boot process, and the second port started the DHCP process but didn't get the settings from the proxy DHCP server (different configuration). As a result, when executing the pxelinux.0, it gets also the settings saved from the previous net device (first port).

Signed-off-by: Wissam Shoukair <wissams at mellanox.com>
---
 src/net/udp/dhcp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 4625d1d..65f5eae 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -1287,8 +1287,20 @@ static struct sockaddr dhcp_peer = {
  */
 int start_dhcp ( struct interface *job, struct net_device *netdev ) {
 	struct dhcp_session *dhcp;
+	struct settings *proxy_settings;
+	struct settings *pxebs_settings;
 	int rc;
 
+	/* Clear stored settings from previous DHCP try (maybe on a different netdevice) */
+	proxy_settings = find_settings ( PROXYDHCP_SETTINGS_NAME );
+	pxebs_settings = find_settings ( PXEBS_SETTINGS_NAME );
+	if ( proxy_settings ) {
+		unregister_settings ( proxy_settings );
+	}
+	if ( pxebs_settings ) {
+		unregister_settings ( pxebs_settings );
+	}
+
 	/* Allocate and initialise structure */
 	dhcp = zalloc ( sizeof ( *dhcp ) );
 	if ( ! dhcp )
-- 
1.7.11.1




More information about the ipxe-devel mailing list