Message ID | 20240223102851.83749-8-kerneljasonxing@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | introduce drop reasons for tcp receive path | expand |
From: Jason Xing <kerneljasonxing@gmail.com> Date: Fri, 23 Feb 2024 18:28:48 +0800 > From: Jason Xing <kernelxing@tencent.com> > > This patch does two things: > 1) add two more new reasons > 2) only change the return value(1) to various drop reason values > for the future use > > For now, we still cannot trace those two reasons. We'll implement the full > function in the subsequent patch in this series. > > Signed-off-by: Jason Xing <kernelxing@tencent.com> > Reviewed-by: Eric Dumazet <edumazet@google.com> > Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> > -- > v9 > Link: https://lore.kernel.org/netdev/c5640fc4-16dc-4058-97c6-bd84bae4fda1@kernel.org/ > 1. add reviewed-by tag (David) > > v8 > Link: https://lore.kernel.org/netdev/CANn89i+EF77F5ZJbbkiDQgwgAqSKWtD3djUF807zQ=AswGvosQ@mail.gmail.com/ > 1. add reviewed-by tag (Eric) > --- > net/ipv4/tcp_input.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 74c03f0a6c0c..83308cca1610 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -6361,6 +6361,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, > inet_csk_reset_xmit_timer(sk, > ICSK_TIME_RETRANS, > TCP_TIMEOUT_MIN, TCP_RTO_MAX); > + SKB_DR_SET(reason, TCP_INVALID_ACK_SEQUENCE); > goto reset_and_undo; > } > > @@ -6369,6 +6370,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, > tcp_time_stamp_ts(tp))) { > NET_INC_STATS(sock_net(sk), > LINUX_MIB_PAWSACTIVEREJECTED); > + SKB_DR_SET(reason, TCP_RFC7323_PAWS); > goto reset_and_undo; > } > > @@ -6572,7 +6574,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, > reset_and_undo: > tcp_clear_options(&tp->rx_opt); > tp->rx_opt.mss_clamp = saved_clamp; > - return 1; > + /* we can reuse/return @reason to its caller to handle the exception */ > + return reason; > } > > static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) > -- > 2.37.3
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 74c03f0a6c0c..83308cca1610 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6361,6 +6361,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, TCP_TIMEOUT_MIN, TCP_RTO_MAX); + SKB_DR_SET(reason, TCP_INVALID_ACK_SEQUENCE); goto reset_and_undo; } @@ -6369,6 +6370,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, tcp_time_stamp_ts(tp))) { NET_INC_STATS(sock_net(sk), LINUX_MIB_PAWSACTIVEREJECTED); + SKB_DR_SET(reason, TCP_RFC7323_PAWS); goto reset_and_undo; } @@ -6572,7 +6574,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, reset_and_undo: tcp_clear_options(&tp->rx_opt); tp->rx_opt.mss_clamp = saved_clamp; - return 1; + /* we can reuse/return @reason to its caller to handle the exception */ + return reason; } static void tcp_rcv_synrecv_state_fastopen(struct sock *sk)