All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] Bridge and PACKET-socket
@ 2004-01-05 22:33 Luke Gorrie
  2004-01-05 23:13 ` Bart De Schuymer
  0 siblings, 1 reply; 10+ messages in thread
From: Luke Gorrie @ 2004-01-05 22:33 UTC (permalink / raw)
  To: bridge

Ahoy,

I've encountered some confusing semantics with using PACKET(7) sockets
on bridge-enslaved interfaces. Specifically, if my socket accepts all
types of frame (bind() to ETH_P_ALL) then it gets all packets; but if
it accepts any specific type (e.g. ETH_P_IP), then it receives no
packets at all.

That is how it's coded in net/core/dev.c's netif_receive_skb(). First
ETH_P_ALL handlers are called, then the bridge, and then -- only if
the bridge declines the packet -- the protocol-specific handlers are
called.

My interpretation is that ETH_P_ALL handlers are expected to be
programs like tcpdump which can safely be fed all packets, whereas
more specific handlers are expected to be actual protocol
implementations that shouldn't run directly on enslaved ports.

Is that correct?

In my case I am implementing a specific protocol in userspace (via
PACKET-socket) and this protocol must run directly on enslaved
ports. It's an old layer-2 neighbour-discovery protocol that has to
operate on physical ports, below other abstractions like
bridges. ("don't ask.") It looks like I can't do this today, unless I
use ETH_P_ALL, perhaps with a BPF filter -- but I'm fearful of
introducing overhead on all packets.

I was thinking of adding an extra hashtable in dev.c, like ptype_base
but processed before offering packets to the bridge. Then an ioctl to
have a PACKET-socket moved into this table if it's supposed to receive
packets on enslaved interfaces.

Does that sound like a good solution?

Cheers,
Luke


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [Bridge] Bridge and PACKET-socket
@ 2004-02-02 16:50 Eble, Dan
  0 siblings, 0 replies; 10+ messages in thread
From: Eble, Dan @ 2004-02-02 16:50 UTC (permalink / raw)
  To: 'bridge@osdl.org'

On Tuesday 13 January 2004 12:41:55 -0800, Bart De Schuymer wrote:
> Reading the man page is indeed confusing for a user, w.r.t. bridge ports.
> I think it would be more logical if all PF_PACKET
> sockets see the frames before the bridge code.

I agree.  I just ran into this problem trying to read bridge PDUs from a
daemon listening on a packet socket.  I'm glad I found this thread; it saved
me a lot of debugging time.

> How about placing the call to __handle_bridge() right after the second 
> list_for_each? If I'm not mistaken the relevant pt_pre->func that would
deal 
> with the packet will not have been executed yet, while those PF_PACKET 
> functions will already have been called...

Has anyone tested this in the two weeks since it was suggested?

-- 
Dan Eble <dane@aiinet.com>  _____  .
                           |  _  |/|
Applied Innovation Inc.    | |_| | |    "All Protocols MUST be odd"
http://www.aiinet.com/     |__/|_|_|      -- RFC 1661 (PPP)

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

end of thread, other threads:[~2004-02-02 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-05 22:33 [Bridge] Bridge and PACKET-socket Luke Gorrie
2004-01-05 23:13 ` Bart De Schuymer
2004-01-05 23:50   ` Luke Gorrie
2004-01-08 16:34     ` Jason Lunz
2004-01-12 21:02       ` Luke Gorrie
2004-01-12 21:47         ` Bart De Schuymer
2004-01-12 22:14           ` Luke Gorrie
2004-01-13 19:35             ` Bart De Schuymer
2004-01-12 22:24         ` [Bridge] " Jason Lunz
2004-02-02 16:50 [Bridge] " Eble, Dan

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.