From: Danny Kukawka <danny.kukawka@bisect.de>
To: "David S. Miller" <davem@davemloft.net>
Cc: Danny Kukawka <dkukawka@suse.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Neil Horman <nhorman@tuxdriver.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
Randy Dunlap <rdunlap@xenotime.net>
Subject: [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called
Date: Thu, 9 Feb 2012 20:48:53 +0100 [thread overview]
Message-ID: <1328816934-11508-2-git-send-email-danny.kukawka@bisect.de> (raw)
In-Reply-To: <1328816934-11508-1-git-send-email-danny.kukawka@bisect.de>
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 <danny.kukawka@bisect.de>
---
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
next prev parent reply other threads:[~2012-02-09 19:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 19:48 [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses Danny Kukawka
2012-02-09 19:48 ` Danny Kukawka [this message]
2012-02-13 5:50 ` [PATCH v2 1/2] eth: reset addr_assign_type if eth_mac_addr() called David Miller
2012-02-09 19:48 ` [PATCH 2/2] rename dev_hw_addr_random and remove redundant second Danny Kukawka
2012-02-09 20:11 ` Ben Hutchings
2012-02-13 5:50 ` David Miller
2012-02-09 20:09 ` [PATCH v2 0/2] Part 1: handle addr_assign_type for random addresses Jeff Kirsher
2012-07-02 18:55 ` Shuah Khan
2012-07-02 19:23 ` Jeff Kirsher
2012-07-02 19:41 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328816934-11508-2-git-send-email-danny.kukawka@bisect.de \
--to=danny.kukawka@bisect.de \
--cc=davem@davemloft.net \
--cc=dkukawka@suse.de \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=rdunlap@xenotime.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®