Commit 1056bd51 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

bridge: prevent bridging wrong device

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 22402529
...@@ -377,12 +377,16 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) ...@@ -377,12 +377,16 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
struct net_bridge_port *p; struct net_bridge_port *p;
int err = 0; 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; return -EINVAL;
/* No bridging of bridges */
if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit) if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit)
return -ELOOP; return -ELOOP;
/* Device is already being bridged */
if (dev->br_port != NULL) if (dev->br_port != NULL)
return -EBUSY; return -EBUSY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment