All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result
@ 2020-11-18 15:14 Oliver Herms
  2020-11-18 20:19 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Herms @ 2020-11-18 15:14 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, davem, kuznet, yoshfuji, kuba

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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result
  2020-11-18 15:14 [PATCH v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result Oliver Herms
@ 2020-11-18 20:19 ` David Ahern
  2020-11-18 23:08   ` Oliver Herms
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-11-18 20:19 UTC (permalink / raw)
  To: Oliver Herms, netdev; +Cc: davem, kuznet, yoshfuji, kuba

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result
  2020-11-18 20:19 ` David Ahern
@ 2020-11-18 23:08   ` Oliver Herms
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Herms @ 2020-11-18 23:08 UTC (permalink / raw)
  To: David Ahern, netdev; +Cc: davem, kuznet, yoshfuji, kuba

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!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-18 23:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 15:14 [PATCH v3] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result Oliver Herms
2020-11-18 20:19 ` David Ahern
2020-11-18 23:08   ` Oliver Herms

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.