Message ID | 20240731120955.23542-6-kerneljasonxing@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | tcp: completely support active reset | expand |
On Wed, Jul 31, 2024 at 2:10 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > From: Jason Xing <kernelxing@tencent.com> > > Whether user sets TCP_USER_TIMEOUT option or not, when we find there > is no left chance to proceed, we will send an RST to the other side. > Not sure why you mention TCP_USER_TIMEOUT here. > Signed-off-by: Jason Xing <kernelxing@tencent.com> > --- > v2 > Link: https://lore.kernel.org/all/CAL+tcoB-12pUS0adK8M_=C97aXewYYmDA6rJKLXvAXEHvEsWjA@mail.gmail.com/ > 1. correct the comment and changelog > --- > include/net/rstreason.h | 8 ++++++++ > net/ipv4/tcp_timer.c | 2 +- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/net/rstreason.h b/include/net/rstreason.h > index bbf20d0bbde7..739ad1db4212 100644 > --- a/include/net/rstreason.h > +++ b/include/net/rstreason.h > @@ -21,6 +21,7 @@ > FN(TCP_ABORT_ON_LINGER) \ > FN(TCP_ABORT_ON_MEMORY) \ > FN(TCP_STATE) \ > + FN(TCP_TIMEOUT) \ > FN(MPTCP_RST_EUNSPEC) \ > FN(MPTCP_RST_EMPTCP) \ > FN(MPTCP_RST_ERESOURCE) \ > @@ -108,6 +109,13 @@ enum sk_rst_reason { > * Please see RFC 9293 for all possible reset conditions > */ > SK_RST_REASON_TCP_STATE, > + /** > + * @SK_RST_REASON_TCP_TIMEOUT: time to timeout > + * Whether user sets TCP_USER_TIMEOUT options or not, when we > + * have already run out of all the chances, we have to reset the > + * connection > + */ > + SK_RST_REASON_TCP_TIMEOUT, > > /* Copy from include/uapi/linux/mptcp.h. > * These reset fields will not be changed since they adhere to > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c > index 3910f6d8614e..bd403300e4c4 100644 > --- a/net/ipv4/tcp_timer.c > +++ b/net/ipv4/tcp_timer.c > @@ -807,7 +807,7 @@ static void tcp_keepalive_timer (struct timer_list *t) > (user_timeout == 0 && > icsk->icsk_probes_out >= keepalive_probes(tp))) { > tcp_send_active_reset(sk, GFP_ATOMIC, > - SK_RST_REASON_NOT_SPECIFIED); > + SK_RST_REASON_TCP_TIMEOUT); > tcp_write_err(sk); > goto out; > } > -- > 2.37.3 > This is more about keepalive really. You should use a better name reflecting that it is a keepalive timeout.
Hello Eric, On Thu, Aug 1, 2024 at 2:58 PM Eric Dumazet <edumazet@google.com> wrote: > > On Wed, Jul 31, 2024 at 2:10 PM Jason Xing <kerneljasonxing@gmail.com> wrote: > > > > From: Jason Xing <kernelxing@tencent.com> > > > > Whether user sets TCP_USER_TIMEOUT option or not, when we find there > > is no left chance to proceed, we will send an RST to the other side. > > > > Not sure why you mention TCP_USER_TIMEOUT here. > > > Signed-off-by: Jason Xing <kernelxing@tencent.com> > > --- > > v2 > > Link: https://lore.kernel.org/all/CAL+tcoB-12pUS0adK8M_=C97aXewYYmDA6rJKLXvAXEHvEsWjA@mail.gmail.com/ > > 1. correct the comment and changelog > > --- > > include/net/rstreason.h | 8 ++++++++ > > net/ipv4/tcp_timer.c | 2 +- > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/include/net/rstreason.h b/include/net/rstreason.h > > index bbf20d0bbde7..739ad1db4212 100644 > > --- a/include/net/rstreason.h > > +++ b/include/net/rstreason.h > > @@ -21,6 +21,7 @@ > > FN(TCP_ABORT_ON_LINGER) \ > > FN(TCP_ABORT_ON_MEMORY) \ > > FN(TCP_STATE) \ > > + FN(TCP_TIMEOUT) \ > > FN(MPTCP_RST_EUNSPEC) \ > > FN(MPTCP_RST_EMPTCP) \ > > FN(MPTCP_RST_ERESOURCE) \ > > @@ -108,6 +109,13 @@ enum sk_rst_reason { > > * Please see RFC 9293 for all possible reset conditions > > */ > > SK_RST_REASON_TCP_STATE, > > + /** > > + * @SK_RST_REASON_TCP_TIMEOUT: time to timeout > > + * Whether user sets TCP_USER_TIMEOUT options or not, when we > > + * have already run out of all the chances, we have to reset the > > + * connection > > + */ > > + SK_RST_REASON_TCP_TIMEOUT, > > > > /* Copy from include/uapi/linux/mptcp.h. > > * These reset fields will not be changed since they adhere to > > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c > > index 3910f6d8614e..bd403300e4c4 100644 > > --- a/net/ipv4/tcp_timer.c > > +++ b/net/ipv4/tcp_timer.c > > @@ -807,7 +807,7 @@ static void tcp_keepalive_timer (struct timer_list *t) > > (user_timeout == 0 && > > icsk->icsk_probes_out >= keepalive_probes(tp))) { > > tcp_send_active_reset(sk, GFP_ATOMIC, > > - SK_RST_REASON_NOT_SPECIFIED); > > + SK_RST_REASON_TCP_TIMEOUT); > > tcp_write_err(sk); > > goto out; > > } > > -- > > 2.37.3 > > > > This is more about keepalive really. You should use a better name > reflecting that it is a keepalive timeout. I think you're right. Let me use 'TCP_KEEPALIVE_TIMEOUT' then. Thanks, Jason
diff --git a/include/net/rstreason.h b/include/net/rstreason.h index bbf20d0bbde7..739ad1db4212 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -21,6 +21,7 @@ FN(TCP_ABORT_ON_LINGER) \ FN(TCP_ABORT_ON_MEMORY) \ FN(TCP_STATE) \ + FN(TCP_TIMEOUT) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -108,6 +109,13 @@ enum sk_rst_reason { * Please see RFC 9293 for all possible reset conditions */ SK_RST_REASON_TCP_STATE, + /** + * @SK_RST_REASON_TCP_TIMEOUT: time to timeout + * Whether user sets TCP_USER_TIMEOUT options or not, when we + * have already run out of all the chances, we have to reset the + * connection + */ + SK_RST_REASON_TCP_TIMEOUT, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 3910f6d8614e..bd403300e4c4 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -807,7 +807,7 @@ static void tcp_keepalive_timer (struct timer_list *t) (user_timeout == 0 && icsk->icsk_probes_out >= keepalive_probes(tp))) { tcp_send_active_reset(sk, GFP_ATOMIC, - SK_RST_REASON_NOT_SPECIFIED); + SK_RST_REASON_TCP_TIMEOUT); tcp_write_err(sk); goto out; }