From fc1f42754de69704fd0c4ffa3d6e648bbc731028 Mon Sep 17 00:00:00 2001 From: John Doe Date: Tue, 1 Sep 2026 01:39:56 +0200 Subject: [PATCH] program-type/BPF_PROG_TYPE_SOCK_OPS: add mention of BPF_WRITE_HDR_TCP_CURRENT_MSS The kernel will sometime trigger the BPF_SOCK_OPS_HDR_OPT_LEN_CB event with a fake, empty packet to guess the future packet's size. See here https://elixir.bootlin.com/linux/v7.1.3/source/net/ipv4/tcp_output.c#L521. When that's the case, it will add `BPF_WRITE_HDR_TCP_CURRENT_MSS` as the first arg to notify that no space will be actually reserved. --- docs/linux/program-type/BPF_PROG_TYPE_SOCK_OPS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/linux/program-type/BPF_PROG_TYPE_SOCK_OPS.md b/docs/linux/program-type/BPF_PROG_TYPE_SOCK_OPS.md index edfbbbf7..6cf23510 100644 --- a/docs/linux/program-type/BPF_PROG_TYPE_SOCK_OPS.md +++ b/docs/linux/program-type/BPF_PROG_TYPE_SOCK_OPS.md @@ -175,6 +175,7 @@ When the `BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG` flag is set with [`bpf_sock_ops_cb The arguments in the context will have the following meanings: * `args[0]`: bool want_cookie. (in writing SYNACK only) +* `args[0]`: (when not writing SYNACK) If equal to `BPF_WRITE_HDR_TCP_CURRENT_MSS`, the kernel will use the `bpf_reserve_hdr_opt()` call to guess the future packet's size and not actually reserve memory. The skb passed as a parameter is empty dummy and no subsequent `BPF_SOCK_OPS_WRITE_HDR_OPT_CB` event will occur. `sock_ops->skb_data`: Not available because no header has been written yet.