Package: tcpxtract
Version: 1.0.1-19
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu tenacious ubuntu-patch
Dear Maintainer,
tcpxtract was using network byte order and magic number to filter ETHERTYPE_IP.
This caused it to skip everything on s390x in the packet captures.
Note: the patch for this bug builds on ftbfs fix[1]
In Ubuntu, the attached patch was applied to achieve the following:
* d/p/150_ip_header_check.patch: Use network-to-host byte order
conversion before checking ether_type (LP: #2178297).
* d/rules: Check that sample capture contains files.
Thanks for considering the patch.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1153475
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500,
'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 7.0.0-43-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru tcpxtract-1.0.1/debian/patches/150_ip_header_check.patch
tcpxtract-1.0.1/debian/patches/150_ip_header_check.patch
--- tcpxtract-1.0.1/debian/patches/150_ip_header_check.patch 1970-01-01
12:00:00.000000000 +1200
+++ tcpxtract-1.0.1/debian/patches/150_ip_header_check.patch 2026-11-28
21:57:03.000000000 +1300
@@ -0,0 +1,21 @@
+Description: Correctly check ether_type
+ The old code was failing on big endian systems.
+ ethernet->ether_type should be converted from the network
+ byte order to the host byte order. Use constant instead of
+ the magic number.
+Author: Vladimir Petko <[email protected]>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/tcpxtract/+bug/2178297
+Forwarded: no
+Last-Update: 2026-11-28
+
+--- a/tcpxtract.c
++++ b/tcpxtract.c
+@@ -177,7 +177,7 @@
+ udp = (struct sniff_udp*)(packet + size_ethernet + size_ip);
+
+ /* if it ain't IP, bail, hard */
+- if (ethernet->ether_type != 0x08) /* I think 0x08 is IP, at least it
looks that way */
++ if (ntohs(ethernet->ether_type) != ETHERTYPE_IP)
+ return;
+
+ switch (ip->ip_p) {
diff -Nru tcpxtract-1.0.1/debian/patches/series
tcpxtract-1.0.1/debian/patches/series
--- tcpxtract-1.0.1/debian/patches/series 2026-11-09 09:22:43.000000000
+1300
+++ tcpxtract-1.0.1/debian/patches/series 2026-11-28 21:41:45.000000000
+1300
@@ -12,3 +12,4 @@
120_use-extract-prototype.patch
130_packet-structures-packed.patch
140_enforce_build_order.patch
+150_ip_header_check.patch
diff -Nru tcpxtract-1.0.1/debian/rules tcpxtract-1.0.1/debian/rules
--- tcpxtract-1.0.1/debian/rules 2026-11-09 09:22:43.000000000 +1300
+++ tcpxtract-1.0.1/debian/rules 2026-11-28 21:46:07.000000000 +1300
@@ -9,4 +9,7 @@
override_dh_auto_test:
dh_auto_test
- ./tcpxtract -c tcpxtract.conf -f debian/tests/test.pcap
\ No newline at end of file
+ ./tcpxtract -c tcpxtract.conf -f debian/tests/test.pcap > extract.log
2>&1 \
+ || fail "tcpxtract exited with an error on the sample capture"
+ grep -q "Found file of type" extract.log \
+ || fail "no file was recognized in the sample capture"