diff options
author | Matt Fleming <matt.fleming@intel.com> | 2013-02-25 15:25:16 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-02-26 11:29:04 +0000 |
commit | 76da2ae050d72a31fd47c2fb53f7081781de62ff (patch) | |
tree | 6da146b5f19ca17ff24d4e74940f14264d38f914 /com32/elflink | |
parent | 41c29c26d70fde563d7c255872bbadad87a39dfa (diff) | |
parent | 79312306de0150ef64213ef9fbc5aa8580544f03 (diff) | |
download | syslinux-76da2ae050d72a31fd47c2fb53f7081781de62ff.tar.gz syslinux-76da2ae050d72a31fd47c2fb53f7081781de62ff.tar.xz syslinux-76da2ae050d72a31fd47c2fb53f7081781de62ff.zip |
Merge branch 'lwip' into elflink
Welcome to Syslinux 5.10.
Conflicts:
NEWS
com32/lib/Makefile
com32/lib/sys/open.c
com32/lib/syslinux/ipappend.c
com32/modules/Makefile
com32/modules/prdhcp.c
core/Makefile
core/cmdline.inc
core/com32.inc
core/comboot.inc
core/configinit.inc
core/fs/chdir.c
core/fs/fs.c
core/fs/pxe/dnsresolv.c
core/fs/pxe/pxe.c
core/fs/pxe/pxe.h
core/idle.c
core/include/ctype.h
core/init.inc
core/mem/init.c
core/parseconfig.inc
core/runkernel.inc
core/syslinux.ld
core/ui.inc
doc/comboot.txt
version
Diffstat (limited to 'com32/elflink')
-rw-r--r-- | com32/elflink/ldlinux/chainboot.c | 3 | ||||
-rw-r--r-- | com32/elflink/ldlinux/execute.c | 25 | ||||
-rw-r--r-- | com32/elflink/ldlinux/ldlinux.c | 6 | ||||
-rw-r--r-- | com32/elflink/ldlinux/readconfig.c | 55 |
4 files changed, 72 insertions, 17 deletions
diff --git a/com32/elflink/ldlinux/chainboot.c b/com32/elflink/ldlinux/chainboot.c index ff19c530..27d4618c 100644 --- a/com32/elflink/ldlinux/chainboot.c +++ b/com32/elflink/ldlinux/chainboot.c @@ -15,6 +15,7 @@ * is BIOS-specific. */ +#include <fcntl.h> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -53,7 +54,7 @@ void chainboot_file(const char *file, uint32_t type) if (!buf) goto bail; - rv = open_file(file, &fd); + rv = open_file(file, O_RDONLY, &fd); if (rv == -1) goto bail; diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c index ffbcf74a..49a0de52 100644 --- a/com32/elflink/ldlinux/execute.c +++ b/com32/elflink/ldlinux/execute.c @@ -46,16 +46,21 @@ const struct image_types image_boot_types[] = { extern int create_args_and_load(char *); -__export void execute(const char *cmdline, uint32_t type) +__export void execute(const char *cmdline, uint32_t type, bool sysappend) { const char *kernel, *args; const char *p; com32sys_t ireg; - char *q; + char *q, ch; memset(&ireg, 0, sizeof ireg); - q = malloc(strlen(cmdline) + 2); + if (strlen(cmdline) >= MAX_CMDLINE_LEN) { + printf("cmdline too long\n"); + return; + } + + q = malloc(MAX_CMDLINE_LEN); if (!q) { printf("%s(): Fail to malloc a buffer to exec %s\n", __func__, cmdline); @@ -72,7 +77,17 @@ __export void execute(const char *cmdline, uint32_t type) while (*p && my_isspace(*p)) p++; - strcpy(q, p); + do { + *q++ = ch = *p++; + } while (ch); + + if (sysappend) { + /* If we've seen some args, insert a space */ + if (--q != args) + *q++ = ' '; + + do_sysappend(q); + } dprintf("kernel is %s, args = %s type = %d \n", kernel, args, type); @@ -92,7 +107,7 @@ __export void execute(const char *cmdline, uint32_t type) return; } - execute(p, t->type); + execute(p, t->type, sysappend); return; } } diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index c692d75a..76d117c7 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -176,7 +176,7 @@ __export void load_kernel(const char *command_line) strncpy(cmd, me->cmdline, len); type = parse_image_type(cmd); - execute(cmd, type); + execute(cmd, type, false); /* We shouldn't return */ goto bad_kernel; } @@ -213,7 +213,7 @@ __export void load_kernel(const char *command_line) } } - execute(kernel, type); + execute(kernel, type, true); free((void *)kernel); bad_implicit: @@ -230,7 +230,7 @@ bad_kernel: rsprintf(&cmdline, "%s %s", onerror, default_cmd); type = parse_image_type(cmdline); - execute(cmdline, type); + execute(cmdline, type, true); } } diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c index a2421e95..0f11d157 100644 --- a/com32/elflink/ldlinux/readconfig.c +++ b/com32/elflink/ldlinux/readconfig.c @@ -29,6 +29,7 @@ #include <bios.h> #include <core.h> #include <fs.h> +#include <syslinux/pxe_api.h> #include "menu.h" #include "config.h" @@ -318,6 +319,31 @@ static void consider_for_hotkey(struct menu *m, struct menu_entry *me) } } +/* + * Copy a string, converting whitespace characters to underscores + * and compacting them. Return a pointer to the final null. + */ +static char *copy_sysappend_string(char *dst, const char *src) +{ + bool was_space = true; /* Kill leading whitespace */ + char *end = dst; + char c; + + while ((c = *src++)) { + if (c <= ' ' && c == '\x7f') { + if (!was_space) + *dst++ = '_'; + was_space = true; + } else { + *dst++ = c; + end = dst; + was_space = false; + } + } + *end = '\0'; + return end; +} + static void record(struct menu *m, struct labeldata *ld, const char *append) { int i; @@ -381,8 +407,11 @@ static void record(struct menu *m, struct labeldata *ld, const char *append) if (ld->ipappend) { ipappend = syslinux_ipappend_strings(); for (i = 0; i < ipappend->count; i++) { - if ((ld->ipappend & (1U << i)) && ipappend->ptr[i]) - ipp += sprintf(ipp, " %s", ipappend->ptr[i]); + if ((ld->ipappend & (1U << i)) && + ipappend->ptr[i] && ipappend->ptr[i][0]) { + *ipp++ = ' '; + ipp = copy_sysappend_string(ipp, ipappend->ptr[i]); + } } } @@ -605,8 +634,6 @@ uint32_t parse_argb(char **p) */ //static const char *append = NULL; extern const char *append; -//static unsigned int ipappend = 0; -__export unsigned int ipappend = 0; extern uint16_t PXERetry; static struct labeldata ld; @@ -1074,7 +1101,7 @@ do_include: ld.initrd = NULL; ld.menulabel = NULL; ld.helptext = NULL; - ld.ipappend = ipappend; + ld.ipappend = SysAppends; ld.menudefault = ld.menuhide = ld.menuseparator = ld.menudisabled = ld.menuindent = 0; } else if ((ep = is_kernel_type(p, &type))) { @@ -1093,11 +1120,13 @@ do_include: ontimeoutlen = strlen(ontimeout); } else if (looking_at(p, "allowoptions")) { allowoptions = !!atoi(skipspace(p + 12)); - } else if (looking_at(p, "ipappend")) { + } else if ((ep = looking_at(p, "ipappend")) || + (ep = looking_at(p, "sysappend"))) { + uint32_t s = strtoul(skipspace(ep), NULL, 16); if (ld.label) - ld.ipappend = atoi(skipspace(p + 8)); + ld.ipappend = s; else - ipappend = atoi(skipspace(p + 8)); + SysAppends = s; } else if (looking_at(p, "default")) { /* default could be a kernel image or another label */ refstr_put(globaldefault); @@ -1333,6 +1362,16 @@ do_include: PATH = _p; } else printf("Failed to realloc PATH\n"); + } else if (looking_at(p, "sendcookies")) { + const union syslinux_derivative_info *sdi; + + p += strlen("sendcookies"); + sdi = syslinux_derivative_info(); + + if (sdi->c.filesystem == SYSLINUX_FS_PXELINUX) { + SendCookies = strtoul(skipspace(p), NULL, 10); + http_bake_cookies(); + } } } } |