[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Promiscuous Ethernet problem



Hi,

I found that there has been a correction in the ethernet driver
regarding multicasts and promiscuous mode after the latest
developer board release.

> * Revision 1.21  2001/11/23 11:54:49  starvik
> * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list
> * Removed compiler warnings

I will send you the updated files I have announced on this list
the last days. Unfortunately I can't send them to you all because
the mail list doesn't allow attachments > 30 KByte.

The updated files will probably not work if you are not using
the latest developer board release. 

PS. I couldn't get your code to work properly
(I get setsockopt: Invalid argument) but I'm pretty sure that
the change above will solve your problem. DS.

/Mikael

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com]On">mailto:owner-dev-etrax@xxxxxxx.com]On
Behalf Of ulf.sjostedt@xxxxxxx.se
Sent: Monday, July 01, 2002 4:40 PM
To: dev-etrax
Subject: Promiscuous Ethernet problem


Hi there!


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
using setsockopt.
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".
Fine.

However, the only packets received by my application are those
addressed to the ETRAX's own MAC address or the broadcast
address (ff:ff:ff:ff:ff:ff).

What am I doing wrong?


Here's how I set up the interface:

int s;
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.



/Ulf Sjöstedt
SaabTech Systems
ulf.sjostedt@xxxxxxx.se