System setup :
Beaglebone Black with Debian from SD card, Ethernet and Wifi. Cross compiling on Windows 7 machine.
Running program in debug mode via Eclipse (Win7) using gdb as debugger
I am writing an application that requires ethernet and wifi (via usb) on the beaglebone black. My problem is that I need to point some TCP sockets to the Ethernet port but by default Linux os decides what is best so chooses wifi! So to get around this I use
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), interface);
ioctl(TsocketId, SIOCGIFINDEX, &ifr);
error = setsockopt(socketId, SOL_SOCKET, SO_BINDTODEVICE, (void*)&ifr, sizeof(ifr));
However setsockopt always returns an error EPERM which is Operation Not Permitted (or similar). I have tried the simpler form of passing ‘eth0’ in, also with the same results.
After much reading on the internet it appears that I need extra rights to run this command.
I am struggling at this point
I have set the file permissions to include chmod u+s — made no difference
I have edited sudoers to giv**e admin users sudo privileges (I believe my debian user is one as now I don’t have to enter a password everytime I type sudo…)
# Members of the admin group may gain root privileges %admin ALL=(ALL) NOPASSWD:ALL
This also made no difference.
My application is running under the debian user
Any help much appreciated..