diff mbox series

IPv6: RTM_GETROUTE: Add RTA_ENCAP to result

Message ID 20201115105527.GA11569@tws (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series IPv6: RTM_GETROUTE: Add RTA_ENCAP to result | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 85 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Oliver Herms Nov. 15, 2020, 10:55 a.m. UTC
This patch adds an IPv6 routes encapsulation attribute
to the result of netlink RTM_GETROUTE requests
(e.g. ip route get 2001:db8::).

Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
---
 net/ipv6/route.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jakub Kicinski Nov. 17, 2020, 1:46 a.m. UTC | #1
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::).
> 
> Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> ---
>  net/ipv6/route.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 82cbb46a2a4f..4d45696a70eb 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -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!
diff mbox series

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 82cbb46a2a4f..4d45696a70eb 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -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;