bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "liujian (CE)" <liujian56@huawei.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: John Fastabend <john.fastabend@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jakub Sitnicki <jakub@cloudflare.com>,
	Lorenz Bauer <lmb@cloudflare.com>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>
Subject: RE: [PATCH v2] skmsg: lose offset info in sk_psock_skb_ingress
Date: Wed, 22 Sep 2021 02:21:21 +0000	[thread overview]
Message-ID: <d3d74db4464340968ad74e3b9d32c997@huawei.com> (raw)
In-Reply-To: <CAM_iQpUpUdd-SnrLOffVoGnW3ocKxDtefUAjktEs1KxE2-Gmvw@mail.gmail.com>



> -----Original Message-----
> From: Cong Wang [mailto:xiyou.wangcong@gmail.com]
> Sent: Monday, September 20, 2021 9:14 AM
> To: liujian (CE) <liujian56@huawei.com>
> Cc: John Fastabend <john.fastabend@gmail.com>; Daniel Borkmann
> <daniel@iogearbox.net>; Jakub Sitnicki <jakub@cloudflare.com>; Lorenz
> Bauer <lmb@cloudflare.com>; David Miller <davem@davemloft.net>; Jakub
> Kicinski <kuba@kernel.org>; Linux Kernel Network Developers
> <netdev@vger.kernel.org>; bpf <bpf@vger.kernel.org>
> Subject: Re: [PATCH v2] skmsg: lose offset info in sk_psock_skb_ingress
> 
> On Fri, Sep 17, 2021 at 3:05 AM Liu Jian <liujian56@huawei.com> wrote:
> > @@ -624,6 +635,13 @@ static void sk_psock_backlog(struct work_struct
> *work)
> >         while ((skb = skb_dequeue(&psock->ingress_skb))) {
> >                 len = skb->len;
> >                 off = 0;
> > +#if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)
> > +               if (psock->sk->sk_data_ready == sk_psock_strp_data_ready) {
> > +                       stm = strp_msg(skb);
> > +                       off = stm->offset;
> > +                       len = stm->full_len;
> > +               }
> > +#endif
> 
> How does this work? You are testing psock->sk->sk_data_ready here but it is
> already the dest sock here, so, if we redirect a strp_msg() from strp socket to
> non-strp socket, this does not work at all?
> 
Yes, it is not work in this case, I did not consider this case.

> And this code looks ugly itself. If you want to distinguish this type of packet
> from others, you can add a bit in, for example skb->_sk_redir.
It looks better this way. 
I will send v3 later. Thank you~
> 
> Thanks.

      reply	other threads:[~2021-09-22  2:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  1:32 [PATCH v2] skmsg: lose offset info in sk_psock_skb_ingress Liu Jian
2021-09-17 22:34 ` John Fastabend
2021-09-20  1:14 ` Cong Wang
2021-09-22  2:21   ` liujian (CE) [this message]

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=d3d74db4464340968ad74e3b9d32c997@huawei.com \
    --to=liujian56@huawei.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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).