Re: dhcpcd conflict with ModemManager/QMI
Roy Marples
Wed Feb 26 15:02:29 2020
Hi Tejio
On 26/02/2020 12:38, Teijo Kinnunen wrote:
I have had trouble with dhcpcd on cellular (QMI) interface when used together
with ModemManager. This happened on Raspberry Pi using dhcpcd version 8.1.2.
Basically what happens is the following:
- QMI based modem is plugged in, the kernel creates the interface (wwan0).
- dhcpcd notices the interface, logs "waiting for carrier" and immediately
"carrier acquired". Then it proceeds to configure the interface (e.g. link IP
address), eventually the interface will be in up state.
- A bit later, ModemManager attempts to set the raw_ip mode of the interface to
the correct value, but this fails because the interface is already up (blocked
by QMI kernel driver).
- When cellular data connection is started later, it will fail to work as the
kernel has wrong raw_ip mode configured.
Full log of modem hot-plug and some discussion is available here in the
corresponding MM ticket originally made:
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/189
My initial question is thus: why is there a 14 second delay from dhcpcd AND
avahi spotting the interface to the ModemManager actually setting something?
When dhcpcd sees an interface, the default action is to bring it up and get it
going. Yay, this works oh so well for USB ethernet/wireless.
Generally speaking an interface is already configured when it appears for dhcpcd
to operate on OR it allows configuration when up.
This is solvable four ways - tell dhcpcd to stop it using the noup directive as
documented in the fine man page or ModemManager brings the interface down when
setting raw_ip mode (and bring it back up again) or integrate ModemManager with
udev or change the wwan kernel driver to reset PHY when changing raw_ip.
Setting noup in in dhcpcd is the worst option, but also the easiest.
However, something else has to UP the interface.
Preferably, ModemManager should do this. It knows that a wwan *must* be in
raw_ip mode but it is up. So to succeed, regardless of dhcpcd or anything else,
it *must* be brought down to set it. This is the third best option.
Integrating ModemManager with udev allows udev to tell dhcpcd the interface is
ready regardless of the kernel announcing it. This is the second best option.
Making the kernel driver behave better just fixes everything.
This is the best option.
> Is it supposed that dhcpcd configures the cellular interface this early, or
> should it wait until wwan0 is actually connected?
The interface being IFF_UP is an adminsitrative flag has as no relation to being
connected. On Linux, connectivity is based on the presence of IFF_RUNNING on the
interface flags. Please don't confuse the two.
Roy
Archive administrator: postmaster@marples.name