From: Stanislav Fomichev <sdf@fomichev.me>
To: Kui-Feng Lee <thinker.li@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, martin.lau@linux.dev,
song@kernel.org, kernel-team@meta.com, andrii@kernel.org,
geliang@kernel.org, sinquersw@gmail.com, kuifeng@meta.com
Subject: Re: [PATCH bpf-next v7 0/6] monitor network traffic for flaky test cases
Date: Mon, 12 Aug 2024 09:16:30 -0700 [thread overview]
Message-ID: <Zro1XiPDew6PhJcy@mini-arch> (raw)
In-Reply-To: <20240810023534.2458227-1-thinker.li@gmail.com>
On 08/09, Kui-Feng Lee wrote:
> Capture packets in the background for flaky test cases related to
> network features.
>
> We have some flaky test cases that are difficult to debug without
> knowing what the traffic looks like. Capturing packets, the CI log and
> packet files may help developers to fix these flaky test cases.
>
> This patch set monitors a few test cases. Recently, they have been
> showing flaky behavior.
>
> lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 68, SYN
> lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 60, SYN, ACK
> lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 60, ACK
> lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 52, ACK
> lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 52, FIN, ACK
> lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 52, RST, ACK
> Packet file: packets-2173-86-select_reuseport:sockhash_IPv4_TCP_LOOPBACK_test_detach_bpf-test.log
> #280/87 select_reuseport/sockhash IPv4/TCP LOOPBACK test_detach_bpf:OK
>
> The above block is the log of a test case. It shows every packet of a
> connection. The captured packets are stored in the file called
> packets-2173-86-select_reuseport:sockhash_IPv4_TCP_LOOPBACK_test_detach_bpf-test.log.
>
> We have a set of high-level helpers and a test_progs option to
> simplify the process of enabling the traffic monitor. netns_new() and
> netns_free() are helpers used to create and delete namespaces while
> also enabling the traffic monitor for the namespace based on the
> patterns provided by the "-m" option of test_progs. The value of the
> "-m" option is a list of patterns used to enable the traffic monitor
> for a group of tests or a file containing patterns. CI can utilize
> this option to enable monitoring.
>
> traffic_monitor_start() and traffic_monitor_stop() are low-level
> functions to start monitoring explicitly. You can have more controls,
> however high-level helpers are preferred.
>
> The following block is an example that monitors the network traffic of
> a test case in a network namespace.
>
> struct netns_obj *netns;
>
> ...
> netns = netns_new("test", true);
> if (!ASSERT_TRUE(netns, "netns_new"))
> goto err;
>
> ... test ...
>
> netns_free(netns);
>
> netns_new() will create a network namespace named "test" and bring up
> "lo" in the namespace. By passing "true" as the 2nd argument, it will
> set the network namespace of the current process to
> "test".netns_free() will destroy the namespace, and the process will
> leave the "test" namespace if the struct netns_obj returned by
> netns_new() is created with "true" as the 2nd argument. If the name of
> the test matches the patterns given by the "-m" option, the traffic
> monitor will be enabled for the "test" namespace as well.
>
> The packet files are located in the directory "/tmp/tmon_pcap/". The
> directory is intended to be compressed as a file so that developers
> can download it from the CI.
>
> This feature is enabled only if libpcap is available when building
> selftests.
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
prev parent reply other threads:[~2024-08-12 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-10 2:35 [PATCH bpf-next v7 0/6] monitor network traffic for flaky test cases Kui-Feng Lee
2024-08-10 2:35 ` [PATCH bpf-next v7 1/6] selftests/bpf: Add traffic monitor functions Kui-Feng Lee
2024-08-10 2:35 ` [PATCH bpf-next v7 2/6] selftests/bpf: Add the traffic monitor option to test_progs Kui-Feng Lee
2024-08-10 2:35 ` [PATCH bpf-next v7 3/6] selftests/bpf: netns_new() and netns_free() helpers Kui-Feng Lee
2024-08-12 16:17 ` Stanislav Fomichev
2024-08-10 2:35 ` [PATCH bpf-next v7 4/6] selftests/bpf: Monitor traffic for tc_redirect Kui-Feng Lee
2024-08-10 2:35 ` [PATCH bpf-next v7 5/6] selftests/bpf: Monitor traffic for sockmap_listen Kui-Feng Lee
2024-08-10 2:35 ` [PATCH bpf-next v7 6/6] selftests/bpf: Monitor traffic for select_reuseport Kui-Feng Lee
2024-08-12 16:16 ` Stanislav Fomichev [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=Zro1XiPDew6PhJcy@mini-arch \
--to=sdf@fomichev.me \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=geliang@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=martin.lau@linux.dev \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
--cc=thinker.li@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.