How to compile VEL21RIPN ndpi-netfilter2 and using for lede/openwrt

I did try this on the first run. sadly no change on compiling.

Looking at the error it seems to be a problem with with this line.

/src/include/ndpi_define.h:337:23: error: implicit declaration of function 'bswap_16'; did you mean 'swab16'? [-Werror=implicit-function-declaration]
 # define get_l16(X,O) bswap_16(get_u_int16_t(X,O))

I don't code in c or know anything about MIPS but it looks like NTOP don't have the correct command even though it States nDPI supports mips on the web site :frowning:

I'm wondering if trying to get hold of someone at nTOP to help fix this code. or if someone knows MIPS arch and C language.

i'm not good in C.
but code need some patches to support mips and arm.

1 Like

Hi , I am not aware of the steps to compile the packages for openwrt. Can you please lead me for step by step procedure to do this ?

code still need to be patched so it can work with mips and other types of cpu's, currently only working with openwrt x64.

ok thanks @hisham2630 for the reply.

1 Like

Hi @hisham2630, just looking to see if you started any work on mips. i tried crosscompiling with https://github.com/openwrt-develop/ndpi-netfilter.git, but got an error while trying to load the module with modprobe

modprobe xt_ndpi
[ 2145.163779] xt_ndpi: Unknown symbol xchg_small (err 0)
1 module could not be probed
xt_ndpi

any ideas ?

Hi, sorry i have a limited knowledge in C coding, i hope someone can do it in the future.

Anyone did something with this?
Currently I am using Debian with vel21ripn-ndpi on x86_64.
I do not really need it for mips but arm can be useful to many.
I can try to test in a VM.

after googled i think its missed the line:

#include <endian.h>

in some file. but in what file exactly? i'm not programmer, so can only guess.
ps: will be even better to add this missing part right to Makefile (or add patch file?) if possible.

anyone can help with that?

i trying to build for ar71xx
so far i end up with many errors from above post:

ar71xx/source/build_dir/target-mips_24kc_musl/linux-ath79_generic/ndpi-netfilter2-flow_info-c8ee735-2.8/ndpi-netfilter/src/../../src/include/ndpi_define.h:61:21: warning: "__LITTLE_ENDIAN" is not defined, evaluates to 0 [-Wundef]
 #if __BYTE_ORDER == __LITTLE_ENDIAN
                     ^~~~~~~~~~~~~~~
...
ar71xx/source/build_dir/target-mips_24kc_musl/linux-ath79_generic/ndpi-netfilter2-flow_info-c8ee735-2.8/ndpi-netfilter/src/../../src/include/ndpi_define.h:337:23: error: implicit declaration of function 'bswap_16'; did you mean 'swab16'? [-Werror=implicit-function-declaration]
 # define get_l16(X,O) bswap_16(get_u_int16_t(X,O))
                       ^~~~~~~~
...
ar71xx/source/build_dir/target-mips_24kc_musl/linux-ath79_generic/ndpi-netfilter2-flow_info-c8ee735-2.8/ndpi-netfilter/src/../../src/lib/protocols/fiesta.c:55:8: note: in expansion of macro 'get_l16'
     && get_l16(packet->payload, 1) == packet->payload_packet_len - 3))) {
        ^~~~~~~
cc1: some warnings being treated as errors
...
$_

add

CONFIG_BIG_ENDIAN=y

to config

1 Like

Hi, bro can you please tell me where to put "CONFIG_BIG_ENDIAN=y" exactly ?
which config file ?

Hello everyone,

There have been quite a lot of changes in the ndpi netfilter : https://github.com/vel21ripn/nDPI

The most recent branch has been flow_info - 4 and am facing build issues.

Folloiwng is the error :
configure: error: Missing libpcap(-dev) library required to compile the example application

Basically its complaining about not finding libpcap-dev

Currently i have installed libpcap, and the Makefile has the section as follows :

define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/pcap* $(1)/usr/include/
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.{a,so*} $(1)/usr/lib/
endef

so ideally , it should have installed the dev part as well. not sure

The autoconfig config.log is as follows :

configure:17629: checking for pcap_open_live in -lpcap
configure:17654: gcc -std=gnu99 -o conftest -W -Wall -Wno-unused-parameter -Wno-unused-function  -I/home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/include/json-c   conftest.c -lpcap  -ljson-c  -L/home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib -ljson-c >&5
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libpcap.so when searching for -lpcap
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libpcap.a when searching for -lpcap
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libjson-c.so when searching for -ljson-c
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libjson-c.a when searching for -ljson-c
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libjson-c.so when searching for -ljson-c
/usr/bin/ld: skipping incompatible /home/spf11_2_wifi6_6018_64/qsdk/staging_dir/target-aarch64_cortex-a53_musl-1.1.16/usr/lib/libjson-c.a when searching for -ljson-c
configure:17654: $? = 0
configure:17663: result: no
configure:17670: error: Missing libpcap(-dev) library required to compile the example application.

Please help

Try installing libpcap-dev on the host machine where you are trying to build.

sudo apt-get install -y libpcap-dev

Looks like the package you are trying to compile has an example util which uses host machine libraries .

Its already at the latest version on the host machine actually

The other alternative is to compile libpcap as host package
Ex: https://github.com/openwrt/openwrt/blob/openwrt-19.07/package/utils/bzip2/Makefile#L91