I've been trying to get an application to run properly, but it seems to be unable to find any network interfaces. It is designed to run without administrative rights, and so requires specific file capabilities. However, it is still unable to find any network interfaces through libpcap.
I tried out a simple script to replicate the behavior using libpcap to list network interfaces in order to test out the problem:
#include <stdio.h>
#include <pcap.h>
int main(int argc, char *argv[]) {
char *dev, errbuf[PCAP_ERRBUF_SIZE];
dev = pcap_lookupdev(errbuf);
if(dev == NULL) {
printf("Error: %s\n", errbuf);
return(2);
}
printf("Device: %s\n", dev);
return(0);
}
Applying file capabilities and verifying that they were applied,
$ sudo setcap cap_net_raw,cap_net_admin=eip pcap_test
$ getcap pcap_test
pcap_test = cap_net_admin,cap_net_raw+eip
It still is unable to find any network interfaces even though it claims to have the correct permissions. Running as super user works without problem, of course.
$ ./pcap_test
Error: no suitable device found
$ sudo ./pcap_test
Device: eth0
Going through this identical sequence works as desired under Ubuntu 14.04 (with kernel version 3.13.0-35-generic as well as previous versions), but I haven't been able to get it to work under Mint 17 or 17.1 (with kernel version 3.13.0-24-generic).
Are there any changes to the kernel that affects file capabilities? Anything relevant I've found online is several years old and is in reference to an outdated kernel. Thanks!