projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
24f5ed4
)
IPv6: Use key=val format for prefix options
author
Steven Barth
<steven@midlink.org>
Wed, 8 May 2013 14:47:55 +0000
(16:47 +0200)
committer
Steven Barth
<steven@midlink.org>
Wed, 8 May 2013 14:47:55 +0000
(16:47 +0200)
proto.c
patch
|
blob
|
history
diff --git
a/proto.c
b/proto.c
index
634d31b
..
83c6345
100644
(file)
--- a/
proto.c
+++ b/
proto.c
@@
-274,7
+274,7
@@
parse_prefix_option(struct interface *iface, const char *str, size_t len)
char *prefstr = strtok_r(NULL, ",", &saveptr);
char *validstr = (!prefstr) ? NULL : strtok_r(NULL, ",", &saveptr);
char *prefstr = strtok_r(NULL, ",", &saveptr);
char *validstr = (!prefstr) ? NULL : strtok_r(NULL, ",", &saveptr);
- char *
exclude
str = (!validstr) ? NULL : strtok_r(NULL, ",", &saveptr);
+ char *
add
str = (!validstr) ? NULL : strtok_r(NULL, ",", &saveptr);
uint32_t pref = (!prefstr) ? 0 : strtoul(prefstr, NULL, 10);
uint32_t valid = (!validstr) ? 0 : strtoul(validstr, NULL, 10);
uint32_t pref = (!prefstr) ? 0 : strtoul(prefstr, NULL, 10);
uint32_t valid = (!validstr) ? 0 : strtoul(validstr, NULL, 10);
@@
-287,20
+287,31
@@
parse_prefix_option(struct interface *iface, const char *str, size_t len)
if (inet_pton(AF_INET6, addrstr, &addr) < 1)
return false;
if (inet_pton(AF_INET6, addrstr, &addr) < 1)
return false;
- if (excludestr) {
- char *sep = strchr(excludestr, '/');
- if (!sep)
- return false;
+ for (; addstr; addstr = strtok_r(NULL, ",", &saveptr)) {
+ char *key = NULL, *val = NULL, *addsaveptr;
+ if (!(key = strtok_r(addstr, "=", &addsaveptr)) ||
+ !(val = strtok_r(NULL, ",", &addsaveptr)))
+ continue;
- *sep = 0;
- excl_length = atoi(sep + 1);
+ if (!strcmp(key, "excluded")) {
+ char *sep = strchr(val, '/');
+ if (!sep)
+ return false;
- if (inet_pton(AF_INET6, excludestr, &excluded) < 1)
- return false;
+ *sep = 0;
+ excl_length = atoi(sep + 1);
+
+ if (inet_pton(AF_INET6, val, &excluded) < 1)
+ return false;
+
+ excludedp = &excluded;
+ }
- excludedp = &excluded;
}
}
+
+
+
time_t now = system_get_rtime();
time_t preferred_until = 0;
if (prefstr && pref != 0xffffffffU)
time_t now = system_get_rtime();
time_t preferred_until = 0;
if (prefstr && pref != 0xffffffffU)