summaryrefslogtreecommitdiffhomepage
path: root/interface-ip.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-02-26 14:21:48 +0100
committerSteven Barth <steven@midlink.org>2014-02-26 14:21:48 +0100
commit4d09244bc73a3b8bc8168366526e4ddded41057e (patch)
tree484a98a93780e593f529124448589a88ca931b38 /interface-ip.c
parent9bf007985b20cb65147d8fd8ff59a6eb65ed22b8 (diff)
Don't always assume routes & addresses are applied
Actually check netlink return values and remember failure. Signed-off-by: Steven Barth <steven@midlink.org>
Diffstat (limited to 'interface-ip.c')
-rw-r--r--interface-ip.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 3bd92cf..b1abbc6 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -480,7 +480,7 @@ interface_update_proto_addr(struct vlist_tree *tree,
if (a_new && a_old) {
keep = true;
- if (a_old->flags != a_new->flags)
+ if (a_old->flags != a_new->flags || a_old->failed)
keep = false;
if (a_old->valid_until != a_new->valid_until ||
@@ -521,7 +521,8 @@ interface_update_proto_addr(struct vlist_tree *tree,
if (node_new) {
a_new->enabled = true;
if (!(a_new->flags & DEVADDR_EXTERNAL) && (!keep || replace)) {
- system_add_address(dev, a_new);
+ if (system_add_address(dev, a_new))
+ a_new->failed = true;
if (!keep) {
if ((a_new->flags & DEVADDR_FAMILY) == DEVADDR_INET6)
@@ -575,7 +576,7 @@ interface_update_proto_route(struct vlist_tree *tree,
if (node_old && node_new)
keep = !memcmp(&route_old->nexthop, &route_new->nexthop, sizeof(route_old->nexthop)) &&
- (route_old->table == route_new->table);
+ (route_old->table == route_new->table) && !route_old->failed;
if (node_old) {
if (!(route_old->flags & DEVADDR_EXTERNAL) && route_old->enabled && !keep)
@@ -591,7 +592,8 @@ interface_update_proto_route(struct vlist_tree *tree,
route_new->metric = iface->metric;
if (!(route_new->flags & DEVADDR_EXTERNAL) && !keep && _enabled)
- system_add_route(dev, route_new);
+ if (system_add_route(dev, route_new))
+ route_new->failed = true;
route_new->iface = iface;
route_new->enabled = _enabled;