diff mbox series

[v2] IPv4: RTM_GETROUTE: Add RTA_ENCAP to result

Message ID 20201113085517.GA1307262@tws (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [v2] IPv4: 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: 5 this patch: 5
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 86 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Oliver Herms Nov. 13, 2020, 8:55 a.m. UTC
This patch adds an IPv4 routes encapsulation attribute
to the result of netlink RTM_GETROUTE requests
(e.g. ip route get 192.0.2.1).

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

Comments

David Ahern Nov. 13, 2020, 4:44 p.m. UTC | #1
On 11/13/20 1:55 AM, Oliver Herms wrote:
> This patch adds an IPv4 routes encapsulation attribute
> to the result of netlink RTM_GETROUTE requests
> (e.g. ip route get 192.0.2.1).
> 
> Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> ---
>  net/ipv4/route.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 1d7076b78e63..0fbb4adee3d4 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2860,6 +2860,9 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
>  	if (rt->dst.dev &&
>  	    nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
>  		goto nla_put_failure;
> +	if (rt->dst.lwtstate &&
> +	    lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
> +		goto nla_put_failure;
>  #ifdef CONFIG_IP_ROUTE_CLASSID
>  	if (rt->dst.tclassid &&
>  	    nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid))
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Nov. 15, 2020, 12:07 a.m. UTC | #2
On Fri, 13 Nov 2020 09:44:38 -0700 David Ahern wrote:
> On 11/13/20 1:55 AM, Oliver Herms wrote:
> > This patch adds an IPv4 routes encapsulation attribute
> > to the result of netlink RTM_GETROUTE requests
> > (e.g. ip route get 192.0.2.1).
> > 
> > Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Applied, thanks!
diff mbox series

Patch

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1d7076b78e63..0fbb4adee3d4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2860,6 +2860,9 @@  static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
 	if (rt->dst.dev &&
 	    nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
 		goto nla_put_failure;
+	if (rt->dst.lwtstate &&
+	    lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
+		goto nla_put_failure;
 #ifdef CONFIG_IP_ROUTE_CLASSID
 	if (rt->dst.tclassid &&
 	    nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid))