]> git.ozlabs.org Git - yaboot.git/commitdiff
Parse the subnetmask from bootpath and DHCP options
authorTony Breeds <tony@bakeyournoodle.com>
Thu, 22 Oct 2009 04:46:37 +0000 (15:46 +1100)
committerTony Breeds <tony@bakeyournoodle.com>
Thu, 22 Oct 2009 05:15:34 +0000 (16:15 +1100)
Some power6 machines need to have the subnetmask to correctly open()
the network device.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
include/file.h
second/file.c
second/fs_of.c

index ca76a52238559f62028a60abc290f2fa3acd00ee..cff6cbb646511ae23e037701a17509fb5b5c7d41 100644 (file)
@@ -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 */
 };
 
index 6b997b0589b0506155088d25d809eca41e02781b..aad1ba466e91d30fe040793eba843484313b35a0 100644 (file)
@@ -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')
index f6b2050da4731aa5fb8c9766c02f47357091a621..17a4df3517bea60a6dbe45500df6e3610d38f7f2 100644 (file)
@@ -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, ",");