Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932185Ab2BITtb (ORCPT ); Thu, 9 Feb 2012 14:49:31 -0500 Received: from wp188.webpack.hosteurope.de ([80.237.132.195]:43851 "EHLO wp188.webpack.hosteurope.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758377Ab2BITt2 (ORCPT ); Thu, 9 Feb 2012 14:49:28 -0500 From: Danny Kukawka To: "David S. Miller" Cc: Danny Kukawka , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Horman , Eric Dumazet , Randy Dunlap Subject: [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called Date: Thu, 9 Feb 2012 20:48:53 +0100 Message-Id: <1328816934-11508-2-git-send-email-danny.kukawka@bisect.de> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1328816934-11508-1-git-send-email-danny.kukawka@bisect.de> References: <1328816934-11508-1-git-send-email-danny.kukawka@bisect.de> X-bounce-key: webpack.hosteurope.de;danny.kukawka@bisect.de;1328816968;53a409b9; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1176 Lines: 34 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. v2: changed to bitops, removed if() Signed-off-by: Danny Kukawka --- net/ethernet/eth.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index a246836..a93af86 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -288,6 +288,8 @@ 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 */ + 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/