Tested on chrony which has a NetworkManager dispatch script that also works as a hook for networkd-dispatcher.
Works fine by just dropping the links for now.
Changes visible when these hooks are in place
1. when sources get unreachable it detects offlining immediately (instead of trying all the time)
2. when a network drops but sources stay reachable nothing happens (no accidental offline)
3. when sources are offline and network is attached without connecting to anything they stay offline
4. when sources are offline and a connecting network is attached they all become online immediately
5. when a network is lost that was connecting to just to some sources only those get set offline.
P.S. most of these cases can be well tested with virsh attach-device / detach-device with multiple network cards (one that connects to network and one that does not for example)
The biggest issue is that reusing that is very nice, but OTOH dangerous if it gets NM only code.
I'll start discussing that upstream before using it in any way.
That happened post 3.2 in
b563048 "examples: ignore non-up/down events in nm-dispatcher script"
I'm now doing:
1. discussing upstream how we want to do it
2. bring that upstream for networkd-dispatcher
3. backport the change to Bionic chrony package
4. place the files to trigger the callbacks
Tested on chrony which has a NetworkManager dispatch script that also works as a hook for networkd- dispatcher.
Works fine by just dropping the links for now.
Changes visible when these hooks are in place
1. when sources get unreachable it detects offlining immediately (instead of trying all the time)
2. when a network drops but sources stay reachable nothing happens (no accidental offline)
3. when sources are offline and network is attached without connecting to anything they stay offline
4. when sources are offline and a connecting network is attached they all become online immediately
5. when a network is lost that was connecting to just to some sources only those get set offline.
P.S. most of these cases can be well tested with virsh attach-device / detach-device with multiple network cards (one that connects to network and one that does not for example)
The biggest issue is that reusing that is very nice, but OTOH dangerous if it gets NM only code.
I'll start discussing that upstream before using it in any way.
That happened post 3.2 in
b563048 "examples: ignore non-up/down events in nm-dispatcher script"
I'm now doing:
1. discussing upstream how we want to do it
2. bring that upstream for networkd-dispatcher
3. backport the change to Bionic chrony package
4. place the files to trigger the callbacks