All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luke Gorrie <luke@member.fsf.org>
To: bridge@osdl.org
Subject: [Bridge] Bridge and PACKET-socket
Date: Mon, 05 Jan 2004 22:33:20 -0000	[thread overview]
Message-ID: <lhznd2do0m.fsf@dodo.bluetail.com> (raw)

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


             reply	other threads:[~2004-01-05 22:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 22:33 Luke Gorrie [this message]
2004-01-05 23:13 ` [Bridge] Bridge and PACKET-socket 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lhznd2do0m.fsf@dodo.bluetail.com \
    --to=luke@member.fsf.org \
    --cc=bridge@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.