diff options
| author | Roy Marples <roy@marples.name> | 2012-12-20 19:35:26 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2012-12-20 19:35:26 +0000 |
| commit | 7c85e58ae54defadcf8f16caaef09e23fddfe129 (patch) | |
| tree | 828c9baab2c32dd769af8852005a9dff0eedaa67 | |
| parent | 7254c1235e3f0be68e83403b4bcb213d56359215 (diff) | |
| download | dhcpcd-7c85e58ae54defadcf8f16caaef09e23fddfe129.tar.xz | |
Preserve the space in static routes on the command line.
Thanks to br@waldteufel.eu.
| -rw-r--r-- | if-options.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/if-options.c b/if-options.c index 69d1a990..372ee24f 100644 --- a/if-options.c +++ b/if-options.c @@ -341,7 +341,7 @@ static int parse_option(struct if_options *ifo, int opt, const char *arg) { int i; - char *p = NULL, *np; + char *p = NULL, *fp, *np; ssize_t s; struct in_addr addr, addr2; struct rt *rt; @@ -654,7 +654,7 @@ parse_option(struct if_options *ifo, int opt, const char *arg) strncmp(arg, "classless_static_routes=", strlen("classless_static_routes=")) == 0 || strncmp(arg, "ms_classless_static_routes=", strlen("ms_classless_static_routes=")) == 0) { - np = strchr(p, ' '); + fp = np = strchr(p, ' '); if (np == NULL) { syslog(LOG_ERR, "all routes need a gateway"); return -1; @@ -674,7 +674,11 @@ parse_option(struct if_options *ifo, int opt, const char *arg) rt->next = NULL; if (parse_addr(&rt->dest, &rt->net, p) == -1 || parse_addr(&rt->gate, NULL, np) == -1) + { + *fp = ' '; return -1; + } + *fp = ' '; } else if (strncmp(arg, "routers=", strlen("routers=")) == 0) { if (ifo->routes == NULL) { rt = ifo->routes = xzalloc(sizeof(*rt)); |
