summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-25 20:02:03 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-25 20:02:03 +0200
commite2aa7c3a3919fc1498b80e2c7c575c6dbda972b6 (patch)
treea4c1aeab96ce4a18809544ad86489fe84d9233c8
parentb8f99e27e13658fd1e33c0e677f657514abc6538 (diff)
parent5215524dbe4d64ddbfdce52ca9d1b24b7d34dc5b (diff)
Merge pull request #3113 from ssahani/route-fix
netwotkd: fix address and route conf
-rw-r--r--src/network/networkd-address.c7
-rw-r--r--src/network/networkd-route.c6
2 files changed, 6 insertions, 7 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 7f9a7268cc..429319da6b 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -67,16 +67,15 @@ int address_new_static(Network *network, unsigned section, Address **ret) {
if (r < 0)
return r;
- address->network = network;
-
- LIST_APPEND(addresses, network->static_addresses, address);
-
if (section) {
address->section = section;
hashmap_put(network->addresses_by_section,
UINT_TO_PTR(address->section), address);
}
+ address->network = network;
+ LIST_APPEND(addresses, network->static_addresses, address);
+
*ret = address;
address = NULL;
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index ab9b777d9a..bda2707e6d 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -68,15 +68,15 @@ int route_new_static(Network *network, unsigned section, Route **ret) {
route->protocol = RTPROT_STATIC;
if (section) {
+ route->section = section;
+
r = hashmap_put(network->routes_by_section, UINT_TO_PTR(route->section), route);
if (r < 0)
return r;
-
- route->section = section;
}
- LIST_PREPEND(routes, network->static_routes, route);
route->network = network;
+ LIST_PREPEND(routes, network->static_routes, route);
*ret = route;
route = NULL;