bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team <kernel-team@fb.com>, Lawrence Brakmo <brakmo@fb.com>,
	Neal Cardwell <ncardwell@google.com>,
	netdev <netdev@vger.kernel.org>,
	Yuchung Cheng <ycheng@google.com>
Subject: Re: [RFC PATCH v4 bpf-next 06/12] bpf: tcp: Add bpf_skops_parse_hdr()
Date: Mon, 3 Aug 2020 17:50:56 -0700	[thread overview]
Message-ID: <CANn89iLipQWyGB9WVyK1ub48q31oEe9Pn=9RB_D21vTCs6r_vA@mail.gmail.com> (raw)
In-Reply-To: <20200803231051.2683561-1-kafai@fb.com>

On Mon, Aug 3, 2020 at 4:10 PM Martin KaFai Lau <kafai@fb.com> wrote:
>
> The patch adds a function bpf_skops_parse_hdr().
> It will call the bpf prog to parse the TCP header received at
> a tcp_sock that has at least reached the ESTABLISHED state.
>
> For the packets received during the 3WHS (SYN, SYNACK and ACK),
> the received skb will be available to the bpf prog during the callback
> in bpf_skops_established() introduced in the previous patch and
> in the bpf_skops_write_hdr_opt() that will be added in the
> next patch.
>
> Calling bpf prog to parse header is controlled by two new flags in
> tp->bpf_sock_ops_cb_flags:
> BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG and
> BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG.
>
> When BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG is set,
> the bpf prog will only be called when there is unknown
> option in the TCP header.
>
> When BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG is set,
> the bpf prog will be called on all received TCP header.
>
> This function is half implemented to highlight the changes in
> TCP stack.  The actual codes preparing the bpf running context and
> invoking the bpf prog will be added in the later patch with other
> necessary bpf pieces.
>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>

  reply	other threads:[~2020-08-04  0:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 23:10 [RFC PATCH v4 bpf-next 00/12] BPF TCP header options Martin KaFai Lau
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 01/12] tcp: Use a struct to represent a saved_syn Martin KaFai Lau
2020-08-04  0:19   ` Eric Dumazet
2020-08-04  0:54   ` John Fastabend
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 02/12] tcp: bpf: Add TCP_BPF_DELACK_MAX setsockopt Martin KaFai Lau
2020-08-04  0:57   ` John Fastabend
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 03/12] tcp: bpf: Add TCP_BPF_RTO_MIN for bpf_setsockopt Martin KaFai Lau
2020-08-04  1:01   ` John Fastabend
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 04/12] tcp: Add saw_unknown to struct tcp_options_received Martin KaFai Lau
2020-08-04  0:21   ` Eric Dumazet
2020-08-04  1:14   ` John Fastabend
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 05/12] bpf: tcp: Add bpf_skops_established() Martin KaFai Lau
2020-08-04  1:28   ` John Fastabend
2020-08-20 18:52     ` Martin KaFai Lau
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 06/12] bpf: tcp: Add bpf_skops_parse_hdr() Martin KaFai Lau
2020-08-04  0:50   ` Eric Dumazet [this message]
2020-08-03 23:10 ` [RFC PATCH v4 bpf-next 07/12] bpf: tcp: Add bpf_skops_hdr_opt_len() and bpf_skops_write_hdr_opt() Martin KaFai Lau
2020-08-04  0:52   ` Eric Dumazet
2020-08-03 23:11 ` [RFC PATCH v4 bpf-next 08/12] bpf: sock_ops: Change some members of sock_ops_kern from u32 to u8 Martin KaFai Lau
2020-08-03 23:11 ` [RFC PATCH v4 bpf-next 09/12] bpf: tcp: Allow bpf prog to write and parse TCP header option Martin KaFai Lau
2020-08-03 23:11 ` [RFC PATCH v4 bpf-next 10/12] bpf: selftests: Add fastopen_connect to network_helpers Martin KaFai Lau
2020-08-03 23:11 ` [RFC PATCH v4 bpf-next 11/12] bpf: selftests: tcp header options Martin KaFai Lau
2020-08-03 23:11 ` [RFC PATCH v4 bpf-next 12/12] tcp: bpf: Optionally store mac header in TCP_SAVE_SYN Martin KaFai Lau

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='CANn89iLipQWyGB9WVyK1ub48q31oEe9Pn=9RB_D21vTCs6r_vA@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brakmo@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.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).