netifd: Set prefix assignment enabled if the prefix adress can be installed
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 24 Apr 2014 07:51:16 +0000 (07:51 +0000)
committerSteven Barth <steven@midlink.org>
Thu, 24 Apr 2014 09:13:40 +0000 (11:13 +0200)
No need to install policy routes if the prefix address cannot be installed; clean up of the policy routes
and the prefix address only needs to happen when the prefix assignment was active.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
interface-ip.c

index 6f42015..b000725 100644 (file)
@@ -661,8 +661,8 @@ interface_set_prefix_address(struct device_prefix_assignment *assignment,
                }
 
                assignment->enabled = false;
-       } else if (add && (iface->state == IFS_UP || iface->state == IFS_SETUP)) {
-               system_add_address(l3_downlink, &addr);
+       } else if (add && (iface->state == IFS_UP || iface->state == IFS_SETUP) &&
+                       !system_add_address(l3_downlink, &addr)) {
                if (prefix->iface && !assignment->enabled) {
                        set_ip_source_policy(true, true, IPRULE_PRIORITY_REJECT, &addr.addr,
                                        addr.mask, 0, iface, "unreachable");