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

Hans Dedecker dedeckeh at gmail.com
Wed Sep 9 09:45:52 EDT 2015


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 at gmail.com>
---
 interface-ip.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list