[PATCH] net: dsa: Inherit dev addr from master

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Xiaofei Shen <xiaofeis@xxxxxxxxxxxxxx>

When we create slave netdevice, the dev addr is inherited from master
but the master dev addr maybe NULL at that time, so inherit it again
while opening the slave.

Signed-off-by: Xiaofei Shen <xiaofeis@xxxxxxxxxxxxxx>
Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
---
 net/dsa/slave.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 8e64c4e947c6..5f95c538b58c 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -77,7 +77,9 @@ static int dsa_slave_open(struct net_device *dev)
 	if (!(master->flags & IFF_UP))
 		return -ENETDOWN;
 
-	if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
+	if (!is_valid_ether_addr(dev->dev_addr)) {
+		eth_hw_addr_inherit(dev, master);
+	} else if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
 		err = dev_uc_add(master, dev->dev_addr);
 		if (err < 0)
 			goto out;
-- 
2.20.1




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux