diff mbox series

[v4] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result

Message ID 20201118230651.GA8861@tws
State Superseded
Headers show
Series [v4] IPv6: RTM_GETROUTE: Add RTA_ENCAP to result | expand

Commit Message

Oliver Herms Nov. 18, 2020, 11:06 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. 19, 2020, 12:29 a.m. UTC | #1
On 11/18/20 4:06 PM, 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(+)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Nov. 20, 2020, 5:57 a.m. UTC | #2
On Wed, 18 Nov 2020 17:29:52 -0700 David Ahern wrote:
> On 11/18/20 4:06 PM, 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(+)
> >   
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Applied, thanks!
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->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;