diff mbox

[OpenWrt-Devel,netifd,6/6] interface-ip: Set route table when enabling interface ip settings

Message ID 1441806352-18030-6-git-send-email-dedeckeh@gmail.com
State Accepted
Headers show

Commit Message

Hans Dedecker Sept. 9, 2015, 1:45 p.m. UTC
Routes are now inserted in the correct routing table when interface ip4table and/or
ip6table was changed during interface_change_config

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
---
 interface-ip.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

diff --git a/interface-ip.c b/interface-ip.c
index d5f6aff..8eb2ff3 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -1234,6 +1234,15 @@  void interface_ip_set_enabled(struct interface_ip_settings *ip, bool enabled)
 			if (!(route->flags & DEVROUTE_METRIC))
 				route->metric = ip->iface->metric;
 
+			if (!(route->flags & DEVROUTE_TABLE)) {
+				route->flags &= ~DEVROUTE_SRCTABLE;
+				route->table = ((route->flags & DEVADDR_FAMILY) == DEVADDR_INET6) ?
+							iface->ip6table : iface->ip4table;
+
+				if (route->table)
+					route->flags |= DEVROUTE_SRCTABLE;
+			}
+
 			if (system_add_route(dev, route))
 				route->failed = true;
 		} else