[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Promiscuous Ethernet problem
I'm working on an application for the ETRAX 100 LX, which is
supposed to read all packets from the Ethernet port.
The ETRAX is out-of-the-box, except two things:
I have set an IP address in /etc/network/network.cnf.
My application resides on /mnt/flash.
I open a raw socket, and set the interface to promiscuous mode
When I start the program, I get a message on the serial debug port
telling me that "device eth0 entered promiscuous mode".
When I terminate the program, I get the message
"device eth0 left promiscuous mode".
However, the only packets received by my application are those
addressed to the ETRAX's own MAC address or the broadcast
What am I doing wrong?
Here's how I set up the interface:
struct packet_mreq pr;
struct ifreq ir;
s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
ioctl(s, SIOCGIFINDEX, &ir);
pr.mr_ifindex = ir.ifr_ifindex;
pr.mr_type = PACKET_MR_PROMISC;
setsockopt(s, SOL_PACKET, PACKET_ADD_MEMBERSHIP,
&pm, sizeof(struct packet_mreq));
None of the system calls fail, and as I said above, the OS reports
that the interface has gone promiscuous.
Any help is appreciated.