Rpi zero usb ethernet to pfsense
-
regarding freebsd not reading mac id the devs there provided a patch to test but i have no clue on how to integrate it into pfsense, can some1 provide some help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220852
-
You would need to recompile the urndis module in FreeBSD and import it again to test in pfSense. Though you could test in FreeBSD directly instead.
I find it interesting that your device appears to be using the cdce driver. Connecting my Nexus 4 in a similar way gives log messages:
Apr 14 22:00:02 kernel ugen0.4: <lge>at usbus0 (disconnected) Apr 14 22:00:02 kernel ugen0.4: <lge>at usbus0 Apr 14 22:00:02 kernel urndis0: <rndis communications="" control="">on usbus0 Apr 14 22:00:02 kernel ue0: <usb ethernet="">on urndis0 Apr 14 22:00:02 kernel ue0: Ethernet address: 4a:aa:0d:9a:9b:59</usb></rndis></lge></lge>
Steve
-
Well this is raspberry pi so maybe the code is different to Nexus 4.
I can try it in freebsd directly but that patch provided isn't in the release so how do I add that and recompile and test, any guide would be helpful as I'm a beginner to this.
-
It's been a while but as I recall it should be pretty straight forward.
Bring up a FreeBSD 10.3 VM (or a real machine, whatever) and include the source code during the install.
Edit the five lines into the code at /usr/src/sys/dev/usb/net/if_urndis.c. It's only 5 lines so you can probably just edit them in manually or fetch and merge the .diff file.
Then go to: /usr/src/sys/modules/usb/urndis and run: make
The new modules should appear in that folder. You can sftp it out and into pfSense as you did with the original module.
Steve
-
thanks for the help, which location do i copy this module in pfsense or do i need to copy anywhere and add an entry to load it on boot?
-
i loaded up freebsd 11 in VM then added the patch and compiled and the resulting if_rndis.ko file i copied over to pfsense and loaded it on boot using the loader.conf file but im still seeing the same behavior
Enter an option: ugen0.2: <linux 4.9.37+="" with="" 20980000.usb=""> at usbus0 cdce0: <rndis communications="" control=""> on usbus0 cdce0: No valid alternate setting found device_attach: cdce0 attach returned 6 cdce0: <rndis ethernet="" data=""> on usbus0 cdce0: faking MAC address ue0: <usb ethernet=""> on cdce0 ue0: Ethernet address: 2a:c9:1a:f8:7f:00</usb></rndis></rndis></linux>
to check if the module i loaded from pfsense shell i typed kldload /boot/modules/if_urndis.ko and it says
kldload: can't load /boot/modules/if_urndis.ko: module already loaded or in kern el
so im a bit confused if my compiled ko is being used or the in kernel one in pfsense, if u think the above is correct shall i report it to the dev on freebsd that the patch doesnt work?
-
The if_urnidis kernel module is not included with pfSense either in the kernel or as a loadable module so if you are seeing that it means you have copied it across to the correct place (/boot/modules) and loaded it correctly at boot time with a line in loader.conf.local.
If that was the module created with the patched code rather than whatever you had there before then it looks like the patch did not work.
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. What happens if you remove the module entirely and boot without it?
Steve
-
i have no other module installed, as per ur instructions i added that patch and ran make and it gave me this id_urndis.ko file which i copied over to pfsense and loaded it at boot.
do u mean remove the rpi and boot pfsense, its same if i plug rpi when pfsense is running or keep rpi running and boot pfsense. the usbconfig etc commands give same output with and without the if_urndis.ko file loaded.
i updated the thread at freebsd bugzilla, ill mentioned ur point about its not using the rndis driver there
-
Ah, well if it does the same thing without any urndis module present then clearly it's not using that at all just the cdce driver which is in kernel in pfSense.
So patching urndis ain't gonna do anything. ;)
I've seen exactly that same issue with cdce.
Wow, long time ago! https://forum.pfsense.org/index.php?topic=26563.0
No change. ::)
Steve
-
yes i read that thread sometime back but is there any way to load the urndis driver and make the kernel use that?
-
If the presented USB vendor and product IDs are registered by cdce(4) then the kernel will try to use that driver.
As I understand it the urndis driver will try to attach to anything presenting as an rndis device so it might attach if cdce was not in kernel. I'm not sure there's any way to unload it short of re-compiling the kernel without it.
Steve
-
ok so for now it means no way to solve this
-
Unfortunately I think that's true. It would need to be something from upstream anyway.
I have no idea where that device even is I was testing with anymore. ;)
Steve