From: Alan Maguire <alan.maguire@oracle.com>
To: bpf <bpf@vger.kernel.org>
Subject: sock_ops: calling bpf_sock_ops_cb_flags_set() for already established sockets
Date: Fri, 1 Dec 2023 17:01:01 +0000 [thread overview]
Message-ID: <f42f157b-6e52-dd4d-3d97-9b86c84c0b00@oracle.com> (raw)
hi folks
I've run into a few cases where users have wanted to enable additional
tcp-bpf sock_ops events for a socket _after_ connection establishment.
The problem is that to set the flags to enable additional events, we
have to be in the context of a sock_ops program, and as I understand it,
by default only events early in the socket lifetime are enabled by
default (such as connection established/accepted). As a consequence, if
we do not catch one of those early events, the sock_ops program will not
run and we miss the opportunity to enable more sock_ops events. This can
be a problem for boot-time connections like iSCSI where we are too late
to catch connection establishment.
I can see a few possibilities:
- support setting sock_ops event flags via a socket iterator. This would
mean that the user can always set per-socket flags on
already-established sockets by iterating over existing sockets,
selecting those of interest.
- supporting setting event flags via setsockopt(). In fact we wouldn't
need to fully support setting event flags via "real" setsockopt(); we
could simply use a cgroup/setsockopt program and allow
bpf_sock_ops_cb_flags_set() to run in the cgroup/setsockopt context
(with additional checks to ensure it is indeed a tcp socket).
Do either/both of these seem reasonable, or is there a better way to
tackle this? Thanks!
Alan
next reply other threads:[~2023-12-01 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 17:01 Alan Maguire [this message]
2023-12-01 17:51 ` sock_ops: calling bpf_sock_ops_cb_flags_set() for already established sockets 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=f42f157b-6e52-dd4d-3d97-9b86c84c0b00@oracle.com \
--to=alan.maguire@oracle.com \
--cc=bpf@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