Skip to contentSkip to conversation

Making udhcpc get a new lease when iwd connects to a network

DISCUSSION Rafael Ávila de Espíndola 3 participants 4 messages Jan 21, 2024 – Jan 22, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

I know that iwd has a builtin dhcp client, but I am using it in alpine linux and would like to use the same dhcp client with both wired and wireless interfaces. The default client in alpine is udhcpc.

As far as I can tell, the impedance mismatch between udhcpc and iwd is that udhcpc expect commands via unix signals and iwd send property changes via dbus.

I wrote a bit of glue code and posted it to
https://codeberg.org/espindola/iwd2udhcpc. It works, at least on my laptop, but I am wondering if anyone knows of a simpler way.

Thanks,
Rafael

#1 lore raw

Hi Rafael,

Quoted 6 lines · Rafael Ávila de Espíndola

Hi,

I know that iwd has a builtin dhcp client, but I am using it in alpine linux and would like to use the same dhcp client with both wired and wireless interfaces. The default client in alpine is udhcpc.

Quoted 7 lines

As far as I can tell, the impedance mismatch between udhcpc and iwd is that udhcpc expect commands via unix signals and iwd send property changes via dbus.

I wrote a bit of glue code and posted it to
https://codeberg.org/espindola/iwd2udhcpc. It works, at least on my laptop, but I am wondering if anyone knows of a simpler way.

I think the intended way is for the DHCP daemon to listen for the interface to set carrier up (from RTNL). This is how systemd-networkd does it, and AFAIK dhcpd. I'm surprised udhcpd doesn't although I suspect since its heavily stripped down they leave it up to some other entity to tell it to start.

Listening for IWD's connected state is effectively the same thing. One thing to keep in mind is you don't want to start DHCP again when transitioning from roaming->connected.

Quoted 4 lines

Thanks,
Rafael

#2 lore raw

Hi James, Rafael,

Quoted 2 lines

I think the intended way is for the DHCP daemon to listen for the interface to set carrier up (from RTNL). This is how systemd-networkd does it, and AFAIK

Refer to https://docs.kernel.org/networking/operstates.html for an explanation of how this is supposed to work. The kernel will signal NO_CARRIER any time the wlan interface is not associated and IF_UP once the interface is fully connected.

Regards,
-Denis

#3 lore raw

Thanks!

I will take a look.

Cheers,
Rafael

Quoted 12 lines · Denis Kenzior

Hi James, Rafael,

Quoted 3 lines

I think the intended way is for the DHCP daemon to listen for the interface to set carrier up (from RTNL). This is how systemd-networkd does it, and AFAIK

Refer to https://docs.kernel.org/networking/operstates.html for an explanation of how this is supposed to work. The kernel will signal NO_CARRIER any time the wlan interface is not associated and IF_UP once the interface is fully connected.

Regards,
-Denis