Subject: Re: [PATCH net-next 1/1] tcp: Remove useless acceptable check because the return vlaue always is 0

From: Jakub Kicinski <[email-masked]>
Date: Thu, 28 Jul 2022 19:50:03 -0700

On Wed, 27 Jul 2022 06:58:03 +0800 [email-masked] wrote:
> From: Gao Feng <[email-masked]>
> 
> The conn_request function of IPv4 and IPv6 always returns 0, so it's
> useless to check for acceptable.

I don't think this is an improvement. If the function returns 
a value we should not be ignoring it.

> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 3ec4edc37313..82a875efd1e8 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -6453,12 +6453,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
>  			 */
>  			rcu_read_lock();
>  			local_bh_disable();
> -			acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0;
> +			/* TCP's conn_request always returns 0. */
> +			icsk->icsk_af_ops->conn_request(sk, skb);
>  			local_bh_enable();
>  			rcu_read_unlock();
>  
> -			if (!acceptable)
> -				return 1;
>  			consume_skb(skb);
>  			return 0;
>  		}