From: Tony Breeds Date: Thu, 22 Oct 2009 04:46:37 +0000 (+1100) Subject: Parse the subnetmask from bootpath and DHCP options X-Git-Tag: yaboot-1.3.17-rc1~28^2~1 X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=commitdiff_plain;h=19d463913aa7e20a567d5e7fb68b7fd69955b5fc Parse the subnetmask from bootpath and DHCP options Some power6 machines need to have the subnetmask to correctly open() the network device. Signed-off-by: Tony Breeds --- diff --git a/include/file.h b/include/file.h index ca76a52..cff6cbb 100644 --- a/include/file.h +++ b/include/file.h @@ -45,6 +45,7 @@ struct boot_fspec_t { char* giaddr; /* Gateway address */ char* bootp_retries; /* Bootp retries */ char* tftp_retries; /* TFTP retries */ + char* subnetmask; /* Subnet mask */ char* addl_params; /* copy all additional parameters */ }; diff --git a/second/file.c b/second/file.c index 6b997b0..aad1ba4 100644 --- a/second/file.c +++ b/second/file.c @@ -172,6 +172,7 @@ extract_ipv4_args(char *imagepath, struct boot_fspec_t *result) result->giaddr = is_valid_ipv4_str(scopy(&str, &args)); result->bootp_retries = scopy(&str, &args); result->tftp_retries = scopy(&str, &args); + result->subnetmask = is_valid_ipv4_str(scopy(&str, &args)); if (*args) { result->addl_params = strdup(args); if (!result->addl_params) @@ -237,7 +238,12 @@ extract_vendor_options(struct bootp_packet *packet, struct boot_fspec_t *result) switch (tag) { case DHCP_NETMASK: - /* FIXME: do we need to grok the subnet mask? */ + if ((result->subnetmask == NULL || + *(result->subnetmask) == '\x0') && value != 0) { + result->subnetmask = ipv4_to_str(value); + DEBUG_F("Storing %s as subnetmask from options\n", + result->subnetmask); + } break; case DHCP_ROUTERS: if ((result->giaddr == NULL || *(result->giaddr) == '\x0') diff --git a/second/fs_of.c b/second/fs_of.c index f6b2050..17a4df3 100644 --- a/second/fs_of.c +++ b/second/fs_of.c @@ -176,6 +176,8 @@ of_net_open(struct boot_file_t* file, strcat(buffer, ","); strcat(buffer, fspec->tftp_retries); strcat(buffer, ","); + strcat(buffer, fspec->subnetmask); + strcat(buffer, ","); strcat(buffer, fspec->addl_params); } else { strcat(buffer, ",");