瀏覽代碼

[BRIDGE]: Assign random address.

Assigning a valid random address to bridge device solves problems
when bridge device is brought up before adding real device to bridge.
When the first real device is added to the bridge, it's address
will overide the bridges random address.

Note: any device added to a bridge must already have a valid
ethernet address.
 br_add_if -> br_fdb_insert -> fdb_insert -> is_valid_ether_addr

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stephen Hemminger 17 年之前
父節點
當前提交
3ae412544c
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      net/bridge/br_device.c

+ 1 - 2
net/bridge/br_device.c

@@ -157,8 +157,7 @@ static struct ethtool_ops br_ethtool_ops = {
 
 
 void br_dev_setup(struct net_device *dev)
 void br_dev_setup(struct net_device *dev)
 {
 {
-	memset(dev->dev_addr, 0, ETH_ALEN);
-
+	random_ether_addr(dev->dev_addr);
 	ether_setup(dev);
 	ether_setup(dev);
 
 
 	dev->do_ioctl = br_dev_ioctl;
 	dev->do_ioctl = br_dev_ioctl;