summaryrefslogtreecommitdiffhomepage
path: root/interface-ip.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-11-12 01:16:11 +0100
committerFelix Fietkau <nbd@openwrt.org>2015-11-12 01:16:11 +0100
commitebd3d8417c7a08c03de2d38e8f43422428dd4094 (patch)
treeb71c992cff97ddb5f5ca29ba3d7d0b01de2fd35d /interface-ip.c
parent4902ba2999dec02e82066d70ab6096b852a33007 (diff)
interface: fix moving interface address routes to the table specified by ip[46]table
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'interface-ip.c')
-rw-r--r--interface-ip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/interface-ip.c b/interface-ip.c
index c4514b0..220f4a0 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -441,6 +441,7 @@ interface_handle_subnet_route(struct interface *iface, struct device_addr *addr,
{
struct device *dev = iface->l3_dev.dev;
struct device_route route;
+ bool v6 = ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6);
if (addr->flags & DEVADDR_OFFLINK)
return;
@@ -458,6 +459,9 @@ interface_handle_subnet_route(struct interface *iface, struct device_addr *addr,
route.flags &= ~DEVADDR_KERNEL;
route.metric = iface->metric;
+ route.table = (v6) ? iface->ip6table : iface->ip4table;
+ if (route.table)
+ route.flags |= DEVROUTE_SRCTABLE;
system_add_route(dev, &route);
} else {
system_del_route(dev, &route);
@@ -557,7 +561,7 @@ interface_update_proto_addr(struct vlist_tree *tree,
if (system_add_address(dev, a_new))
a_new->failed = true;
- if (iface->metric)
+ if (iface->metric || a_new->policy_table)
interface_handle_subnet_route(iface, a_new, true);
}