summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2016-09-10 19:09:54 (GMT)
committerDavid S. Miller <davem@davemloft.net>2016-09-11 06:12:52 (GMT)
commit5f02ce24c2696fec33f2a5dfcf753996f5fdd211 (patch)
tree123e0a2518f4a18e5d0b59c6e3442c5f355b23f5 /net/ipv6
parenta8e3e1a9f02094145580ea7920c6a1d9aabd5539 (diff)
downloadlinux-5f02ce24c2696fec33f2a5dfcf753996f5fdd211.tar.xz
net: l3mdev: Allow the l3mdev to be a loopback
Allow an L3 master device to act as the loopback for that L3 domain. For IPv4 the device can also have the address 127.0.0.1. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/route.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 09d43ff..2c68111 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2558,8 +2558,16 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
{
u32 tb_id;
struct net *net = dev_net(idev->dev);
- struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev,
- DST_NOCOUNT);
+ struct net_device *dev = net->loopback_dev;
+ struct rt6_info *rt;
+
+ /* use L3 Master device as loopback for host routes if device
+ * is enslaved and address is not link local or multicast
+ */
+ if (!rt6_need_strict(addr))
+ dev = l3mdev_master_dev_rcu(idev->dev) ? : dev;
+
+ rt = ip6_dst_alloc(net, dev, DST_NOCOUNT);
if (!rt)
return ERR_PTR(-ENOMEM);