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:
8495bc0
)
Fix source-restrictions of routes when no mask was provided
author
Steven Barth
<steven@midlink.org>
Fri, 14 Feb 2014 20:09:05 +0000
(21:09 +0100)
committer
Steven Barth
<steven@midlink.org>
Fri, 14 Feb 2014 20:09:05 +0000
(21:09 +0100)
interface-ip.c
patch
|
blob
|
history
diff --git
a/interface-ip.c
b/interface-ip.c
index 59cf82809cdffcb9ff98ef6a9720f723bc1b59ee..fed7d725c7c37b7b9742aa3300c81c3729747966 100644
(file)
--- a/
interface-ip.c
+++ b/
interface-ip.c
@@
-337,12
+337,12
@@
interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6)
const char *addr = strtok_r(source, "/", &saveptr);
const char *mask = strtok_r(NULL, "/", &saveptr);
- if (inet_pton(af, addr, &route->source) < 1) {
+ if (
!addr ||
inet_pton(af, addr, &route->source) < 1) {
DPRINTF("Failed to parse route source: %s\n", addr);
goto error;
}
- route->sourcemask =
atoi(mask
);
+ route->sourcemask =
(mask) ? atoi(mask) : ((af == AF_INET6) ? 128 : 32
);
}
if (is_proto_route) {