changeset 1819:b38e1684dd67 draft

Preserve the space in static routes on the command line.
author Roy Marples <roy@marples.name>
date Thu, 20 Dec 2012 19:35:57 +0000
parents 878908ac909f
children e2af3d76a784
files if-options.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/if-options.c	Wed Dec 19 10:11:50 2012 +0000
+++ b/if-options.c	Thu Dec 20 19:35:57 2012 +0000
@@ -362,7 +362,7 @@
 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;
@@ -686,7 +686,7 @@
 		    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;
@@ -706,7 +706,11 @@
 			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));