OK, I now understand the nature of the problem. See PR 252165.
Ali Abdallah 2024-11-13 21:26:53 UTC
The usb process/request code is completely broken when it comes to different threads sharing ue_lock (ioctl versus uether tick), the usb request code releases the acquired lock, making ioctl thread waiting for the same lock to be scheduled for execution, lovely!
To be more precise.
ioctly waiting for ue_lock, which is acquired by ue_tick, but then the tick code will call at some point usbd_do_request_flags, which will release the lock at the beginning (and then acquire it later), but in the meantime we have our "cute" ioctl thread waken-up only to report wrong media_status value!
vxasxfepbikrfqdruz 2022-10-22 04:06:44 UTC
Yeah, I was pretty surprised as well that this is entirely broken despite several USB to ethernet adapters being listed as supported by FreeBSD. This also affects pfSense and opnSense which you think would generate some attention about this, but they just seem to recommend not using USB adapters at all.
Ali Abdallah 2026-03-16 16:00:12 UTC
I got excited for a moment when I saw a commit referencing this bug, I thought that we have finally a solution, but unfortunately this is just a workaround, it is not a resolution for the issue, and it is only implemented for if_ure, other usb network drivers suffers also from this bug (if_muge, if_axge, if_rue, etc...)
TBH after all these years, I was expecting a real solution, at the usb request code level (see comment 38). If a workaround is to be implemented, there are easier solutions (see comment 3, patch https://bugs.freebsd.org/bugzilla/attachment.cgi?id=221274&action=diff) which needs to be extended also for other phys at the mii bus level.
So the MII layer driver was, is, and will be completely broken in FreeBSD.
And the number of failure modes from a driver bug seems unbounded. For example, after a dozen or so reboots yesterday, I had a stable system for about a day. Until I didn't. PFP-FPM failure was a sign, so I restarted it. Still no joy. No DNS response. I tried killing and restarting dnsmasq but that did not help. Rebooting showed dnsmasq running, but still no DNS service immediately. Again I rebooted about a half dozen times until I finally got DNS service. I guess the best I can hope for is another day of operation until I have to repeat.
Routing tables
Internet:
Destination Gateway Flags Netif Expire
0.0.0.0 xxx.yyy.zzz.1 UGS ue1
8.8.8.8 xxx.yyy.zzz.1 UGHS ue1
10.0.0.0/16 link#1 U re0
10.0.0.1 link#3 UHS lo0
10.1.0.0/16 10.0.0.1 UGS re0
xxx.yyy.zzz.0/23 link#7 U ue1
xxx.yyy.zzz.247 link#3 UHS lo0
127.0.0.1 link#3 UH lo0
[2.8.1-RELEASE][admin@fw.bananas.com]/root: nslookup orange
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to 10.1.0.1#53: timed out
;; no servers could be reached
[2.8.1-RELEASE][admin@fw.bananas.com]/root: nslookup www.google.com
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: connection refused
;; communications error to 127.0.0.1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to 10.1.0.1#53: timed out
;; no servers could be reached
[2.8.1-RELEASE][admin@fw.bananas.com]/root: ps -auxww | fgrep dns
nobody 34809 0.5 0.0 16644 5080 - S 10:51 0:00.01 /usr/local/sbin/dnsmasq -C /dev/null --dhcp-hostsfile=/etc/hosts --no-resolv --server=10.1.0.1 --server=8.8.8.8 --server=1.1.1.1 --server=4.4.4.4 --strict-order --dns-forward-max=5000 --cache-size=10000 --local-ttl=1
root 46981 0.0 0.0 13988 2612 - Ss 10:51 0:00.00 /usr/local/sbin/dhcpleases -l /var/dhcpd/var/db/dhcpd.leases -d bananas.com -p /var/run/dnsmasq.pid -h /etc/hosts
root 92820 0.0 0.0 22908 3596 - Is 10:50 0:00.00 /usr/local/sbin/filterdns -p /var/run/filterdns-ipsec.pid -i 60 -c /var/etc/ipsec/filterdns-ipsec.hosts -d 1
root 47137 0.0 0.0 14076 2676 0 S+ 10:51 0:00.00 fgrep dns
[2.8.1-RELEASE][admin@fw.bananas.com]/root:
You can't tell me that this is all because the USB network drivers are "flappy". This is house of cards that falls down due to unhandled errors. And is blamed on the USB if instead of correcting.
Andrew