Commit cc6ba5fd authored by Bjørn Mork's avatar Bjørn Mork Committed by David S. Miller

net: qmi_wwan: prevent duplicate mac address on link (firmware bug workaround)

We normally trust and use the CDC functional descriptors provided by a
number of devices.  But some of these will erroneously list the address
reserved for the device end of the link.  Attempting to use this on
both the device and host side will naturally not work.

Work around this bug by ignoring the functional descriptor and assign a
random address instead in this case.
Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6483bdc9
...@@ -53,6 +53,9 @@ struct qmi_wwan_state { ...@@ -53,6 +53,9 @@ struct qmi_wwan_state {
struct usb_interface *data; struct usb_interface *data;
}; };
/* default ethernet address used by the modem */
static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3};
/* Make up an ethernet header if the packet doesn't have one. /* Make up an ethernet header if the packet doesn't have one.
* *
* A firmware bug common among several devices cause them to send raw * A firmware bug common among several devices cause them to send raw
...@@ -317,6 +320,12 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -317,6 +320,12 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
usb_driver_release_interface(driver, info->data); usb_driver_release_interface(driver, info->data);
} }
/* Never use the same address on both ends of the link, even
* if the buggy firmware told us to.
*/
if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr))
eth_hw_addr_random(dev->net);
/* make MAC addr easily distinguishable from an IP header */ /* make MAC addr easily distinguishable from an IP header */
if (possibly_iphdr(dev->net->dev_addr)) { if (possibly_iphdr(dev->net->dev_addr)) {
dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */
......
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