[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[master] loader: parseCmdLineIp* takes just the value as an argument now.



Also see 8f0ffbce8df1e05cd63ffd67e1057cb870ef96ad.
---
 loader/loader.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 760c352..f2ec285 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -821,17 +821,16 @@ static void readNetInfo(struct loaderData_s ** ld) {
 */
 static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
 {
+    char *start, *end;
+    /* if there's "ip=" at the beginning, jump past it */
+    if (!strncmp(argv, "ip=", 3)) {
+        start = argv + 3;
+    } else {
+        start = argv;
+    }
+
     /* Detect pxelinux */
     if (strstr(argv, ":") != NULL) {
-        char *start, *end;
-
-        /* IP */
-        if (!strncmp(argv, "ip=", 3)) {
-            start = argv + 3;
-        } else {
-            start = argv;
-        }
-
         end = strstr(start, ":");
         loaderData->ipv4 = strndup(start, end-start);
         loaderData->ipinfo_set = 1;
@@ -862,7 +861,7 @@ static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
         start = end + 1;
         loaderData->netmask = strdup(start);
     } else {
-        loaderData->ipv4 = strdup(argv + 3);
+        loaderData->ipv4 = strdup(start);
         loaderData->ipinfo_set = 1;
     }
 
@@ -876,15 +875,23 @@ static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv)
  */
 static void parseCmdLineIpv6(struct loaderData_s * loaderData, char *argv)
 {
+    char *start;
+    /* if there's "ip=" at the beginning, jump past it */
+    if (!strncmp(argv, "ip=", 3)) {
+        start = argv + 3;
+    } else {
+        start = argv;
+    }
+
     /* right now we only accept ipv6= arguments equal to:
      *     dhcp     DHCPv6 call
      *     auto     RFC 2461 neighbor discovery
      */
     loaderData->ipv6 = NULL;
 
-    if (!strncasecmp(argv, "ipv6=dhcp", 9)) {
+    if (!strncasecmp(start, "dhcp", 4)) {
         loaderData->ipv6 = strdup("dhcp");
-    } else if (!strncasecmp(argv, "ipv6=auto", 9)) {
+    } else if (!strncasecmp(start, "auto", 4)) {
         loaderData->ipv6 = strdup("auto");
     }
 
@@ -892,8 +899,6 @@ static void parseCmdLineIpv6(struct loaderData_s * loaderData, char *argv)
         loaderData->ipv6info_set = 1;
         flags |= LOADER_FLAGS_IPV6_PARAM;
     }
-
-    return;
 }
 #endif
 
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]