mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Danny Kukawka <danny.kukawka@bisect.de>
To: "David S. Miller" <davem@davemloft.net>
Cc: Danny Kukawka <dkukawka@suse.de>,
	John Crispin <blogic@openwrt.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 02/10] lantiq_etop: set addr_assign_type if random_ether_addr() used
Date: Fri, 17 Feb 2012 16:43:23 +0100	[thread overview]
Message-ID: <1329493411-25750-3-git-send-email-danny.kukawka@bisect.de> (raw)
In-Reply-To: <1329493411-25750-1-git-send-email-danny.kukawka@bisect.de>

Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.

v2: added comment, renamed bool variable to random_mac

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
---
 drivers/net/ethernet/lantiq_etop.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 85e2c6c..aee87fc 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -634,6 +634,7 @@ ltq_etop_init(struct net_device *dev)
 	struct ltq_etop_priv *priv = netdev_priv(dev);
 	struct sockaddr mac;
 	int err;
+	bool random_mac = false;
 
 	ether_setup(dev);
 	dev->watchdog_timeo = 10 * HZ;
@@ -646,11 +647,17 @@ ltq_etop_init(struct net_device *dev)
 	if (!is_valid_ether_addr(mac.sa_data)) {
 		pr_warn("etop: invalid MAC, using random\n");
 		random_ether_addr(mac.sa_data);
+		random_mac = true;
 	}
 
 	err = ltq_etop_set_mac_address(dev, &mac);
 	if (err)
 		goto err_netdev;
+
+	/*set addr_assign_type here, ltq_etop_set_mac_address would reset it*/
+	if (random_mac)
+		dev->addr_assign_type |= NET_ADDR_RANDOM;
+
 	ltq_etop_set_multicast_list(dev);
 	err = ltq_etop_mdio_init(dev);
 	if (err)
-- 
1.7.8.3


  parent reply	other threads:[~2012-02-17 15:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 15:43 [PATCH v2 00/10] Part 4: handle addr_assign_type for random addresses Danny Kukawka
2012-02-17 15:43 ` [PATCH v2 01/10] au1000_eth: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
2012-02-17 20:59   ` David Miller
2012-02-17 15:43 ` Danny Kukawka [this message]
2012-02-17 21:00   ` [PATCH 02/10] lantiq_etop: set addr_assign_type if random_ether_addr() used David Miller
2012-02-17 21:24     ` Danny Kukawka
2012-02-17 15:43 ` [PATCH v2 03/10] davinci_emac: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
2012-02-17 21:00   ` David Miller
2012-02-17 15:43 ` [PATCH v2 04/10] xilinx ll_temac: " Danny Kukawka
2012-02-17 21:00   ` David Miller
2012-02-17 15:43 ` [PATCH v2 05/10] igbvf: reset netdevice addr_assign_type if changed Danny Kukawka
2012-02-17 21:01   ` David Miller
2012-02-17 15:43 ` [PATCH v2 06/10] batman-adv: use eth_hw_addr_random() instead of random_ether_addr() Danny Kukawka
2012-02-17 21:01   ` David Miller
2012-02-17 15:43 ` [PATCH v2 07/10] cisco/enic: " Danny Kukawka
2012-02-17 21:01   ` David Miller
2012-02-17 21:35     ` Danny Kukawka
2012-02-17 15:43 ` [PATCH v2 08/10] ethoc: set addr_assign_type if random_ether_addr() used Danny Kukawka
2012-02-17 21:02   ` David Miller
2012-02-17 15:43 ` [PATCH v2 09/10] atheros eth: " Danny Kukawka
2012-02-17 21:02   ` David Miller
2012-02-17 15:43 ` [PATCH 10/10] UML net: " Danny Kukawka
2012-02-17 15:55   ` Richard Weinberger
2012-02-17 20:17     ` David Miller
2012-02-17 21:05   ` David Miller

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=1329493411-25750-3-git-send-email-danny.kukawka@bisect.de \
    --to=danny.kukawka@bisect.de \
    --cc=blogic@openwrt.org \
    --cc=davem@davemloft.net \
    --cc=dkukawka@suse.de \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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®