mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>, davem@davemloft.net
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, kuba@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ahmed.abdelsalam@gssi.it, david.lebrun@uclouvain.be,
	dav.lebrun@gmail.com, andrea.mayer@uniroma2.it,
	paolo.lungaroni@cnit.it
Subject: Re: [net-next 1/2] Perform IPv4 FIB lookup in a predefined FIB table
Date: Sat, 15 Feb 2020 11:06:43 -0700	[thread overview]
Message-ID: <7302c1f7-b6d1-90b7-5df1-3e5e0ba98f53@gmail.com> (raw)
In-Reply-To: <20200213010932.11817-2-carmine.scarpitta@uniroma2.it>

On 2/12/20 6:09 PM, Carmine Scarpitta wrote:
> In IPv4, the routing subsystem is invoked by calling ip_route_input_rcu()
> which performs the recognition logic and calls ip_route_input_slow().
> 
> ip_route_input_slow() initialises both "fi" and "table" members
> of the fib_result structure to null before calling fib_lookup().
> 
> fib_lookup() performs fib lookup in the routing table configured
> by the policy routing rules.
> 
> In this patch, we allow invoking the ip4 routing subsystem
> with known routing table. This is useful for use-cases implementing
> a separate routing table per tenant.
> 
> The patch introduces a new flag named "tbl_known" to the definition of
> ip_route_input_rcu() and ip_route_input_slow().
> 
> When the flag is set, ip_route_input_slow() will call fib_table_lookup()
> using the defined table instead of using fib_lookup().

I do not like this change. If you want a specific table lookup, then why
just call fib_table_lookup directly? Both it and rt_dst_alloc are
exported for modules. Your next patch already does a fib table lookup.


> 
> Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
> Acked-by: Ahmed Abdelsalam <ahmed.abdelsalam@gssi.it>
> Acked-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> Acked-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
> ---
>  include/net/route.h |  2 +-
>  net/ipv4/route.c    | 22 ++++++++++++++--------
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/include/net/route.h b/include/net/route.h
> index a9c60fc68e36..4ff977bd7029 100644
> --- a/include/net/route.h
> +++ b/include/net/route.h
> @@ -183,7 +183,7 @@ int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
>  			 u8 tos, struct net_device *devin);
>  int ip_route_input_rcu(struct sk_buff *skb, __be32 dst, __be32 src,
>  		       u8 tos, struct net_device *devin,
> -		       struct fib_result *res);
> +		       struct fib_result *res, bool tbl_known);
>  
>  int ip_route_use_hint(struct sk_buff *skb, __be32 dst, __be32 src,
>  		      u8 tos, struct net_device *devin,
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index d5c57b3f77d5..39cec9883d6f 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2077,7 +2077,7 @@ int ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
>  
>  static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
>  			       u8 tos, struct net_device *dev,
> -			       struct fib_result *res)
> +			       struct fib_result *res, bool tbl_known)
>  {
>  	struct in_device *in_dev = __in_dev_get_rcu(dev);
>  	struct flow_keys *flkeys = NULL, _flkeys;
> @@ -2109,8 +2109,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
>  	if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr))
>  		goto martian_source;
>  
> -	res->fi = NULL;
> -	res->table = NULL;
>  	if (ipv4_is_lbcast(daddr) || (saddr == 0 && daddr == 0))
>  		goto brd_input;

I believe this also introduces a potential bug. You remove the fi
initialization yet do not cover the goto case.



  reply	other threads:[~2020-02-15 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  1:09 [net-next 0/2] Add support for SRv6 End.DT4 action Carmine Scarpitta
2020-02-13  1:09 ` [net-next 1/2] Perform IPv4 FIB lookup in a predefined FIB table Carmine Scarpitta
2020-02-15 18:06   ` David Ahern [this message]
2020-02-18 23:50     ` Carmine Scarpitta
2020-02-19  1:05       ` David Ahern
2020-02-19  2:49         ` Carmine Scarpitta
2020-02-19  4:29           ` David Ahern
2020-02-20 22:33             ` Carmine Scarpitta
2020-02-21 17:31               ` David Ahern
2020-03-06 16:45             ` Ahmed Abdelsalam
2020-03-09 15:36               ` David Ahern
2020-03-10 16:26                 ` Ahmed Abdelsalam
2020-02-13  1:09 ` [net-next 2/2] Add support for SRv6 End.DT4 action Carmine Scarpitta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7302c1f7-b6d1-90b7-5df1-3e5e0ba98f53@gmail.com \
    --to=dsahern@gmail.com \
    --cc=ahmed.abdelsalam@gssi.it \
    --cc=andrea.mayer@uniroma2.it \
    --cc=carmine.scarpitta@uniroma2.it \
    --cc=dav.lebrun@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.lebrun@uclouvain.be \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paolo.lungaroni@cnit.it \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®