OPNsense Forum

Archive => 20.1 Legacy Series => Topic started by: Fowlerj on March 06, 2020, 08:06:52 pm

Title: usbconfig shows device, but unable to see it in assignments
Post by: Fowlerj on March 06, 2020, 08:06:52 pm
I'm trying to connect a Novatel MiFi8000 directly to the firewall via USB.  The device shows up in usbconfig, yet there is no option to configure it in the "Interface: Assignments" area.  Ideas?

thank you.


root@OPNsense:~ # usbconfig
ugen1.1: <Intel EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.1: <Intel EHCI root HUB> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <0x8086 XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen2.2: <vendor 0x8087 product 0x8000> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.2: <vendor 0x8087 product 0x8008> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.3: <Dell Dell USB Wired Entry Keyboard> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen0.4: <Generic USB2.0-CRW> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.2: <Novatel Wireless MiFi 8000> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)

and

root@OPNsense:~ # ifconfig
em0: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:26:55:e6:65:79
        hwaddr 00:26:55:e6:65:79
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
em1: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:26:55:e6:65:78
        hwaddr 00:26:55:e6:65:78
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
em2: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:26:55:e6:65:7b
        hwaddr 00:26:55:e6:65:7b
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
em3: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:26:55:e6:65:7a
        hwaddr 00:26:55:e6:65:7a
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
em4: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
        ether 68:05:ca:0c:fd:13
        hwaddr 68:05:ca:0c:fd:13
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=2018<VLAN_MTU,VLAN_HWTAGGING,WOL_MAGIC>
        ether c8:1f:66:29:c9:6e
        hwaddr c8:1f:66:29:c9:6e
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
        inet6 fe80::ca1f:66ff:fe29:c96e%re0 prefixlen 64 scopeid 0x6
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x7
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: lo
enc0: flags=0<> metric 0 mtu 1536
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        groups: enc
pflog0: flags=100<PROMISC> metric 0 mtu 33160
        groups: pflog
pfsync0: flags=0<> metric 0 mtu 1500
        groups: pfsync
        syncpeer: 0.0.0.0 maxupd: 128 defer: off


Title: Re: usbconfig shows device, but unable to see it in assignments
Post by: Fowlerj on April 01, 2020, 04:17:24 am
Ok.  So I ran this down and found it was an issue with the configuration information the Novatel was presenting to the if_urndis.ko module.  I submitted a bug request to FreeBSD along with the code necessary to fix the driver: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245152

I relied on so many resources out there to figure out this issue, fix it, compile a new kernel, and test it.  I will paste some below.

The essential part is adding this to the if_urndis.c module so it can recognize the hex presented by the Novatel:

        /* Novatel Wireless 8800/8000/etc */
        {USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(0xef),
                USB_IFACE_PROTOCOL(UIPROTO_RNDIS)},


Once you have the new if_urndis.ko module, be sure to create a /boot/loader.local.conf with the line:
if_urndis_load="YES"

Some of the resources I used:
https://www.adminbyaccident.com/freebsd/how-to-connect-a-freebsd-box-to-the-internet-through-an-android-device-via-an-usb-port/
https://forum.netgate.com/topic/117929/how-to-usb-tether-on-pfsense-2-4-as-router
http://openbsd-archive.7691.n7.nabble.com/patch-for-Inseego-Novatel-MiFi-8800L-as-urndis0-td361099.html
https://forum.netgate.com/topic/148053/pfsense-2-4-4-release-p3-attempting-to-usb-tether
https://www.freebsd.org/doc/handbook/network-usb-tethering.html
https://github.com/HardenedBSD/opnsense-tools
https://github.com/opnsense/tools
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239495
https://github.com/freebsd/freebsd/blob/master/sys/dev/usb/net/if_urndis.c

A pull request was submitted to FreeBSD via GitHub (I'm not familiar with the FreeBSD kernel patch submission process).  https://github.com/freebsd/freebsd/pull/428
Title: Re: usbconfig shows device, but unable to see it in assignments
Post by: Fowlerj on July 23, 2020, 03:10:33 am
Ok.  I updated to 20.1.7 too, and it doesn't seem that the if_urndis.ko module included has the patch.  As soon as I loaded my custom if_urndis.ko I get ue0.


Here is the binary/compiled module.  Unload the module (if it is loaded) kldunload if_urndis.ko.

Just extract it in /boot/kernel/.  It will replace the existing if_urndis.ko (which you should rename; e.g. if_urndis.ko.orig).

Then kldload if_urndis.ko to load the module.

Then you will magically have ue0!

Thanks.