diff mbox series

[v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result

Message ID 20201118151436.GA420026@tws (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v3] 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 91 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. 18, 2020, 3:14 p.m. UTC
This patch adds an IPv6 routes encapsulation attribute
to the result of netlink RTM_GETROUTE requests
(i.e. ip route get 2001:db8::).

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

Comments

David Ahern Nov. 18, 2020, 8:19 p.m. UTC | #1
On 11/18/20 8:14 AM, Oliver Herms wrote:
> This patch adds an IPv6 routes encapsulation attribute
> to the result of netlink RTM_GETROUTE requests
> (i.e. ip route get 2001:db8::).
> 
> Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> ---
>  net/ipv6/route.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 7e0ce7af8234..64bda402357b 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5558,6 +5558,10 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
>  
>  		if (dst->dev && nla_put_u32(skb, RTA_OIF, dst->dev->ifindex))
>  			goto nla_put_failure;
> +
> +		if (dst && dst->lwtstate &&
> +		    lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
> +			goto nla_put_failure;
>  	} else if (rt->fib6_nsiblings) {
>  		struct fib6_info *sibling, *next_sibling;
>  		struct nlattr *mp;
> 

You forgot to remove the dst part of that. rt6 == dst so to be in this
branch dst != NULL.

Besides that nit that maybe Jakub will fixup before applying:

Reviewed-by: David Ahern <dsahern@kernel.org>
Oliver Herms Nov. 18, 2020, 11:08 p.m. UTC | #2
On 18.11.20 21:19, David Ahern wrote:
> 
> You forgot to remove the dst part of that. rt6 == dst so to be in this
> branch dst != NULL.
Damn. I've indeed overseen that one.
Just submitted version 4.

Thanks for guiding me through this!
diff mbox series

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7e0ce7af8234..64bda402357b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5558,6 +5558,10 @@  static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 
 		if (dst->dev && nla_put_u32(skb, RTA_OIF, dst->dev->ifindex))
 			goto nla_put_failure;
+
+		if (dst && dst->lwtstate &&
+		    lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
+			goto nla_put_failure;
 	} else if (rt->fib6_nsiblings) {
 		struct fib6_info *sibling, *next_sibling;
 		struct nlattr *mp;