From ac35596523566f44124c5f973637dbfb34fbd17c Mon Sep 17 00:00:00 2001 From: Deishelon Date: Tue, 5 Nov 2024 04:11:44 +1300 Subject: [PATCH] [libpcap] fix: #25700 - enable proper packet capture on Android using pcap-linux.c (#25781) Previously, libpcap (on Android) defaulted to pcap-null.c, preventing live packet capture. Now correctly uses pcap-linux.c, enabling capture. Results: Before: Available interfaces: nflog - Linux netfilter log (NFLOG) interface nfqueue - Linux netfilter queue (NFQUEUE) interface Error creating handle: live packet capture not supported on this system After (this PR): Reciper for testing created with: ``` ~/projects/conan-center-index/recipes/libpcap$ conan create --user=nikita --channel=dev --profile:host=~/projects/redacted/profiles/android_api21_arm64-v8a.jinja --settings:host=build_type=RelWithDebInfo --build=missing --version=1.10.4 all/ ``` Available interfaces: eth0:LL - No description eth0 - No description any - Pseudo-device that captures on all interfaces lo - No description nflog - Linux netfilter log (NFLOG) interface nfqueue - Linux netfilter queue (NFQUEUE) interface Starting packet capture on can0... Captured packet with length: 16 ID: 0x1106ff8d DLC: 8 Data: 60 0F 13 99 FF 01 00 13 refs: https://github.com/conan-io/conan-center-index/blob/master/recipes/libpcap/all/conanfile.py#L133 https://github.com/the-tcpdump-group/libpcap/blob/5d71e580d946a8b7cf95933f64c527dafbda35db/pcap-null.c https://github.com/the-tcpdump-group/libpcap/blob/5d71e580d946a8b7cf95933f64c527dafbda35db/configure.ac#L988-L992C18 https://github.com/the-tcpdump-group/libpcap/blob/5d71e580d946a8b7cf95933f64c527dafbda35db/configure.ac#L1183-L1189 --- recipes/libpcap/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libpcap/all/conanfile.py b/recipes/libpcap/all/conanfile.py index 1cbe6a152dae8..9023196f55440 100644 --- a/recipes/libpcap/all/conanfile.py +++ b/recipes/libpcap/all/conanfile.py @@ -130,7 +130,7 @@ def generate(self): if Version(self.version) < "1.10": tc.configure_args.append("--disable-packet-ring") if cross_building(self): - target_os = "linux" if self.settings.os == "Linux" else "null" + target_os = "linux" if self.settings.os in ["Linux", "Android"] else "null" tc.configure_args.append(f"--with-pcap={target_os}") elif "arm" in self.settings.arch and self.settings.os == "Linux": tc.configure_args.append("--host=arm-linux")