socket problem

Under linux I use this code to capture all Ethernet packets



#include <linux/if_ether.h> (for SOCK_PACKET and ETH_P_ALL)

int sock;
struct ifreq ifr;


sock = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL));
strncpy(ifr.ifr_name, interface, 16); /* interface = “eth0” */
if(ioctl(sock, SIOCGIFFLAGS, &ifr) < 0)
{
perror(“SIOCGIFFLAGS”);
exit(1);
}

ifr.ifr_flags |= IFF_PROMISC;

if(ioctl(sock, SIOCSIFFLAGS, &ifr) < 0)
{
perror(“SIOCSIFFLAGS”);
exit(1);
}


→ How to do this under QNX ?

In article <3A214C56.85F7144@scola.ac-paris.fr>, “bruno”
<bruno.suarez@scola.ac-paris.fr> wrote:

Under linux I use this code to capture all Ethernet packets

if(ioctl(sock, SIOCGIFFLAGS, &ifr) < 0)
{
perror(“SIOCGIFFLAGS”); exit(1);
}

ifr.ifr_flags |= IFF_PROMISC;

if(ioctl(sock, SIOCSIFFLAGS, &ifr) < 0)
{
perror(“SIOCSIFFLAGS”); exit(1);
}

If you’d check errno at this point it would probably tell you “103 –
Operation not supported”

→ How to do this under QNX ?

AFAIK, you don’t. No promiscous mode yet under RTP, sorry.

-Th