netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <kerneljasonxing@gmail.com>
Cc: <davem@davemloft.net>, <dsahern@kernel.org>,
	<edumazet@google.com>, <kernelxing@tencent.com>,
	<kuba@kernel.org>, <kuniyu@amazon.com>, <netdev@vger.kernel.org>,
	<pabeni@redhat.com>
Subject: Re: [PATCH net-next v3 3/6] tcp: add dropreasons in tcp_rcv_state_process()
Date: Mon, 12 Feb 2024 20:06:58 -0800	[thread overview]
Message-ID: <20240213040658.86261-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CAL+tcoAWURoNQEq-WckGs6eVQX6VFpHtw4CC9u4Nc7ab0aD+oA@mail.gmail.com>

From: Jason Xing <kerneljasonxing@gmail.com>
Date: Tue, 13 Feb 2024 09:48:04 +0800
> On Mon, Feb 12, 2024 at 11:33 PM Eric Dumazet <edumazet@google.com> wrote:
> >
> > On Mon, Feb 12, 2024 at 10:29 AM Jason Xing <kerneljasonxing@gmail.com> wrote:
> > >
> > > From: Jason Xing <kernelxing@tencent.com>
> >
> >
> > >                         if (!acceptable)
> > > -                               return 1;
> > > +                               /* This reason isn't clear. We can refine it in the future */
> > > +                               return SKB_DROP_REASON_TCP_CONNREQNOTACCEPTABLE;
> >
> > tcp_conn_request() might return 0 when a syncookie has been generated.
> >
> > Technically speaking, the incoming SYN was not dropped :)
> 
> Hi Eric, Kuniyuki
> 
> Sorry, I should have checked tcp_conn_request() carefully last night.
> Today, I checked tcp_conn_request() over and over again.
> 
> I didn't find there is any chance to return a negative/positive value,
> only 0. It means @acceptable is always true and it should never return
> TCP_CONNREQNOTACCEPTABLE for TCP ipv4/6 protocol and never trigger a
> reset in this way.

Ah right, I remember I digged the same thing before and even in the
initial commit, conn_request() always returned 0 and tcp_rcv_state_process()
tested it with if (retval < 0).

I think we can clean up the leftover with some comments above
->conn_request() definition so that we can convert it to void
when we deprecate DCCP in the near future.


> 
> For DCCP, there are chances to return -1 in dccp_v4_conn_request().
> But I don't think we've already added drop reasons in DCCP before.
> 
> If I understand correctly, there is no need to do any refinement or
> even introduce TCP_CONNREQNOTACCEPTABLE new dropreason about the
> .conn_request() for TCP.
> 
> Should I add a NEW kfree_skb_reason() in tcp_conn_request() for those
> labels, like drop_and_release, drop_and_free, drop, and not return a
> drop reason to its caller tcp_rcv_state_process()?

Most interested reasons will be covered by

  - reqsk q : net_info_ratelimited() in tcp_syn_flood_action() or
              net_dbg_ratelimited() in pr_drop_req() or
              __NET_INC_STATS(net, LINUX_MIB_LISTENDROPS) in tcp_listendrop()
  - accept q: NET_INC_STATS(net, LINUX_MIB_LISTENOVERFLOWS) or
              __NET_INC_STATS(net, LINUX_MIB_LISTENDROPS) in tcp_listendrop()

and could be refined by drop reason, but I'm not sure if drop reason
is used under such a pressured situation.

Also, these failures are now treated with consume_skb().

Whichever is fine to me, no strong preference.


> 
> Please correct me if I'm wrong...
> 
> Thanks,
> Jason
> 
> >
> > I think you need to have a patch to change tcp_conn_request() and its
> > friends to return a 'refined' drop_reason
> > to avoid future questions / patches.

  reply	other threads:[~2024-02-13  4:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  9:28 [PATCH net-next v3 0/6] introduce dropreasons in tcp receive path Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 1/6] tcp: introduce another three dropreasons in " Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 2/6] tcp: add more specific possible drop reasons in tcp_rcv_synsent_state_process() Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 3/6] tcp: add dropreasons in tcp_rcv_state_process() Jason Xing
2024-02-12 15:32   ` Eric Dumazet
2024-02-12 15:52     ` Jason Xing
2024-02-12 16:19       ` Eric Dumazet
2024-02-12 23:44         ` Jason Xing
2024-02-13  1:48     ` Jason Xing
2024-02-13  4:06       ` Kuniyuki Iwashima [this message]
2024-02-13  6:36         ` Jason Xing
2024-02-13  9:35       ` Eric Dumazet
2024-02-13 10:29         ` Jason Xing
2024-02-13 12:03           ` Eric Dumazet
2024-02-13 12:38             ` Jason Xing
2024-02-13 12:58               ` Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 4/6] tcp: make the dropreason really work when calling tcp_rcv_state_process() Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 5/6] tcp: make dropreason in tcp_child_process() work Jason Xing
2024-02-12  9:28 ` [PATCH net-next v3 6/6] tcp: get rid of NOT_SEPCIFIED reason in tcp_v4/6_do_rcv Jason Xing

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=20240213040658.86261-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=kernelxing@tencent.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).