netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: "Neulinger, Nathan" <nneul@mst.edu>, <netdev@vger.kernel.org>
Subject: [RFC] bridge: check address size
Date: Thu, 29 Oct 2009 15:24:08 -0700	[thread overview]
Message-ID: <20091029152408.6c6cc29f@nehalam> (raw)
In-Reply-To: <20091029151222.156945ca@nehalam>

Check the address size of underlying device because the bridge assumes
the underlying device has ethernet address format. See forwarding table
and STP, for places where this true.

Also, add some comments to explain errors.

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-10-29 15:21:38.142667043 -0700
@@ -377,12 +377,17 @@ 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;
 


  reply	other threads:[~2009-10-29 22:24 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           ` Stephen Hemminger [this message]
2009-11-02  8:07             ` [RFC] bridge: check address size David Miller
2009-11-02 16:54               ` Stephen Hemminger
2009-11-04 17:47               ` [PATCH] bridge: prevent bridging wrong device Stephen Hemminger
2009-11-06  5:08                 ` 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=20091029152408.6c6cc29f@nehalam \
    --to=shemminger@vyatta.com \
    --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).