Bug 220852 - [cdce] [usb] raspberry pi or anything that can emulate Ethernet gadget over usb mac id not read
Summary: [cdce] [usb] raspberry pi or anything that can emulate Ethernet gadget over u...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 11.0-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-19 12:00 UTC by Bipin Chandra
Modified: 2019-12-29 19:48 UTC (History)
3 users (show)

See Also:


Attachments
USB RNDIS (694 bytes, patch)
2017-07-20 08:09 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bipin Chandra 2017-07-19 12:00:41 UTC
raspberry pi zero have a kernel module which allows it to use the OTG port to generate a virtual USB Ethernet adapter (RNDIS Gadget) and we can define its host and device mac id and it works fine connecting the pi to mac OS, windows or Linux but when you connect it to pfsense or any FreeBSD based system then those ignore the supplied mac id and they always generate a random mac id making it almost useless to be able to use on pfsense etc. I had reported this on the pfsense bug request portal and i was told to report it here.

when the pi is connected to pfsense using USB the below is generated

ugen0.2: <Linux 4.9.37+ with 20980000.usb> at usbus0
cdce0: on usbus0
cdce0: No valid alternate setting found
device_attach: cdce0 attach returned 6
cdce0: on usbus0
cdce0: faking MAC address
ue0: on cdce0
ue0: Ethernet address: 2a:3f:38:a3:80:00
Comment 1 Bipin Chandra 2017-07-19 12:59:19 UTC
ugen0.2: <RNDISEthernet Gadget Linux 4.9.37+ with 20980000.usb> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0002  <Communication device>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0525
  idProduct = 0xa4a2
  bcdDevice = 0x0409
  iManufacturer = 0x0001  <Linux 4.9.37+ with 20980000.usb>
  iProduct = 0x0002  <RNDIS/Ethernet Gadget>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0002
Comment 2 Ed Maste freebsd_committer freebsd_triage 2017-07-19 17:59:02 UTC
Do you get the same MAC on macOS / Windows / Linux?

Independent of obtaining the "proper" MAC address the current approach for generating a randomized MAC (from r184610) is somewhat bogus and should also be revisited.
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2017-07-19 20:24:27 UTC
Could you dump the USB messages when this device is connected under FreeBSD:

Note the numbers after ugenX.Y:

Before plugging the device, run:

usbdump -i usbusX -F Y -s 65536 -vvv > log.txt

After plugging CTRL+C the usbdump.

Likely the Linux OTG module is storing the MAC address in a way that is currently not compatible. This should be easy to figure out by code inspection.
Comment 4 Bipin Chandra 2017-07-20 06:06:30 UTC
i use the below command in the rpi cmdline.txt file to load the module which also sets both the device and host mac id and yes i get the same host mac id on macos/windows/linux

modules-load=dwc2,g_ether g_ether.use_eem=0 g_ether.dev_addr=8e:7a:7e:37:6f:bb g_ether.host_addr=8e:7a:7e:37:6f:aa


usbdump -i usbus0 -f 2 -s 65536 -vvv > log.txt

10:02:39.038743 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 01 00 00 12 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 18 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.040632 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=20,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 18 bytes
 0000  12 01 00 02 02 00 00 40  25 05 A2 A4 09 04 01 02  |.......@%.......|
 0010  00 02 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |..              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.043696 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.045496 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  04 03 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |..              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.045546 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 03 00 00 04 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 4 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.046485 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 4 bytes
 0000  04 03 09 04 -- -- -- --  -- -- -- -- -- -- -- --  |....            |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.046535 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 01 03 09 04 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.047472 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  40 03 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |@.              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.047521 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 01 03 09 04 40 00  -- -- -- -- -- -- -- --  |......@.        |
 frame[1] READ 64 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.048467 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=64,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 64 bytes
 0000  40 03 4C 00 69 00 6E 00  75 00 78 00 20 00 34 00  |@.L.i.n.u.x. .4.|
 0010  2E 00 39 00 2E 00 33 00  37 00 2B 00 20 00 77 00  |..9...3.7.+. .w.|
 0020  69 00 74 00 68 00 20 00  32 00 30 00 39 00 38 00  |i.t.h. .2.0.9.8.|
 0030  30 00 30 00 30 00 30 00  2E 00 75 00 73 00 62 00  |0.0.0.0...u.s.b.|
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.048523 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 02 03 09 04 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.049466 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  2C 03 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |,.              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.049519 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 02 03 09 04 2C 00  -- -- -- -- -- -- -- --  |......,.        |
 frame[1] READ 44 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.050466 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=44,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 44 bytes
 0000  2C 03 52 00 4E 00 44 00  49 00 53 00 2F 00 45 00  |,.R.N.D.I.S./.E.|
 0010  74 00 68 00 65 00 72 00  6E 00 65 00 74 00 20 00  |t.h.e.r.n.e.t. .|
 0020  47 00 61 00 64 00 67 00  65 00 74 00 -- -- -- --  |G.a.d.g.e.t.    |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.050543 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 02 00 00 09 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 9 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.051466 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=12,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 9 bytes
 0000  09 02 4B 00 02 02 00 C0  01 -- -- -- -- -- -- --  |..K......       |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.051518 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 00 02 00 00 4B 00  -- -- -- -- -- -- -- --  |......K.        |
 frame[1] READ 75 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.052717 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=76,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 75 bytes
 0000  09 02 4B 00 02 02 00 C0  01 08 0B 00 02 02 06 00  |..K.............|
 0010  06 09 04 00 00 01 02 02  FF 04 05 24 00 10 01 05  |...........$....|
 0020  24 01 00 01 04 24 02 00  05 24 06 00 01 07 05 82  |$....$...$......|
 0030  03 08 00 09 09 04 01 00  02 0A 00 00 05 07 05 81  |................|
 0040  02 00 02 00 07 05 01 02  00 02 00 -- -- -- -- --  |...........     |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.052761 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 00 00 00 00 00 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.053718 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  00 00 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |..              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.053955 usbus0.2 SUBM-CTRL-EP=00000000,SPD=HIGH,NFR=1,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  00 09 02 00 00 00 00 00  -- -- -- -- -- -- -- --  |........        |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.054835 usbus0.2 DONE-CTRL-EP=00000000,SPD=HIGH,NFR=1,SLEN=0,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.064672 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 04 03 09 04 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.065733 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  3A 03 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |:.              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.065781 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 04 03 09 04 3A 00  -- -- -- -- -- -- -- --  |......:.        |
 frame[1] READ 58 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.066734 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=60,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 58 bytes
 0000  3A 03 52 00 4E 00 44 00  49 00 53 00 20 00 43 00  |:.R.N.D.I.S. .C.|
 0010  6F 00 6D 00 6D 00 75 00  6E 00 69 00 63 00 61 00  |o.m.m.u.n.i.c.a.|
 0020  74 00 69 00 6F 00 6E 00  73 00 20 00 43 00 6F 00  |t.i.o.n.s. .C.o.|
 0030  6E 00 74 00 72 00 6F 00  6C 00 -- -- -- -- -- --  |n.t.r.o.l.      |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.071987 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  A1 80 00 00 00 00 1C 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 28 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.073528 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=0,IVAL=0,ERR=STALLED
 frame[0] WRITE 8 bytes
 frame[1] READ 0 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0x8a1a5 <OPEN|DID_DMA_DELAY|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|DOING_CALLBACK|0>
10:02:39.085769 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 05 03 09 04 02 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 2 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.086618 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=4,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 2 bytes
 0000  28 03 -- -- -- -- -- --  -- -- -- -- -- -- -- --  |(.              |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.086667 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  80 06 05 03 09 04 28 00  -- -- -- -- -- -- -- --  |......(.        |
 frame[1] READ 40 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.087617 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=40,IVAL=0,ERR=0
 frame[0] WRITE 8 bytes
 frame[1] READ 40 bytes
 0000  28 03 52 00 4E 00 44 00  49 00 53 00 20 00 45 00  |(.R.N.D.I.S. .E.|
 0010  74 00 68 00 65 00 72 00  6E 00 65 00 74 00 20 00  |t.h.e.r.n.e.t. .|
 0020  44 00 61 00 74 00 61 00  -- -- -- -- -- -- -- --  |D.a.t.a.        |
 flags 0x10 <PROXY_BUFFER|0>
 status 0xca1a1 <OPEN|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.091911 usbus0.2 SUBM-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=8,IVAL=0
 frame[0] WRITE 8 bytes
 0000  A1 80 00 00 01 00 1C 00  -- -- -- -- -- -- -- --  |........        |
 frame[1] READ 28 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xea1a3 <OPEN|TRANSFERRING|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
10:02:39.093408 usbus0.2 DONE-CTRL-EP=00000080,SPD=HIGH,NFR=2,SLEN=0,IVAL=0,ERR=STALLED
 frame[0] WRITE 8 bytes
 frame[1] READ 0 bytes
 flags 0x10 <PROXY_BUFFER|0>
 status 0xaa1a5 <OPEN|DID_DMA_DELAY|STARTED|CONTROL_XFR|CONTROL_HDR|BDMA_ENABLE|BDMA_SETUP|CURR_DMA_SET|DOING_CALLBACK|0>

34 packets captured
34 packets received by filter
0 packets dropped by kernel
Comment 5 Hans Petter Selasky freebsd_committer freebsd_triage 2017-07-20 08:08:14 UTC
Can you dump the USB descriptor for this device?

usbconfig -d X.Y dump_curr_config_desc

Can you try the attached patch?

--HPS
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2017-07-20 08:09:33 UTC
Created attachment 184536 [details]
USB RNDIS
Comment 7 Bipin Chandra 2017-07-20 09:15:03 UTC
(In reply to Hans Petter Selasky from comment #5)

usbconfig -d 0.2 dump_curr_config_desc

ugen0.2: <RNDISEthernet Gadget Linux 4.9.37+ with 20980000.usb> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)


 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x004b
    bNumInterfaces = 0x0002
    bConfigurationValue = 0x0002
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x00c0
    bMaxPower = 0x0001

    Additional Descriptor

    bLength = 0x08
    bDescriptorType = 0x0b
    bDescriptorSubType = 0x00
     RAW dump:
     0x00 | 0x08, 0x0b, 0x00, 0x02, 0x02, 0x06, 0x00, 0x06


    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0002  <Communication device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x00ff
      iInterface = 0x0004  <RNDIS Communications Control>

      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x00
       RAW dump:
       0x00 | 0x05, 0x24, 0x00, 0x10, 0x01


      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x05, 0x24, 0x01, 0x00, 0x01


      Additional Descriptor

      bLength = 0x04
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x04, 0x24, 0x02, 0x00


      Additional Descriptor

      bLength = 0x05
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x05, 0x24, 0x06, 0x00, 0x01


     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0008
        bInterval = 0x0009
        bRefresh = 0x0000
        bSynchAddress = 0x0000


    Interface 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0002
      bInterfaceClass = 0x000a  <CDC-data>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0005  <RNDIS Ethernet Data>

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000

     Endpoint 1
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0001  <OUT>
        bmAttributes = 0x0002  <BULK>
        wMaxPacketSize = 0x0200
        bInterval = 0x0000
        bRefresh = 0x0000
        bSynchAddress = 0x0000
Comment 8 Bipin Chandra 2017-07-20 09:17:31 UTC
(In reply to Hans Petter Selasky from comment #6)

i wont be able to test this patch because im using pfsense and im trying to make this work with that and secondly im not a developer so its out of my scope. Ill ask some1 on pfsense forum if they can give it a try
Comment 9 Bipin Chandra 2017-07-24 09:25:56 UTC
tried the patch but the behavior is still same
Comment 10 Bipin Chandra 2017-07-24 12:56:11 UTC
as per one of the members at pfsense i was told the below:

"It still concerns me that the device created is cdce0 and not urndis0. It looks to me as though it's not even using the urndis driver"
Comment 11 Jesper Schmitz Mouridsen freebsd_committer freebsd_triage 2019-12-29 19:48:22 UTC
(In reply to Bipin Chandra from comment #10)

It works on 12.1-RELEASE by kldunload if_cdce.ko, after the Zero has booted.