[systemd-devel] Mobile broadband modems support in systemd-networkd
Uwe Geuder
systemd-devel-ugeuder at snkmail.com
Tue Aug 24 15:31:27 UTC 2021
Hi!
On Mon, 23 Aug 2021 at 23:41, Bruce A. Johnson wrote:
>
> I wasn't clear what I meant about processing of the .network
> file. With Ethernet or Wi-Fi (using iwd), when the link comes up,
> systemd-networkd does the Right Thing and starts network services on
> the interface, running a DHCP client or setting up static address(es),
> routes, etc., as specified in the .network file. When ModemManager
> establishes the connection with the 3G carrier, systemd-networkd seems
> to be unaware of the event, and I have to poke it with "systemd
> restart systemd-networkd" or "networkctl reload" before it tries to
> use the information in the .network file for the interface. It seems
> to me like that ought to happen automatically. I suspect that
> ModemManager needs to be changed to inform systemd-networkd.
>
> So far, it's not looking like there's an effort to integrate
> ModemManager (or something similar) with systemd-networkd, which is
> kind of a shame. If I come up with anything useful toward making that
> happen, I'll offer a pull request, but at the moment I'm looking at
> cobbling something together with Python.
>
We have a 500+ line shell script to do the job by just calling iproute2
commands (well, it is not very modular and does a couple of other
things, too.) Besides that it is not very generic, license-wise I am not
able to share it unfortunately. Of course probably 300 - 400 lines are
just for error handling.
I was not really involved when the script got written, but I would not
mind throwing it out and skipping the maintenance burden.
> It seems to me like that ought to happen automatically.
I agree.
> I suspect that ModemManager needs to be changed to inform
> systemd-networkd.
Why would that be the case? If you plug in an Ethernet cable there is no
user space process that would inform systemd-networkd. I cannot guess
anything else than systemd-networkd listening for suitable kernel
events. Why would that not work for wwan interfaces? Obviously it
doesn't, otherwise you wouldn't post here and my colleagues wouldn't
have written a script.
One difference seems to be the IPv4 address. When an Ethernet interface
gets connected, as you write, in a typical case you need to run DHCP to
get an IP address. Obviously systemd-network implements that.
Without knowing the details right now I'd guess mobile broadband uses
different protocols. Is it even Ethernet and DHCP on top of that? Our
script asks the IP address from modem manager. So maybe systemd-networkd
would need to do the same unless someone wants to reimplement that
part. (Not sure whether modem manager would even be the program of
choice, I guess connman can handle WWAN connections, too.)
Is it even the same for all modems/networks? In the past PPP was a
thing, nowadays QMI seems to be mentioned more frequently.
Altogether this seems not to be implemented by systemd-networkd and
implementing it might be much more work than a couple of days. Some more
or less hacky script can be written in a couple of days.
> and I have to poke it with "systemd restart systemd-networkd" or
> "networkctl reload" before it tries to use the information in the
> .network file for the interface.
Did you get a working connection including the correct IPv4 address by
doing that? If you did, some of my reasoning above would be wrong.
I have not looked very deep (not even run strace or tcpdump, not to
mention having a look at the source...); if someone can explain me
why my speculation is wrong that would be welcome!
Regards,
Uwe
Uwe Geuder
Neuro Event Labs Oy
Tampere, Finland
uwe.gxuder at neuroeventlabs.com (bot check: fix 1 obvious typo)
More information about the systemd-devel
mailing list