aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2021-06-23 10:07:48 +1000
committerDave Airlie <airlied@redhat.com>2021-06-23 10:07:48 +1000
commitf45fbbb6d5cff29ddfc708676ec1c2496eed3a07 (patch)
tree5496fee9f6b10da368aa49b03612061156e42d2f /net/ipv4/route.c
parentMerge tag 'amd-drm-next-5.14-2021-06-16' of https://gitlab.freedesktop.org/agd5f/linux into drm-next (diff)
parentLinux 5.13-rc7 (diff)
downloadlinux-dev-f45fbbb6d5cff29ddfc708676ec1c2496eed3a07.tar.xz
linux-dev-f45fbbb6d5cff29ddfc708676ec1c2496eed3a07.zip
Backmerge tag 'v5.13-rc7' into drm-next
Backmerge Linux 5.13-rc7 to make some pulls from later bases apply, and to bake in the conflicts so far.
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f6787c55f6ab..6a36ac98476f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2056,6 +2056,19 @@ martian_source:
return err;
}
+/* get device for dst_alloc with local routes */
+static struct net_device *ip_rt_get_dev(struct net *net,
+ const struct fib_result *res)
+{
+ struct fib_nh_common *nhc = res->fi ? res->nhc : NULL;
+ struct net_device *dev = NULL;
+
+ if (nhc)
+ dev = l3mdev_master_dev_rcu(nhc->nhc_dev);
+
+ return dev ? : net->loopback_dev;
+}
+
/*
* NOTE. We drop all the packets that has local source
* addresses, because every properly looped back packet
@@ -2212,7 +2225,7 @@ local_input:
}
}
- rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
+ rth = rt_dst_alloc(ip_rt_get_dev(net, res),
flags | RTCF_LOCAL, res->type,
IN_DEV_ORCONF(in_dev, NOPOLICY), false);
if (!rth)