[ipxe-devel] [PATCH] [autoboot] Use next-server from filename settings block
Alex Williamson
alex.williamson at redhat.com
Fri Jun 7 15:38:46 UTC 2013
In cases where we have both a DHCP and ProxyDHCP response we retrieve
the next-server and filename independently. This means they can
actually come from different settings blocks. For instance, net0.dhcp
is currently ordered before proxydhcp, so we can take the filename
from proxydhcp and next-server from net0.dhcp. It's sensible that
filename+next-server should be treated as a pair and retrieved from
the same settings block. Re-order fetch_next_server_and_filename to
get filename first, find the origin settings block, and get
next_server from the same.
Signed-off-by: Alex Williamson <alex.williamson at redhat.com>
---
src/usr/autoboot.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index b2d288e..6a1a70c 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -252,15 +252,11 @@ static void close_all_netdevs ( void ) {
*/
struct uri * fetch_next_server_and_filename ( struct settings *settings ) {
struct in_addr next_server;
+ struct settings *filename_settings;
char buf[256];
char *filename;
struct uri *uri;
- /* Fetch next-server setting */
- fetch_ipv4_setting ( settings, &next_server_setting, &next_server );
- if ( next_server.s_addr )
- printf ( "Next server: %s\n", inet_ntoa ( next_server ) );
-
/* Fetch filename setting */
fetch_string_setting ( settings, &filename_setting,
buf, sizeof ( buf ) );
@@ -272,6 +268,16 @@ struct uri * fetch_next_server_and_filename ( struct settings *settings ) {
if ( ! filename )
return NULL;
+ /* Get settings block for filename; use next-server from same */
+ filename_settings = fetch_setting_origin ( settings,
+ &filename_setting );
+
+ /* Fetch next-server setting */
+ fetch_ipv4_setting ( filename_settings,
+ &next_server_setting, &next_server );
+ if ( next_server.s_addr )
+ printf ( "Next server: %s\n", inet_ntoa ( next_server ) );
+
/* Parse next server and filename */
uri = parse_next_server_and_filename ( next_server, filename );
More information about the ipxe-devel
mailing list