When doing autoboot in a proxydhcp environment, the settings-fetch for
next-server returns the IP given by a DHCP server which has nothing to
do with PXEboot and has not specified a boot filename. This happens even
when ProxyDHCP has been selected for boot and has returned a boot
filename. Fix this by ensuring that the (next-server, filename) tuple
have either both come from ProxyDHCP or from netdev DHCP settings block
but not one from each.

Signed-off-by: Gianni Tedesco <gianni.tede...@citrix.com>

diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index d76751b..0eb7175 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -145,6 +145,7 @@ static int netboot ( struct net_device *netdev ) {
        char buf[256];
        struct in_addr next_server;
        unsigned int pxe_discovery_control;
+       struct settings *settings;
        int rc;
 
        /* Open device and display device status */
@@ -171,8 +172,20 @@ static int netboot ( struct net_device *netdev ) {
        }
 
        /* Try to download and boot whatever we are given as a filename */
-       fetch_ipv4_setting ( NULL, &next_server_setting, &next_server );
-       fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) );
+       settings = find_settings ( PROXYDHCP_SETTINGS_NAME );
+       if ( settings ) {
+               fetch_ipv4_setting ( settings, &next_server_setting,
+                                       &next_server );
+               fetch_string_setting ( settings, &filename_setting,
+                                       buf, sizeof ( buf ) );
+       }
+       settings = netdev_settings(netdev);
+       if ( !buf[0] && settings ) {
+               fetch_ipv4_setting ( settings, &next_server_setting,
+                                       &next_server );
+               fetch_string_setting ( settings, &filename_setting,
+                                       buf, sizeof ( buf ) );
+       }
        if ( buf[0] ) {
                printf ( "Booting from filename \"%s\"\n", buf );
                if ( ( rc = boot_next_server_and_filename ( next_server,


_______________________________________________
gPXE-devel mailing list
gPXE-devel@etherboot.org
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to