On 06/09/22 15:53, Laszlo Ersek wrote:
We can't rely on "nm-online" if it doesn't do its
advertized job!
I've checked the nm-online source code, and various other stuff in the
NetworkManager source tree. nm-online is *completely unusable* for its
stated purpose. The source code made my hair stand, and the nm-online
manual is incomprehensible / misleading on top of *that*.
NetworkManager has this weird state machine where NetworkManager as a
whole can be in some state (not running, running but disconnected,
connecting, connected, etc); then, assuming it is "connected", there are
still three kinds of connectivy (local, site, full). (In case
NetworkManager is not connected, there's a fourth, technical,
connectivity, called "none".) What we need is clearly full (aka global)
connectivity. The only way I've found for checking *that* is to call
nmcli in a shell loop with the appropriate incantation, and to sleep 1
second after each iteration.
This works reliably; I'll post v2 soon.
Really you couldn't invent a less intuitive state machine *AND* document
it as badly. When googling nm-online, I've found bug reports and forum
posts going back for a decade, complaining that nm-online does not do
what it says on the tin.
Thanks
Laszlo