diff options
author | Jeremy Katz <katzj@redhat.com> | 2004-11-07 18:42:36 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2004-11-07 18:42:36 +0000 |
commit | fb82da28126c2154f6808b35fc194cd4c3fc7622 (patch) | |
tree | 1ec97590710c945636cc508684d338f8a021e5b1 /loader2 | |
parent | 56d64386f065a68782af2a060379c67b2d7bee66 (diff) | |
download | anaconda-fb82da28126c2154f6808b35fc194cd4c3fc7622.tar.gz anaconda-fb82da28126c2154f6808b35fc194cd4c3fc7622.tar.xz anaconda-fb82da28126c2154f6808b35fc194cd4c3fc7622.zip |
2004-11-07 Jeremy Katz <katzj@redhat.com>
* loader2/loader.c (parseCmdLineIp): Add patch from Bastien Nocera
to support parsing of pxelinux IPAPPEND (#134054)
Diffstat (limited to 'loader2')
-rw-r--r-- | loader2/loader.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/loader2/loader.c b/loader2/loader.c index c737ef4b0..e62721932 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -456,6 +456,52 @@ static void readNetInfo(int flags, struct loaderData_s ** ld) { fclose(f); } +/* parse anaconda or pxelinux-style ip= arguments + * pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask> + * anaconda format: ip=<client-ip> netmask=<netmask> gateway=<gw-ip> +*/ +static void parseCmdLineIp(struct loaderData_s * loaderData, char *argv) +{ + /* Detect pxelinux */ + if (strstr(argv, ":") != NULL) { + char *start, *end; + + /* IP */ + start = argv + 3; + end = strstr(start, ":"); + loaderData->ip = strndup(start, end-start); + loaderData->ipinfo_set = 1; + + /* Boot server */ + if (end + 1 == '\0') + return; + start = end + 1; + end = strstr(start, ":"); + if (end == NULL) + return; + + /* Gateway */ + if (end + 1 == '\0') + return; + start = end + 1; + end = strstr(start, ":"); + if (end == NULL) { + loaderData->gateway = strdup (start); + return; + } else + loaderData->gateway = strndup(start, end-start); + + /* Netmask */ + if (end + 1 == '\0') + return; + start = end + 1; + loaderData->netmask = strdup(start); + } else { + loaderData->ip = strdup(argv + 3); + loaderData->ipinfo_set = 1; + } +} + /* parses /proc/cmdline for any arguments which are important to us. * NOTE: in test mode, can specify a cmdline with --cmdline */ @@ -567,8 +613,7 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData, } else if (!strncasecmp(argv[i], "method=", 7)) { setMethodFromCmdline(argv[i] + 7, loaderData); } else if (!strncasecmp(argv[i], "ip=", 3)) { - loaderData->ip = strdup(argv[i] + 3); - loaderData->ipinfo_set = 1; + parseCmdLineIp(loaderData, argv[i]); } else if (!strncasecmp(argv[i], "netmask=", 8)) loaderData->netmask = strdup(argv[i] + 8); else if (!strncasecmp(argv[i], "gateway=", 8)) |