Commit 171cfae6 authored by Lech Perczak's avatar Lech Perczak Committed by Paolo Abeni
Browse files

rndis_host: limit scope of bogus MAC address detection to ZTE devices



Reporting of bogus MAC addresses and ignoring configuration of new
destination address wasn't observed outside of a range of ZTE devices,
among which this seems to be the common bug. Align rndis_host driver
with implementation found in cdc_ether, which also limits this workaround
to ZTE devices.

Suggested-by: default avatarBjørn Mork <bjorn@mork.no>
Cc: Kristian Evensen <kristian.evensen@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarLech Perczak <lech.perczak@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 36e74797
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -418,9 +418,6 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
		goto halt_fail_and_release;
	}

	if (bp[0] & 0x02)
		eth_hw_addr_random(net);
	else
	eth_hw_addr_set(net, bp);

	/* set a nonzero filter to enable data transfers */
@@ -463,6 +460,16 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
	return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS);
}

static int zte_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
{
	int status = rndis_bind(dev, intf);

	if (!status && (dev->net->dev_addr[0] & 0x02))
		eth_hw_addr_random(dev->net);

	return status;
}

void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
{
	struct rndis_halt	*halt;
@@ -615,7 +622,7 @@ static const struct driver_info zte_rndis_info = {
	.description =	"ZTE RNDIS device",
	.flags =	FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
	.data =		RNDIS_DRIVER_DATA_DST_MAC_FIXUP,
	.bind =		rndis_bind,
	.bind =		zte_rndis_bind,
	.unbind =	rndis_unbind,
	.status =	rndis_status,
	.rx_fixup =	rndis_rx_fixup,