Debian Codegraph @

scripts/clatd.networkmanager

raw
1 #!/bin/sh
2 #
3 # clatd dispatcher script for NetworkManager
4 #
5 # Install it to: /etc/NetworkManager/dispatcher.d/50-clatd
6 #
7 # Written by Tore Anderson <[email protected]>
8 #
9
10 # Newer NetworkManager versions will run the dispatcher scripts once
11 # a new unmanaged interface shows up, including the 'clat' interface
12 # created by clatd/TAYGA. So if we're being called due to our own
13 # interface showing up, do nothing, otherwise we will end up
14 # committing suicide from the restarts below
15 [ "$DEVICE_IFACE" = "clat" ] && exit 0
16
17 # We're only acting on interface "up" or "down" events. NM will run the
18 # dispatcher scripts for other events we're not interested in, like the
19 # hostname being set or a DHCP lease being renewed. Ignore those.
20 [ "$2" != "up" ] && [ "$2" != "down" ] && exit 0
21
22 # We simply restart clatd in all situations, as no matter if an interface
23 # goes up or down, it may mean that the PLAT device changes, it may mean
24 # native IPv4 appearing or disappearing, or it may mean that DNS64 became
25 # available or unavailable...it's far easier to simply restart always and
26 # start from scratch than to figure out if a restart is truly necessary
27
28 # systemd-based distros
29 if which systemctl &> /dev/null; then
30 systemctl --no-block restart clatd.service
31 fi