You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
libpcap on Android defaults to pcap-null.c which prevents the live capture.
Example error:
# /data/local/tmp/NetLogger
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
I believe the error is how the package configures the libpcap in here:
It configures only Linux able to pass --with-pcap=linux to configure script. On Android this will result --with-pcap=null
Which will result in null (no-op impl) for libpcap
I believe the fix is to set --with-pcap=linux when building for Android.
diff --git a/recipes/libpcap/all/conanfile.py b/recipes/libpcap/all/conanfile.py
index 1cbe6a152..9023196f5 100644
--- a/recipes/libpcap/all/conanfile.py
+++ b/recipes/libpcap/all/conanfile.py
@@ -130,7 +130,7 @@ class LibPcapConan(ConanFile):
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")
I have tested this locally, and this fixes the issue, so opening this issue to submit this change.
Before:
# /data/local/tmp/NetLogger
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
# /data/local/tmp/NetLogger
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
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
The text was updated successfully, but these errors were encountered:
Description
libpcap on Android defaults to pcap-null.c which prevents the live capture.
Example error:
I believe the error is how the package configures the libpcap in here:
conan-center-index/recipes/libpcap/all/conanfile.py
Line 133 in 84dced8
It configures only Linux able to pass
--with-pcap=linux
to configure script. On Android this will result--with-pcap=null
Which will result in
null
(no-op impl) for libpcapnull-op is implemented here: https://github.com/the-tcpdump-group/libpcap/blob/5d71e580d946a8b7cf95933f64c527dafbda35db/pcap-null.c
which corresponds to error message that I see.
I believe the fix is to set
--with-pcap=linux
when building for Android.I have tested this locally, and this fixes the issue, so opening this issue to submit this change.
Before:
After:
Reciper for testing created with:
Package and Environment Details
Conan profile
======== Input profiles ========
Profile host:
[settings]
arch=armv8
build_type=RelWithDebInfo
compiler=clang
compiler.cppstd=gnu17
compiler.libcxx=c++_shared
compiler.version=8
os=Android
os.api_level=21
[conf]
tools.android:ndk_path=/home/npustovoi/Android/Sdk/ndk/28.0.12433566
[buildenv]
CHOST=arm-linux-androideabi
AR=arm-linux-androideabi-ar
AS=arm-linux-androideabi-as
RANLIB=arm-linux-androideabi-ranlib
CC=aarch64-linux-android21-clang
CXX=aarch64-linux-android21-clang++
LD=arm-linux-androideabi-ld
STRIP=arm-linux-androideabi-strip
ANDROID_PLATFORM=21
ANDROID_ABI=arm64-v8a
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
Steps to reproduce
Compile sample binary with NDK for Android to capture traffic, eg:
Logs
Click to expand log
The text was updated successfully, but these errors were encountered: