From 934b70d62c7cd9835b2b8682f665277e1e1259e1 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 6 Jul 2007 17:07:50 +0100 Subject: [PATCH] Apply global DHCP options when register_dhcp_options() is called. Do not apply DHCP options in dhcp_configure_netdev(). --- src/include/gpxe/dhcp.h | 1 + src/net/dhcpopts.c | 12 ++++++++++++ src/net/udp/dhcp.c | 7 ------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/include/gpxe/dhcp.h b/src/include/gpxe/dhcp.h index caac9144..7e5eb3c9 100644 --- a/src/include/gpxe/dhcp.h +++ b/src/include/gpxe/dhcp.h @@ -504,6 +504,7 @@ extern void find_global_dhcp_ipv4_option ( unsigned int tag, extern void delete_dhcp_option ( struct dhcp_option_block *options, unsigned int tag ); extern int apply_dhcp_options ( struct dhcp_option_block *options ); +extern int apply_global_dhcp_options ( void ); extern struct dhcp_option_block dhcp_request_options; extern int create_dhcp_packet ( struct net_device *netdev, uint8_t msgtype, diff --git a/src/net/dhcpopts.c b/src/net/dhcpopts.c index 6038709b..c713909e 100644 --- a/src/net/dhcpopts.c +++ b/src/net/dhcpopts.c @@ -289,6 +289,9 @@ void register_dhcp_options ( struct dhcp_option_block *options ) { } dhcpopt_get ( options ); list_add_tail ( &options->list, &existing->list ); + + /* Apply all registered DHCP options */ + apply_global_dhcp_options(); } /** @@ -609,3 +612,12 @@ int apply_dhcp_options ( struct dhcp_option_block *options ) { return 0; } + +/** + * Apply global DHCP options + * + * @ret rc Return status code + */ +int apply_global_dhcp_options ( void ) { + return apply_dhcp_options ( NULL ); +} diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c index a8cb9376..81454b06 100644 --- a/src/net/udp/dhcp.c +++ b/src/net/udp/dhcp.c @@ -855,12 +855,5 @@ int dhcp_configure_netdev ( struct net_device *netdev, return rc; } - /* Apply other DHCP options */ - if ( ( rc = apply_dhcp_options ( options ) ) != 0 ) { - DBG ( "Could not apply %s DHCP result options: %s\n", - netdev->name, strerror ( rc ) ); - return rc; - } - return 0; }