No DHCP lease for ipheth, no bpf attached

From: Alban Hertroys <haramrae_at_gmail.com>
Date: Sun, 10 Mar 2024 11:26:35 UTC
Hi,

I’m trying to get ipheth to work as a 5G hotspot on my FreeBSD home router/server, using the method described in man 4 ipheth. The final step fails to get a DHCP lease.

The configuration is on FreeBSD 14.0-RELEASE-p5/amd64 and an iPhone 13 mini. Is this configuration supported? And if so, where did I go wrong?

Details below.

# kldstat | grep ipheth
23    1 0xffffffff82997000     21e0 if_ipheth.ko
# usbconfig | grep Apple
ugen2.2: <Apple Inc. iPhone> at usbus2, cfg=3 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
# usbconfig -d 2.2 dump_all_config_desc | grep -E '(^ Conf|iConf)'
 Configuration index 0
    iConfiguration = 0x0005  <PTP>
 Configuration index 1
    iConfiguration = 0x0006  <iPod USB Interface>
 Configuration index 2
    iConfiguration = 0x0007  <PTP + Apple Mobile Device>
 Configuration index 3
    iConfiguration = 0x0008  <PTP + Apple Mobile Device + Apple USB Ethernet>
# usbconfig -d 2.2 set_config 3
# usbconfig | grep 'Apple.*cfg=3'
ugen2.2: <Apple Inc. iPhone> at usbus2, cfg=3 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
# dmesg | grep 'ue[0-9]'
ue0: <USB Ethernet> on ipheth0
ue0: Ethernet address: b2:67:b5:ce:d4:2d

At this point the man page expects to see a line: ue0: bpf attached, that I don’t have. Without that, it is no surprise that the next steps fail, DHCP requires bpf according to man bpf.

The iPhone did indeed ask whether the machine could be trusted (granted, of course), and from the green background on the time display it does appear to believe that it is indeed functioning as a hotspot for the machine (or whatever that's supposed to mean).

# sysrc ifconfig_ue0
ifconfig_ue0: SYNCDHCP
# service netif restart ue0
Stopping dhclient.
Waiting for PIDS: 51707.
Stopping Network: ue0.
ue0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=0
        ether b2:67:b5:ce:d4:2d
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting dhclient.
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 21
DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 2
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

Starting Network: ue0.
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=0
        ether b2:67:b5:ce:d4:2d
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


For completeness sake, I did have usbmuxd running during all this:

> doas usbmuxd --enable-exit --foreground --verbose --user root
Password:
[12:07:06.047][3] usbmuxd v1.1.1 starting up
[12:07:06.048][4] Creating socket
[12:07:06.048][4] Not dropping privileges to root
[12:07:06.048][4] Initializing USB
[12:07:06.048][3] Using libusb 1.0.0
[12:07:06.048][4] Registering for libusb hotplug events
[12:07:06.048][4] Found new device with v/p 05ac:12a8 at 2-2
[12:07:06.048][4] Found interface 1 with endpoints 04/85 for device 2-2
[12:07:06.049][4] Using wMaxPacketSize=512 for device 2-2
[12:07:06.049][4] USB Speed is 480 MBit/s for device 2-2
[12:07:06.049][4] 1 device detected
[12:07:06.049][3] Initialization complete
[12:07:06.049][3] Enabled exit on SIGUSR1 if no devices are attached. Start a new instance with "--exit" to trigger.
[12:07:06.049][4] Got lang ID 1033 for device 2-2
[12:07:06.050][4] Got serial '000081100014302A0201401E' for device 2-2
[12:07:06.050][3] Connecting to new device on location 0x20002 as ID 1
[12:07:06.050][3] Connected to v2.0 device 1 on location 0x20002 with serial number 00008110-0014302A0201401E
[12:07:06.051][4] preflight_worker_handle_device_add: Starting preflight on device 00008110-0014302A0201401E...
[12:07:06.051][4] Client 10 accepted
[12:07:06.052][4] Client connected to device 1 (1->62078)
[12:07:06.053][4] Client 12 accepted
[12:07:06.053][4] Client 12 connection closed
[12:07:06.053][4] Client 12 is going to be disconnected
[12:07:06.062][4] Client 12 accepted
[12:07:06.063][4] Client 12 connection closed
[12:07:06.063][4] Client 12 is going to be disconnected
[12:07:06.287][4] preflight_worker_handle_device_add: StartSession success for device 00008110-0014302A0201401E
[12:07:06.287][4] preflight_worker_handle_device_add: Finished preflight on device 00008110-0014302A0201401E
[12:07:06.289][4] Client 10 is going to be disconnected


While this is a custom kernel, it includes GENERIC and doesn’t remove device bpf. I used it successfully prior to these attempts with DHCP on an Intel ethernet adapter:
# sysrc ifconfig_em1
ifconfig_em1: DHCP defaultif -tso4 -lro -vlanhwtso

So I know that DHCP works (in fact, this machine also runs isc_dhcp to provide my home network with address information).

Regards,
Alban Hertroys
--
There is always an exception to always.