aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-02-19 02:39:00 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-02-19 02:53:16 +0000
commit38edf96b1787ce3d8c00e4466348dab891c7a9ea (patch)
tree64645be7bc5ad0040f2888ce98289e16160de5f2 /tools
parentd60082f16e4c91d4b97d8b3b56b39fa348ecfbda (diff)
tests/ipfw: fix log:bpf test flakynessHEADmain
There were several problems: o Using 'netstat -B' is not a reliable way to make sure that all tcpdumps have attached to bpf(4). The problem is that tcpdump (via libpcap) does several ioctl(2)s after the attach including two BIOCSETF. Each of them flushes the input buffer. So we can see tcpdump attached in 'netstat -B' and start sending packets and the packet will be captured by bpf(4) before BIOCSETF and freed and tcpdump won't read anything. Instead of using netstat(1), use ps(1) and make sure each tcpdump is blocked on the "bpf" wait channel, which guarantees it is done with ioctl(2)s and is now blocked in read(2). o Using 'nc -w 0' sets timeout not only on the connect(2) (as documented) but also on poll(2), which is not documented. There is a race in shell that will make stdin not yet filled by 'echo foo' when nc(1) does poll(2). With zero timeout, this poll(2) will immediately return and nc will exit. o The waiting loop had two errors: using wrong variable name as well as invoking a subshell, that actually can't wait on the pid. o The reading tcpdump was lacking '-q' option, that prevents any protocol interpretations. Sometimes, when random port chosen by nc(1) would match some well-known (to tcpdump) port, the output would differ from the expected. PR: 293241
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions