All of lore.kernel.org
 help / color / mirror / Atom feed
* SOCK_RAW does not receive broadcast (with VLAN unless PROMISC)
@ 2009-06-08 18:05 Gil Beniamini
  2009-06-08 18:48 ` Alan Cox
  2009-06-08 21:34   ` David Miller
  0 siblings, 2 replies; 15+ messages in thread
From: Gil Beniamini @ 2009-06-08 18:05 UTC (permalink / raw)
  To: linux-kernel

Dear Linux Experts,

My application is using PF_PACKET and SOCK_RAW in order to receive all
Ethernet packets for the machine-unicast MAC plus all broadcast
packets (like ARP broadcast).

That worked OK with kernel 2.6.20 (Ubuntu 7.04 with or without VLAN).

Now with kernel 2.6.28 (Ubuntu 9.04) it works OK only without-VLAN,
but with VLAN the application receive only packets for the
machine-unicast MAC, but no broadcast (like ARP broadcast) packets,
only if I set the socket to PROMISC mode, I start receive also
broadcast packets.

To me it seems a bug, as SOCK_RAW should pass all ‘received’ packet
(including broadcast) to the application, without the need for PROMISC
(which cause my machine to receive other machine unicast  packets, and
filter those by software)!

The original application:

sock=socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
memset((char *) &sockad, 0, sizeof(sockad));
sockad.sll_family = PF_PACKET;
sockad.sll_protocol = htons(ETH_P_ALL);
sockad.sll_ifindex = ethreq.ifr_ifindex;//the relevant unit number



Now the workaround is to set (unwanted) PROMISC mode:

ioctl(sock,SIOCGIFFLAGS,&ethreq);
ethreq.ifr_flags|=IFF_PROMISC; // why does 9.04 need this (+0x100) at
least once?!
ioctl(sock,SIOCSIFFLAGS,&ethreq);


Many thanks in advance,
Gil Beniamini
gil.beniamini@gmail.com

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-06-10 15:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 18:05 SOCK_RAW does not receive broadcast (with VLAN unless PROMISC) Gil Beniamini
2009-06-08 18:48 ` Alan Cox
2009-06-08 21:34 ` David Miller
2009-06-08 21:34   ` David Miller
2009-06-09 10:59   ` Patrick McHardy
2009-06-09 11:27     ` Gil Beniamini
2009-06-09 11:40       ` Patrick McHardy
2009-06-09 13:08         ` Gil Beniamini
2009-06-09 13:14           ` Patrick McHardy
2009-06-09 19:30           ` Brent Cook
2009-06-10 14:24             ` Gil Beniamini
2009-06-10 14:32               ` Patrick McHardy
2009-06-10 14:48                 ` Gil Beniamini
2009-06-10 15:00                   ` Patrick McHardy
     [not found]                   ` <20090610170108.7710c64b@tux.DEF.witbe.net>
2009-06-10 15:29                     ` Gil Beniamini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.