BPF List
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: "Cristian Morales Vega (cmorve)" <cmorve@cisco.com>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: [QUESTION] BPF_SK_SKB_STREAM_PARSER cannot observe strparser orig_offset?
Date: Mon, 11 May 2026 23:53:20 +0800	[thread overview]
Message-ID: <ec18cff8-a760-4bcb-b5bc-604924ff81ec@linux.dev> (raw)
In-Reply-To: <SA1PR11MB68483E0B4C78DA91FF8DCE7AC0382@SA1PR11MB6848.namprd11.prod.outlook.com>


On 5/11/26 10:49 PM, Cristian Morales Vega (cmorve) wrote:
> I am trying to use BPF_SK_SKB_STREAM_VERDICT in an old kernel (I don't have control over the version), so I need to also use BPF_SK_SKB_STREAM_PARSER. I though to just do "return skb->len;" in it, as a no-op, since I don't really have an use for the parser.

Since v5.18 BPF_SK_SKB_STREAM_VERDICT can be used without 
BPF_SK_SKB_STREAM_PARSER.

Which kernel version you use now?

>
> So far so good. But I can see that, from time to time, __strp_recv() receives a non-zero orig_offset as "first skb" (i.e. strp->skb_head is null). In such a case, I should not be returning skb->len but "skb->len - orig_offset" (i.e. orig_len), right? Otherwise I would enter
>
> 		extra = (ssize_t)(stm->accum_len + cand_len) -
> 			stm->strp.full_len;
>
> 		if (extra < 0) {
> 			/* Message not complete yet. */
>
> But AFAICT BPF_SK_SKB_STREAM_PARSER doesn't have access to that offset. It seems it had it until e0dc3b93bd7bcff8c3813d1df43e0908499c7cf0 (which was backported), but not any more?
>
> Is my understanding correct? If not, what am I missing? And, if yes, there is any solution?


If you just return skb->len only in your parser , the 'issue' should not 
happen.

  reply	other threads:[~2026-05-11 15:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 14:49 [QUESTION] BPF_SK_SKB_STREAM_PARSER cannot observe strparser orig_offset? Cristian Morales Vega (cmorve)
2026-05-11 15:53 ` Jiayuan Chen [this message]
2026-05-11 16:18   ` Cristian Morales Vega (cmorve)
2026-05-12  2:05     ` Jiayuan Chen

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=ec18cff8-a760-4bcb-b5bc-604924ff81ec@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=cmorve@cisco.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