From: "Valentín Gutierrez" <vgutierrez@wikimedia.org>
To: xdp-newbies@vger.kernel.org
Subject: Re: MSS clamping with XDP/eBPF
Date: Tue, 7 Nov 2023 12:02:28 +0100 [thread overview]
Message-ID: <CALQkE9YthMqAL_M11d3+aOmcEw-dEe40h--aiCACu_nU8zWGDQ@mail.gmail.com> (raw)
In-Reply-To: <CALQkE9a0VWPZs3cXmWCyd4TWp2uDzghfhd8-VAAAb2Gtc-5CgA@mail.gmail.com>
Answering my own question, parse_tcp_ts()[0] can be easily adapted to
find any TCP option and return a pointer to its position so it can be
updated using bpf_skb_store_bytes().
Cheers,
Valentín Gutiérrez
[0] https://github.com/xdp-project/bpf-examples/blob/63cd4007b16b49b44241f17a38f26aea926f8afc/pping/pping_kern.c#L424
On Mon, Nov 6, 2023 at 10:57 AM Valentín Gutierrez
<vgutierrez@wikimedia.org> wrote:
>
> Hi,
>
> I'm trying to perform some basic TCP MSS clamping with eBPF and it's
> being harder than expected:
>
> * Parsing TCP options can be challenging for the eBPF verifier as it's
> been shown in [1] by Christian Deacon.
> * bpf_store_hdr_opt() introduced in [2] doesn't seem to be useful here
> cause it refuses to overwrite an existing TCP option and MSS is
> already set when BPF_SOCK_OPS_WRITE_HDR_OPT_CB is triggered.
> * bpf_setsockopt() isn't able to set TCP_MAXSEG per [3].
>
> Am I missing something?
>
> Thanks,
> Valentin Gutierrez
>
> [1] https://github.com/gamemann/XDP-TCP-Header-Options/
> [2] https://lore.kernel.org/bpf/20200730205748.3354954-1-kafai@fb.com/T/
> [3] https://github.com/torvalds/linux/blob/d2f51b3516dade79269ff45eae2a7668ae711b25/net/core/filter.c#L5151
prev parent reply other threads:[~2023-11-07 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 9:57 MSS clamping with XDP/eBPF Valentín Gutierrez
2023-11-07 11:02 ` Valentín Gutierrez [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=CALQkE9YthMqAL_M11d3+aOmcEw-dEe40h--aiCACu_nU8zWGDQ@mail.gmail.com \
--to=vgutierrez@wikimedia.org \
--cc=xdp-newbies@vger.kernel.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 read-only IMAP folder(s) and NNTP newsgroup(s).