The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d4083fb836cf5d06a2bc2d6fe7297fb5139c8fc6
commit d4083fb836cf5d06a2bc2d6fe7297fb5139c8fc6 Author: Gleb Smirnoff <[email protected]> AuthorDate: 2026-03-05 03:57:59 +0000 Commit: Gleb Smirnoff <[email protected]> CommitDate: 2026-03-05 03:57:59 +0000 tests/net/bpf: hexdump(3) the packets if compare fails --- tests/sys/net/bpf/Makefile | 2 +- tests/sys/net/bpf/pcap-test.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/sys/net/bpf/Makefile b/tests/sys/net/bpf/Makefile index cee27b550434..62e04e5a9707 100644 --- a/tests/sys/net/bpf/Makefile +++ b/tests/sys/net/bpf/Makefile @@ -10,7 +10,7 @@ LIBADD+= nv PROGS= bpf_multi_read pcap-test LIBADD.bpf_multi_read+= pcap CFLAGS.pcap-test.c+= -Wno-cast-align -LIBADD.pcap-test+= pcap +LIBADD.pcap-test+= pcap util ATF_TESTS_SH= bpf diff --git a/tests/sys/net/bpf/pcap-test.c b/tests/sys/net/bpf/pcap-test.c index 9d01548f7aae..4f837959208f 100644 --- a/tests/sys/net/bpf/pcap-test.c +++ b/tests/sys/net/bpf/pcap-test.c @@ -31,6 +31,7 @@ #include <netinet/ip.h> #include <pcap/pcap.h> #include <fcntl.h> +#include <libutil.h> #include <unistd.h> #include <stdlib.h> #include <string.h> @@ -219,8 +220,11 @@ compare(int argc __unused, char *argv[]) if (p1->caplen != p2->caplen) errx(1, "packet #%u capture length %u != %u", cnt, p1->caplen, p2->caplen); - if (memcmp(p1->data, p2->data, p1->caplen) != 0) + if (memcmp(p1->data, p2->data, p1->caplen) != 0) { + hexdump(p1->data, p1->caplen, argv[0], 0); + hexdump(p2->data, p2->caplen, argv[1], 0); errx(1, "packet #%u payload different", cnt); + } } if (p1 != NULL || p2 != NULL) errx(1, "packet count different");
