Re: [PATCH 37/50] usbnet: set addr_assign_type if random_ether_addr() used

2 messages, 2 authors, 2012-02-09 · open the first message on its own page

Re: [PATCH 37/50] usbnet: set addr_assign_type if random_ether_addr() used

From: Bjørn Mork <bjorn@mork.no>
Date: 2012-02-09 06:58:12

Oliver Neukum [off-list ref] writes:
Am Mittwoch, 8. Februar 2012, 22:10:44 schrieb Danny Kukawka:
quoted
Set addr_assign_type correctly to NET_ADDR_RANDOM in case
a random MAC address was generated and assigned to the netdevice.

Signed-off-by: Danny Kukawka <redacted>
---
 drivers/net/usb/usbnet.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index fae0fbd..7bd07d7 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1365,6 +1365,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	dev->net = net;
 	strcpy (net->name, "usb%d");
 	memcpy (net->dev_addr, node_id, sizeof node_id);
+	net->addr_assign_type |= NET_ADDR_RANDOM;
 
 	/* rx and tx sides can use different message sizes;
 	 * bind() should set rx_urb_size in that case.
Don't you set the flag too early here? By that time we don't know
whether the device provides a real MAC, do we?
Maybe it makes sense to set it here anyway since usbnet provides this
default random address, and let the minidrivers which set a real mac
also clear the flag?  But in that case the patch need to clear the flag
everywhere a minidriver currently updates the address.


Bjørn

Re: [PATCH 37/50] usbnet: set addr_assign_type if random_ether_addr() used

From: Oliver Neukum <oliver@neukum.org>
Date: 2012-02-09 14:52:54

Am Donnerstag, 9. Februar 2012, 07:57:42 schrieb Bjørn Mork:
quoted
Don't you set the flag too early here? By that time we don't know
whether the device provides a real MAC, do we?
Maybe it makes sense to set it here anyway since usbnet provides this
default random address, and let the minidrivers which set a real mac
also clear the flag?  But in that case the patch need to clear the flag
everywhere a minidriver currently updates the address.
Doable, but where is the benefit? It seems better to me to make an effort
to guess as well as possible in the common code.

	Regards
		Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help