[Settings] Use a settings applicator to set the default TFTP URI.

This commit is contained in:
Michael Brown
2008-03-21 00:26:29 +00:00
parent 720e256c50
commit 1edbcd4246
3 changed files with 43 additions and 38 deletions

View File

@@ -284,8 +284,6 @@ 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();
}
/**
@@ -564,36 +562,3 @@ void delete_dhcp_option ( struct dhcp_option_block *options,
unsigned int tag ) {
set_dhcp_option ( options, tag, NULL, 0 );
}
/**
* Apply DHCP options
*
* @v options DHCP options block, or NULL
* @ret rc Return status code
*/
int apply_dhcp_options ( struct dhcp_option_block *options ) {
struct in_addr tftp_server;
struct uri *uri;
char uri_string[32];
/* Set current working URI based on TFTP server */
find_dhcp_ipv4_option ( options, DHCP_EB_SIADDR, &tftp_server );
snprintf ( uri_string, sizeof ( uri_string ),
"tftp://%s/", inet_ntoa ( tftp_server ) );
uri = parse_uri ( uri_string );
if ( ! uri )
return -ENOMEM;
churi ( uri );
uri_put ( uri );
return 0;
}
/**
* Apply global DHCP options
*
* @ret rc Return status code
*/
int apply_global_dhcp_options ( void ) {
return apply_dhcp_options ( NULL );
}