From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: nneul@mst.edu, netdev@vger.kernel.org
Subject: [PATCH] bridge: prevent bridging wrong device
Date: Wed, 4 Nov 2009 09:47:13 -0800 [thread overview]
Message-ID: <20091104094713.1983a0b6@nehalam> (raw)
In-Reply-To: <20091102.000756.222203879.davem@davemloft.net>
The bridge code assumes ethernet addressing, so be more strict in
the what is allowed. This showed up when GRE had a bug and was not
using correct address format.
Add some more comments for increased clarity.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/bridge/br_if.c 2009-10-29 15:18:48.363916679 -0700
+++ b/net/bridge/br_if.c 2009-11-03 19:39:17.733252912 -0800
@@ -377,12 +377,16 @@ int br_add_if(struct net_bridge *br, str
struct net_bridge_port *p;
int err = 0;
- if (dev->flags & IFF_LOOPBACK || dev->type != ARPHRD_ETHER)
+ /* Don't allow bridging non-ethernet like devices */
+ if ((dev->flags & IFF_LOOPBACK) ||
+ dev->type != ARPHRD_ETHER || dev->addr_len != ETH_ALEN)
return -EINVAL;
+ /* No bridging of bridges */
if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit)
return -ELOOP;
+ /* Device is already being bridged */
if (dev->br_port != NULL)
return -EBUSY;
next prev parent reply other threads:[~2009-11-04 17:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <846C5B546E47494CBBD796CA8CA1617EA3B414@MST-VMAIL1.srv.mst.edu>
[not found] ` <20091029170631.GA29405@gondor.apana.org.au>
2009-10-29 18:39 ` How to use gretap with bridge? Neulinger, Nathan
2009-10-29 19:01 ` Neulinger, Nathan
2009-10-29 20:00 ` Stephen Hemminger
2009-10-29 20:22 ` Neulinger, Nathan
2009-10-29 22:12 ` Stephen Hemminger
2009-10-29 22:24 ` [RFC] bridge: check address size Stephen Hemminger
2009-11-02 8:07 ` David Miller
2009-11-02 16:54 ` Stephen Hemminger
2009-11-04 17:47 ` Stephen Hemminger [this message]
2009-11-06 5:08 ` [PATCH] bridge: prevent bridging wrong device David Miller
2009-10-29 20:59 ` How to use gretap with bridge? Neulinger, Nathan
2009-10-29 22:04 ` Neulinger, Nathan
2009-10-29 23:47 ` Herbert Xu
2009-10-29 23:51 ` Neulinger, Nathan
2009-10-30 15:51 ` Herbert Xu
2009-10-30 16:39 ` Stephen Hemminger
2009-10-30 19:27 ` David Miller
2009-10-30 17:08 ` Neulinger, Nathan
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=20091104094713.1983a0b6@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nneul@mst.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).