interface-ip: Don't handle external addresses and routes
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 15 Feb 2016 17:59:22 +0000 (18:59 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 20 Feb 2016 12:28:40 +0000 (13:28 +0100)
Prevent external routes and address being added or deleted when changing
the state of the interface ip settings

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

index eb585f566dad962e4348d65d2fd2dff7931a58ad..26a28654bcecac86a839e69a17c09c3b2588965b 100644 (file)
@@ -1264,6 +1264,9 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled)
        vlist_for_each_element(&ip->addr, addr, node) {
                bool v6 = ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6) ? true : false;
 
+               if (addr->flags & DEVADDR_EXTERNAL)
+                       continue;
+
                if (addr->enabled == enabled)
                        continue;
 
@@ -1289,6 +1292,9 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled)
        vlist_for_each_element(&ip->route, route, node) {
                bool _enabled = enabled;
 
+               if (route->flags & DEVADDR_EXTERNAL)
+                       continue;
+
                if (!enable_route(ip, route))
                        _enabled = false;