Allow an AoE boot to be directed via DHCP, so that we have a proof of

concept demo that actually does something useful.
This commit is contained in:
Michael Brown
2006-07-20 14:15:23 +00:00
parent 3085f03ad4
commit a92d242008
2 changed files with 52 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ int test_dhcp ( struct net_device *netdev ) {
struct in_addr address = { htonl ( 0 ) };
struct in_addr netmask = { htonl ( 0 ) };
struct in_addr gateway = { INADDR_NONE };
char filename[256];
int rc;
/* Bring IP interface up with address 0.0.0.0 */
@@ -34,8 +35,14 @@ int test_dhcp ( struct net_device *netdev ) {
printf ( " netmask %s", inet_ntoa ( netmask ) );
printf ( " gateway %s\n", inet_ntoa ( gateway ) );
printf ( "Lease time is %ld seconds\n",
find_global_dhcp_num_option ( DHCP_LEASE_TIME ) );
dhcp_snprintf ( filename, sizeof ( filename ),
find_global_dhcp_option ( DHCP_BOOTFILE_NAME ) );
if ( ! filename[0] ) {
printf ( "No filename specified!\n" );
goto out;
}
printf ( "Bootfile name %s\n", filename );
/* Remove old IP address configuration */
del_ipv4_address ( netdev );
@@ -45,6 +52,19 @@ int test_dhcp ( struct net_device *netdev ) {
gateway ) ) != 0 )
goto out_no_del_ipv4;
/* Proof of concept: check for "aoe:" prefix and if found, do
* test AoE boot with AoE options.
*/
if ( strncmp ( filename, "aoe:", 4 ) == 0 ) {
unsigned int drivenum;
drivenum = find_global_dhcp_num_option ( DHCP_EB_BIOS_DRIVE );
test_aoeboot ( netdev, &filename[4], drivenum );
} else {
printf ( "Don't know how to boot %s\n", filename );
}
out:
/* Unregister and free DHCP options */
unregister_dhcp_options ( dhcp.options );
free_dhcp_options ( dhcp.options );