netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com, linux-usb-devel@lists.sourceforge.net
Subject: [PATCH] (3/4) usb gadget -- use random_ether_addr
Date: Fri, 9 Apr 2004 11:45:50 -0700	[thread overview]
Message-ID: <20040409114550.444abe30@dell_ss3.pdx.osdl.net> (raw)
In-Reply-To: <20040408145403.34382c96.davem@redhat.com>

Use new common code in ether_device.h for random_ether_addr.
Same exact code just in one common place.

diff -Nru a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
--- a/drivers/usb/gadget/ether.c	Fri Apr  9 11:39:51 2004
+++ b/drivers/usb/gadget/ether.c	Fri Apr  9 11:39:51 2004
@@ -1804,17 +1804,13 @@
 	/* one random address for the gadget device ... both of these could
 	 * reasonably come from an id prom or a module parameter.
 	 */
-	get_random_bytes (net->dev_addr, ETH_ALEN);
-	net->dev_addr [0] &= 0xfe;	// clear multicast bit
-	net->dev_addr [0] |= 0x02;	// set local assignment bit (IEEE802)
+	random_ether_addr(net->dev_addr);
 
 #ifdef	DEV_CONFIG_CDC
 	/* ... another address for the host, on the other end of the
 	 * link, gets exported through CDC (see CDC spec table 41)
 	 */
-	get_random_bytes (node_id, sizeof node_id);
-	node_id [0] &= 0xfe;	// clear multicast bit
-	node_id [0] |= 0x02;    // set local assignment bit (IEEE802)
+	random_ether_addr(node_id);
 	snprintf (ethaddr, sizeof ethaddr, "%02X%02X%02X%02X%02X%02X",
 		node_id [0], node_id [1], node_id [2],
 		node_id [3], node_id [4], node_id [5]);

  parent reply	other threads:[~2004-04-09 18:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-08 18:08 [PATCH] dummy -- support hardware address Stephen Hemminger
2004-04-08 21:54 ` David S. Miller
2004-04-08 22:09   ` Stephen Hemminger
2004-04-09 18:45   ` [PATCH] (1/4) add random_ether_addr to ether_device.h Stephen Hemminger
2004-04-09 18:45   ` Stephen Hemminger [this message]
2004-04-09 18:45   ` [PATCH] (2/4) set random address in dummy Stephen Hemminger
2004-04-09 18:47   ` [PATCH] (4/4) usbnet -- use random_ether_addr Stephen Hemminger
2004-04-10  4:16     ` David S. 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=20040409114550.444abe30@dell_ss3.pdx.osdl.net \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=netdev@oss.sgi.com \
    /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;
as well as URLs for NNTP newsgroup(s).