Skip to contentSkip to conversation

IPv6: RTM_GETROUTE: Add RTA_ENCAP to result

PATCH Superseded Oliver Herms 2 participants 2 messages Nov 15, 2020 – Nov 17, 2020

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IPv6: RTM_GETROUTE: Add RTA_ENCAP to result

This patch adds an IPv6 routes encapsulation attribute to the result of netlink RTM_GETROUTE requests (e.g. ip route get 2001:db8::).

---
 net/ipv6/route.c | 5 +++++
 1 file changed, 5 insertions(+)
net/ipv6/route.c +5 -0
index 82cbb46a2a4f..4d45696a70eb 100644
@@ -5489,6 +5489,11 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 	rtm->rtm_scope = RT_SCOPE_UNIVERSE;
 	rtm->rtm_protocol = rt->fib6_protocol;
 
+	if (dst && dst->lwtstate &&
+	    lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0) {
+		goto nla_put_failure;
+	}
+
 	if (rt6_flags & RTF_CACHE)
 		rtm->rtm_flags |= RTM_F_CLONED;
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 14 lines · On Sun, 15 Nov 2020 11:55:27 +0100 Oliver Herms wrote:

This patch adds an IPv6 routes encapsulation attribute to the result of netlink RTM_GETROUTE requests (e.g. ip route get 2001:db8::).

---
 net/ipv6/route.c | 5 +++++
 1 file changed, 5 insertions(+)
net/ipv6/route.c +0 -0
index 82cbb46a2a4f..4d45696a70eb 100644

net/ipv6/route.c static int rt6_fill_node(struct net *net, struct sk_buff *skb, · line 5495

Quoted 7 lines
net/ipv6/route.c +4 -0
@@ -5489,6 +5489,11 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 	rtm->rtm_scope = RT_SCOPE_UNIVERSE;
 	rtm->rtm_protocol = rt->fib6_protocol;
 
+	if (dst && dst->lwtstate &&
+	    lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0) {
+		goto nla_put_failure;
+	}

curly brackets are not required around a single statement

Please fix and CC David Ahern, since he reviewed your corresponding IPv4 patch.

Thanks!