[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328735457-29986-2-git-send-email-danny.kukawka@bisect.de>
Date: Wed, 8 Feb 2012 22:10:08 +0100
From: Danny Kukawka <danny.kukawka@...ect.de>
To: "David S. Miller" <davem@...emloft.net>
Cc: Danny Kukawka <dkukawka@...e.de>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 01/50] eth: reset addr_assign_type if eth_mac_addr() called
If eth_mac_addr() get called, usually if SIOCSIFHWADDR was
used to change the MAC of a ethernet device, reset the
addr_assign_type to NET_ADDR_PERM if the state was
NET_ADDR_RANDOM before. Reset the state since the MAC is
no longer random at least not from the kernel side.
Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
---
net/ethernet/eth.c | 4 ++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a246836..9d68142 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -288,6 +288,10 @@ int eth_mac_addr(struct net_device *dev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ /* if device marked as NET_ADDR_RANDOM, reset it */
+ if (dev->addr_assign_type & NET_ADDR_RANDOM)
+ dev->addr_assign_type ^= NET_ADDR_RANDOM;
+
return 0;
}
EXPORT_SYMBOL(eth_mac_addr);
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists