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 ?

see my other post in qdn.public.qnxrtp.installation today.
this is one of the items in the wishlist :slight_smile:
frank

On Sun, 26 Nov 2000, bruno wrote:

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 ?

I don’t see your post !!



Frank Liu wrote:

see my other post in qdn.public.qnxrtp.installation today.
this is one of the items in the wishlist > :slight_smile:
frank

On Sun, 26 Nov 2000, bruno wrote:

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 ?

read my post in the thread “Re: Upcoming patch” in
qdn.public.qnxrtp.installation, I have a list of 10 items in that post,
pay attention to the 10th one, it is for you :slight_smile:

frank

On Tue, 28 Nov 2000, bruno wrote:

I don’t see your post !!



Frank Liu wrote:

see my other post in qdn.public.qnxrtp.installation today.
this is one of the items in the wishlist > :slight_smile:
frank

On Sun, 26 Nov 2000, bruno wrote:

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 ?