Re: [systemd-devel] Mobile broadband modems support in systemd-networkd

2021-08-24 Thread Dan Nicholson
On Mon, Aug 23, 2021 at 2:41 PM Bruce A. Johnson
 wrote:
> I suspect that ModemManager needs to be changed to inform systemd-networkd.

Nothing needs to change in ModemManager. networkd would need to be
changed to integrate with ModemManager over D-Bus. The communication
would go in 2 directions - networkd telling ModemManager to change
states and networkd listening for state changes from ModemManager.
FWIW, the NetworkManager code to integrate with ModemManager is in
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/tree/main/src/core/devices/wwan.
It uses libmm-glib, but that's really just a convenience wrapper
around the D-Bus interfaces.

Dan


Re: [systemd-devel] Mobile broadband modems support in systemd-networkd

2021-08-24 Thread Uwe Geuder
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.gxu...@neuroeventlabs.com (bot check: fix 1 obvious typo)


Re: [systemd-devel] How does journald talks to other services?

2021-08-24 Thread Lennart Poettering
On Di, 24.08.21 09:11, Nishant Nayan (nayan.nishant2...@gmail.com) wrote:

> So what are the cases where syslog forwards logs to journal?
> Is there a case where both journal and syslog end up sending same logs to
> each other ( like a cycle ) resulting in duplicate logs?

systemd does not pick up messages from another syslog service, only from
syslog clients. Thus, there is no loop.

Lennart

--
Lennart Poettering, Berlin