Setcap for program using libpcap

I wrote a C program that sniffs a network interface (using libpcap) and compiled it using the SDK.
When I transferred the .ipk to the OpenWrt router, I noticed I was not able to run the program without root (which I was expecting).

So, I tried to execute sudo setcap cap_net_raw,cap_net_admin=eip /bin/pcap_retrans in the router (pcap_retrans is my C program).
However, it returned setcap: command not found. So I installed libcap, which I thought would also install the setcap command. It didn't.

Searching on the Internet, I found this Makefile https://github.com/openwrt/packages/blob/master/libs/libcap/Makefile that claimed to install setcap. I compiled it using the SDK and transferred the .ipk file into my router. Installed it successfully but once again, the setcap command was not found.

I feel like I've tried everything. Is it really not possible to install setcap? How can I run my program without sudo, if setcap is impossible to install?

Note: I'm using OpenWrt version 18.06.2.
Note2: I found a similar issue in TCPDump as non privilaged user, but it did not solve my problem.

It is written in the Makefile

You need to compile and install libcap-bin. :slight_smile:

This should work:

make package/libcap/compile CONFIG_PACKAGE=libcap-bin -j1 V=s

Or just select it in menuconfig:

@PolynomialDivision I can't believe I missed that...

I executed make package/libcap/compile CONFIG_PACKAGE=libcap-bin -j1 V=s as you said, and a libcap_2.25-2_x86_64.ipk was created in the SDK. I thought a libcap-bin would be created, which was not the case.

However, when I transfer libcap_2.25 ipk to the router and install it, the setcap command is still not recognized :confused: .
Am I transferring the right file?