From: Paolo Abeni <pabeni@redhat.com>
To: Menglong Dong <menglong8.dong@gmail.com>,
David Ahern <dsahern@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
xeb@mail.ru, David Miller <davem@davemloft.net>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Menglong Dong <imagedong@tencent.com>,
Eric Dumazet <edumazet@google.com>, Martin Lau <kafai@fb.com>,
Talal Ahmad <talalahmad@google.com>,
Kees Cook <keescook@chromium.org>,
Alexander Lobakin <alobakin@pm.me>,
Hao Peng <flyingpeng@tencent.com>,
Mengen Sun <mengensun@tencent.com>,
dongli.zhang@oracle.com, LKML <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
Biao Jiang <benbjiang@tencent.com>
Subject: Re: [PATCH net-next v3 2/3] net: icmp: introduce __ping_queue_rcv_skb() to report drop reasons
Date: Thu, 17 Mar 2022 09:33:45 +0100 [thread overview]
Message-ID: <87764612d480432134b5253f17e3d6fff816e147.camel@redhat.com> (raw)
In-Reply-To: <CADxym3Z_o6P+jSu5sUZDQf4bGUj4f4tGEYi7a9z+wRjYu0o1xw@mail.gmail.com>
On Thu, 2022-03-17 at 13:25 +0800, Menglong Dong wrote:
> On Thu, Mar 17, 2022 at 11:56 AM David Ahern <dsahern@kernel.org> wrote:
> >
> > On 3/16/22 12:31 AM, menglong8.dong@gmail.com wrote:
> > > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> > > index 3ee947557b88..9a1ea6c263f8 100644
> > > --- a/net/ipv4/ping.c
> > > +++ b/net/ipv4/ping.c
> > > @@ -934,16 +934,24 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
> > > }
> > > EXPORT_SYMBOL_GPL(ping_recvmsg);
> > >
> > > -int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> > > +static enum skb_drop_reason __ping_queue_rcv_skb(struct sock *sk,
> > > + struct sk_buff *skb)
> > > {
> > > + enum skb_drop_reason reason;
> > > +
> > > pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n",
> > > inet_sk(sk), inet_sk(sk)->inet_num, skb);
> > > - if (sock_queue_rcv_skb(sk, skb) < 0) {
> > > - kfree_skb(skb);
> > > + if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
> > > + kfree_skb_reason(skb, reason);
> > > pr_debug("ping_queue_rcv_skb -> failed\n");
> > > - return -1;
> > > + return reason;
> > > }
> > > - return 0;
> > > + return SKB_NOT_DROPPED_YET;
> > > +}
> > > +
> > > +int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> > > +{
> > > + return __ping_queue_rcv_skb(sk, skb) ?: -1;
> > > }
> > > EXPORT_SYMBOL_GPL(ping_queue_rcv_skb);
> > >
> >
> > This is a generic proto callback and you are now changing its return
> > code in a way that seems to conflict with existing semantics
>
> The return value of ping_queue_rcv_skb() seems not changed.
> In the previous code, -1 is returned on failure and 0 for success.
> This logic isn't changed, giving __ping_queue_rcv_skb() != 0 means
> failure and -1 is returned. Isn't it?
With this patch, on failure __ping_queue_rcv_skb() returns 'reason' (>
0) and ping_queue_rcv_skb() returns the same value.
On success __ping_queue_rcv_skb() returns SKB_NOT_DROPPED_YET (==0) and
ping_queue_rcv_skb() return -1.
You need to preserve the old ping_queue_rcv_skb() return values, under
the same circumstances.
Thanks,
Paolo
next prev parent reply other threads:[~2022-03-17 8:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 6:31 [PATCH net-next v3 0/3] net: icmp: add skb drop reasons to icmp menglong8.dong
2022-03-16 6:31 ` [PATCH net-next v3 1/3] net: sock: introduce sock_queue_rcv_skb_reason() menglong8.dong
2022-03-16 6:31 ` [PATCH net-next v3 2/3] net: icmp: introduce __ping_queue_rcv_skb() to report drop reasons menglong8.dong
2022-03-17 3:56 ` David Ahern
2022-03-17 5:25 ` Menglong Dong
2022-03-17 8:33 ` Paolo Abeni [this message]
2022-03-17 8:36 ` Menglong Dong
2022-03-16 6:31 ` [PATCH net-next v3 3/3] net: icmp: add reasons of the skb drops to icmp protocol menglong8.dong
2022-03-17 3:18 ` Jakub Kicinski
2022-03-17 3:35 ` David Ahern
2022-03-17 4:05 ` Jakub Kicinski
2022-03-17 6:02 ` Menglong Dong
2022-03-17 14:48 ` David Ahern
2022-03-17 14:53 ` David Laight
2022-03-17 15:49 ` David Ahern
2022-03-18 1:37 ` Menglong Dong
2022-03-18 4:10 ` David Ahern
2022-03-18 7:26 ` Menglong Dong
2022-03-18 22:33 ` David Ahern
2022-03-20 13:27 ` Menglong Dong
2022-03-17 5:57 ` Menglong Dong
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=87764612d480432134b5253f17e3d6fff816e147.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=alobakin@pm.me \
--cc=benbjiang@tencent.com \
--cc=davem@davemloft.net \
--cc=dongli.zhang@oracle.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=flyingpeng@tencent.com \
--cc=imagedong@tencent.com \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mengensun@tencent.com \
--cc=menglong8.dong@gmail.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=talalahmad@google.com \
--cc=xeb@mail.ru \
--cc=yoshfuji@linux-ipv6.org \
/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).