When retrieving next-server/filename options during autboot from 2nd and subsequent NIC's after a boot failure, settings obtained from previous NIC's may be used - with erroneous results. Fix this by unregistering all DHCP obtained parameters before trying the next interface.
Signed-off-by: Gianni Tedesco <[email protected]> diff -r 608f4232e0ca tools/firmware/etherboot/gpxe-1.0.0/src/core/settings.c --- a/tools/firmware/etherboot/gpxe-1.0.0/src/core/settings.c Thu Jul 08 12:25:37 2010 +0100 +++ b/tools/firmware/etherboot/gpxe-1.0.0/src/core/settings.c Thu Jul 08 12:27:27 2010 +0100 @@ -237,7 +237,7 @@ * @v name Name within this parent * @ret settings Settings block, or NULL */ -static struct settings * find_child_settings ( struct settings *parent, +struct settings * find_child_settings ( struct settings *parent, const char *name ) { struct settings *settings; diff -r 608f4232e0ca tools/firmware/etherboot/gpxe-1.0.0/src/include/gpxe/settings.h --- a/tools/firmware/etherboot/gpxe-1.0.0/src/include/gpxe/settings.h Thu Jul 08 12:25:37 2010 +0100 +++ b/tools/firmware/etherboot/gpxe-1.0.0/src/include/gpxe/settings.h Thu Jul 08 12:27:27 2010 +0100 @@ -209,6 +209,8 @@ extern void clear_settings ( struct settings *settings ); extern int setting_cmp ( struct setting *a, struct setting *b ); +extern struct settings * find_child_settings ( struct settings *parent, + const char *name ); extern struct settings * find_settings ( const char *name ); extern int storef_setting ( struct settings *settings, diff -r 608f4232e0ca tools/firmware/etherboot/gpxe-1.0.0/src/usr/autoboot.c --- a/tools/firmware/etherboot/gpxe-1.0.0/src/usr/autoboot.c Thu Jul 08 12:25:37 2010 +0100 +++ b/tools/firmware/etherboot/gpxe-1.0.0/src/usr/autoboot.c Thu Jul 08 12:27:27 2010 +0100 @@ -183,6 +183,7 @@ fetch_ipv4_setting ( NULL, &next_server_setting, &next_server ); fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) ); if ( buf[0] ) { + struct settings *dhcpset; printf ( "Booting from filename \"%s\"\n", buf ); /* Clear the flag that says we're running PVS if @@ -191,15 +192,23 @@ if (strcasecmp("ardbp32.bin", buf) != 0) running_pvs_nbp = 0; - if ( ( rc = boot_next_server_and_filename ( next_server, - buf ) ) != 0 ) { + rc = boot_next_server_and_filename ( next_server, buf ); + if ( ( dhcpset = find_child_settings ( + netdev_settings(netdev), + DHCP_SETTINGS_NAME) )) + unregister_settings ( dhcpset ); + if ( ( dhcpset = find_child_settings ( + netdev_settings(netdev), + PROXYDHCP_SETTINGS_NAME) )) + unregister_settings ( dhcpset ); + if ( rc ) { printf ( "Could not boot from filename \"%s\": %s\n", buf, strerror ( rc ) ); return rc; } return 0; } - + /* No filename; try the root path */ fetch_string_setting ( NULL, &root_path_setting, buf, sizeof ( buf ) ); if ( buf[0] ) { _______________________________________________ gPXE-devel mailing list [email protected] http://etherboot.org/mailman/listinfo/gpxe-devel
