python3-scapy: fix libpcap loading and ptests on musl

- ctypes.util.find_library() relies on "ldconfig -p", gcc or ld, none of
  which exist on a musl target, so find_library("pcap") returns None
  and scapy raises "Cannot find libpcap.so library" even with libpcap
  installed. That disabled conf.use_pcap and BPF filter compilation and
  failed ten ptests (offline sniff() with filters, tcpdump(), tdecode(),
  traceroute). Fall back to loading libpcap.so.1/libpcap.so by name.

- The NetBSD read_routes6() test compares IPv4-compatible IPv6 prefixes
  as strings, but musl's inet_ntop() prints ::127.0.0.0 as ::7f00:0.
  Normalise the expected values with in6_ptop().

Tested with meta-networking-image-ptest-python3-scapy on qemux86-64
with yoe-musl-systemd-wayland: TOTAL: 1 FAIL: 0.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-09-28 06:57:40 -07:00
1 parent f5b8366ede
commit 4ec8afbfcf
3 files changed
+91

No files matched your search

@@ -20,6 +20,8 @@ SRCREV = "1de09fe85fe5c9d60ea5c6de130374e170b5bc28"
SRC_URI = "git://github.com/secdev/scapy.git;branch=master;protocol=https;tag=v${PV} \
file://0001-python3-scapy-skip-ICMP-regression-tests-in-ptest.patch \
file://0002-main-initialize-banner-for-the-default-Python-shell.patch \
file://0003-libpcap-load-libpcap-even-when-find_library-cannot-l.patch \
file://0004-test-don-t-depend-on-libc-formatting-of-IPv4-compati.patch \
file://run-ptest"
UPSTREAM_CHECK_COMMITS = "1"