[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a08932fe-789d-3b38-3d92-e00225a8cf9f@gmail.com>
Date: Mon, 21 Jun 2021 19:23:45 -0600
From: David Ahern <dsahern@...il.com>
To: Wang Shanker <shankerwangmiao@...il.com>, netdev@...r.kernel.org
Cc: Roopa Prabhu <roopa@...ulusnetworks.com>
Subject: Re: [PATCH] net/ipv4: swap flow ports when validating source
On 6/21/21 9:17 AM, Wang Shanker wrote:
> When doing source address validation, the flowi4 struct used for
> fib_lookup should be in the reverse direction to the given skb.
> fl4_dport and fl4_sport returned by fib4_rules_early_flow_dissect
> should thus be swapped.
>
> Fixes: 5a847a6 ("net/ipv4: Initialize proto and ports in flow struct")
I believe the hash should be 12 chars: 5a847a6e1477
> Signed-off-by: Miao Wang <shankerwangmiao@...il.com>
> ---
> net/ipv4/fib_frontend.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index 84bb707bd88d..647bceab56c2 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -371,6 +371,8 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
> fl4.flowi4_proto = 0;
> fl4.fl4_sport = 0;
> fl4.fl4_dport = 0;
> + } else {
> + swap(fl4.fl4_sport, fl4.fl4_dport);
> }
>
> if (fib_lookup(net, &fl4, &res, 0))
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists