aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorOliver Herms <oliver.peter.herms@gmail.com>2020-11-13 09:55:17 +0100
committerJakub Kicinski <kuba@kernel.org>2020-11-14 16:06:36 -0800
commitae8cb93286e50ece1e45674661cbefcafe8b811c (patch)
tree6acf54101bc9d70753fb02a61aafe558b8c47aba /net
parentMerge branch 'ionic-updates' (diff)
downloadlinux-dev-ae8cb93286e50ece1e45674661cbefcafe8b811c.tar.xz
linux-dev-ae8cb93286e50ece1e45674661cbefcafe8b811c.zip
IPv4: RTM_GETROUTE: Add RTA_ENCAP to result
This patch adds an IPv4 routes encapsulation attribute to the result of netlink RTM_GETROUTE requests (e.g. ip route get 192.0.2.1). Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20201113085517.GA1307262@tws Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a3b60c41cbad..c962f0d96d8d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2872,6 +2872,9 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
if (rt->dst.dev &&
nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
goto nla_put_failure;
+ if (rt->dst.lwtstate &&
+ lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
+ goto nla_put_failure;
#ifdef CONFIG_IP_ROUTE_CLASSID
if (rt->dst.tclassid &&
nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid))