From: Martin KaFai Lau <kafai@fb.com>
To: Joe Stringer <joe@wand.net.nz>
Cc: <bpf@vger.kernel.org>, Lorenz Bauer <lmb@cloudflare.com>,
netdev <netdev@vger.kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
Andrii Nakryiko <andriin@fb.com>
Subject: Re: [PATCH bpf-next 5/7] selftests: bpf: add test for sk_assign
Date: Wed, 18 Mar 2020 10:27:35 -0700 [thread overview]
Message-ID: <20200318172735.kxwuvccegquupkwh@kafai-mbp> (raw)
In-Reply-To: <CAOftzPjBo6r2nymjUn4qr=N4Zd7rF=03=n45HDvyXfSXfDnBtg@mail.gmail.com>
On Tue, Mar 17, 2020 at 01:56:12PM -0700, Joe Stringer wrote:
> On Tue, Mar 17, 2020 at 12:31 AM Martin KaFai Lau <kafai@fb.com> wrote:
> >
> > On Thu, Mar 12, 2020 at 04:36:46PM -0700, Joe Stringer wrote:
> > > From: Lorenz Bauer <lmb@cloudflare.com>
> > >
> > > Attach a tc direct-action classifier to lo in a fresh network
> > > namespace, and rewrite all connection attempts to localhost:4321
> > > to localhost:1234.
> > >
> > > Keep in mind that both client to server and server to client traffic
> > > passes the classifier.
> > >
> > > Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
> > > Signed-off-by: Joe Stringer <joe@wand.net.nz>
> > > ---
> > > tools/testing/selftests/bpf/.gitignore | 1 +
> > > tools/testing/selftests/bpf/Makefile | 3 +-
> > > .../selftests/bpf/progs/test_sk_assign.c | 127 +++++++++++++
> > > tools/testing/selftests/bpf/test_sk_assign.c | 176 ++++++++++++++++++
> > Can this test be put under the test_progs.c framework?
>
> I'm not sure, how does the test_progs.c framework handle the logic in
> "tools/testing/selftests/bpf/test_sk_assign.sh"?
>
> Specifically I'm looking for:
> * Unique netns to avoid messing with host networking stack configuration
> * Control over routes
> * Attaching loaded bpf programs to ingress qdisc of a device
>
> These are each trivial one-liners in the supplied shell script
> (admittedly building on existing shell infrastructure in the tests dir
> and iproute2 package). Seems like maybe the netns parts aren't so bad
> looking at flow_dissector_reattach.c but anything involving netlink
> configuration would either require pulling in a netlink library
> dependency somewhere or shelling out to the existing binaries. At that
> point I wonder if we're trying to achieve integration of this test
> into some automated prog runner, is there a simpler way like a place I
> can just add a one-liner to run the test_sk_assign.sh script?
I think running a system(cmd) in test_progs is fine, as long as it cleans
up everything when it is done. There is some pieces of netlink
in tools/lib/bpf/netlink.c that may be reuseable also.
Other than test_progs.c, I am not aware there is a script to run
all *.sh. I usually only run test_progs.
Cc: Andrii who has fixed many selftest issues recently.
next prev parent reply other threads:[~2020-03-18 17:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 23:36 [PATCH bpf-next 0/7] Add bpf_sk_assign eBPF helper Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 1/7] dst: Move skb_dst_drop to skbuff.c Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 2/7] dst: Add socket prefetch metadata destinations Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 3/7] bpf: Add socket assign support Joe Stringer
2020-03-16 10:08 ` Jakub Sitnicki
2020-03-16 21:23 ` Joe Stringer
2020-03-16 22:57 ` Martin KaFai Lau
2020-03-17 3:06 ` Joe Stringer
2020-03-17 6:26 ` Martin KaFai Lau
2020-03-18 0:46 ` Joe Stringer
2020-03-18 10:03 ` Jakub Sitnicki
2020-03-19 5:49 ` Joe Stringer
2020-03-18 18:48 ` Martin KaFai Lau
2020-03-19 6:24 ` Joe Stringer
2020-03-20 1:54 ` Martin KaFai Lau
2020-03-20 4:28 ` Joe Stringer
2020-03-17 10:09 ` Lorenz Bauer
2020-03-18 1:10 ` Joe Stringer
2020-03-18 2:03 ` Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 4/7] dst: Prefetch established socket destinations Joe Stringer
2020-03-16 23:03 ` Martin KaFai Lau
2020-03-17 3:17 ` Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 5/7] selftests: bpf: add test for sk_assign Joe Stringer
2020-03-17 6:30 ` Martin KaFai Lau
2020-03-17 20:56 ` Joe Stringer
2020-03-18 17:27 ` Martin KaFai Lau [this message]
2020-03-19 5:45 ` Joe Stringer
2020-03-19 17:36 ` Andrii Nakryiko
2020-03-12 23:36 ` [PATCH bpf-next 6/7] selftests: bpf: Extend sk_assign for address proxy Joe Stringer
2020-03-12 23:36 ` [PATCH bpf-next 7/7] selftests: bpf: Improve debuggability of sk_assign Joe Stringer
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=20200318172735.kxwuvccegquupkwh@kafai-mbp \
--to=kafai@fb.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eric.dumazet@gmail.com \
--cc=joe@wand.net.nz \
--cc=lmb@cloudflare.com \
--cc=netdev@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 NNTP newsgroup(s).