diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2014-10-23 11:12:54 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-10-24 19:54:26 +0200 |
commit | 248ec27b62439662f28deab08adb9ee4e906f3b6 (patch) | |
tree | 07ad38e65ea24d05ece889f9c45c6ab34bd49cb2 /interface-ip.c | |
parent | e7135f6114a1146af46f13b6cad03106f78e2e7f (diff) |
netifd : Apply interface metric on subnet routes when reloading ip
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'interface-ip.c')
-rw-r--r-- | interface-ip.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/interface-ip.c b/interface-ip.c index 62d15fd..6659f8b 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -1154,9 +1154,11 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled) struct device_addr *addr; struct device_route *route; struct device *dev; + struct interface *iface; ip->enabled = enabled; - dev = ip->iface->l3_dev.dev; + iface = ip->iface; + dev = iface->l3_dev.dev; if (!dev) return; @@ -1164,10 +1166,14 @@ void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled) if (addr->enabled == enabled) continue; - if (enabled) + if (enabled) { system_add_address(dev, addr); - else + if ((addr->flags & DEVADDR_OFFLINK) || iface->metric) + interface_handle_subnet_route(iface, addr, true); + } else { + interface_handle_subnet_route(iface, addr, false); system_del_address(dev, addr); + } addr->enabled = enabled; } |