Commit e710d91d authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET]: Use random address in usb gadget driver.

parent ec731ce0
...@@ -1804,17 +1804,13 @@ eth_bind (struct usb_gadget *gadget) ...@@ -1804,17 +1804,13 @@ eth_bind (struct usb_gadget *gadget)
/* one random address for the gadget device ... both of these could /* one random address for the gadget device ... both of these could
* reasonably come from an id prom or a module parameter. * reasonably come from an id prom or a module parameter.
*/ */
get_random_bytes (net->dev_addr, ETH_ALEN); random_ether_addr(net->dev_addr);
net->dev_addr [0] &= 0xfe; // clear multicast bit
net->dev_addr [0] |= 0x02; // set local assignment bit (IEEE802)
#ifdef DEV_CONFIG_CDC #ifdef DEV_CONFIG_CDC
/* ... another address for the host, on the other end of the /* ... another address for the host, on the other end of the
* link, gets exported through CDC (see CDC spec table 41) * link, gets exported through CDC (see CDC spec table 41)
*/ */
get_random_bytes (node_id, sizeof node_id); random_ether_addr(node_id);
node_id [0] &= 0xfe; // clear multicast bit
node_id [0] |= 0x02; // set local assignment bit (IEEE802)
snprintf (ethaddr, sizeof ethaddr, "%02X%02X%02X%02X%02X%02X", snprintf (ethaddr, sizeof ethaddr, "%02X%02X%02X%02X%02X%02X",
node_id [0], node_id [1], node_id [2], node_id [0], node_id [1], node_id [2],
node_id [3], node_id [4], node_id [5]); node_id [3], node_id [4], node_id [5]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment