summaryrefslogtreecommitdiff
path: root/src/network/networkd-route.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-01-28 20:00:47 +0100
committerTom Gundersen <teg@jklm.no>2014-01-30 14:30:39 +0100
commit801bd9e859d7f3f127617172910786929776472b (patch)
tree5c0d67fdf25bb222bcbdc977db96a7fc1e1e21d9 /src/network/networkd-route.c
parenteb27aeca247a4cf8816fffc4c0dbcab55ead3864 (diff)
net-util: verify the address family
Error out if the address family is already set to something incompatible with the address being parsed.
Diffstat (limited to 'src/network/networkd-route.c')
-rw-r--r--src/network/networkd-route.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 83dad655db..29ee1045da 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -47,6 +47,8 @@ int route_new_static(Network *network, unsigned section, Route **ret) {
if (!route)
return -ENOMEM;
+ route->family = AF_UNSPEC;
+
route->network = network;
LIST_PREPEND(static_routes, network->static_routes, route);
@@ -69,6 +71,8 @@ int route_new_dynamic(Route **ret) {
if (!route)
return -ENOMEM;
+ route->family = AF_UNSPEC;
+
*ret = route;
route = NULL;
@@ -231,7 +235,7 @@ int config_parse_destination(const char *unit,
return log_oom();
}
- r = net_parse_inaddr(address, &n->dst_family, &n->dst_addr);
+ r = net_parse_inaddr(address, &n->family, &n->dst_addr);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
"Destination is invalid, ignoring assignment: %s", address);
@@ -252,7 +256,7 @@ int config_parse_destination(const char *unit,
n->dst_prefixlen = (unsigned char) i;
} else {
- switch (n->dst_family) {
+ switch (n->family) {
case AF_INET:
n->dst_prefixlen = 32;
break;