diff --git a/bundles/pppd/files/pppoe.service b/bundles/pppd/files/pppoe.service index 30c5ef5..758f1e9 100644 --- a/bundles/pppd/files/pppoe.service +++ b/bundles/pppd/files/pppoe.service @@ -7,8 +7,8 @@ Type=oneshot RemainAfterExit=true ExecStart=/usr/bin/pon ExecStop=/usr/bin/poff -a -# This is important, because otherwise systemd will kill the ip-down scripts! -KillMode=none +ExecStop=/etc/ppp/wait-until-stopped +TimeoutStopSec=90 [Install] WantedBy=default.target diff --git a/bundles/pppd/files/wait-until-stopped b/bundles/pppd/files/wait-until-stopped new file mode 100644 index 0000000..03fe333 --- /dev/null +++ b/bundles/pppd/files/wait-until-stopped @@ -0,0 +1,17 @@ +#!/bin/bash + +% for service in sorted(services): +( + while true + do + if systemctl is-active ${service} + then + sleep 1 + else + exit 0 + fi + done +) & +% endfor + +wait diff --git a/bundles/pppd/items.py b/bundles/pppd/items.py index 987d692..c281c74 100644 --- a/bundles/pppd/items.py +++ b/bundles/pppd/items.py @@ -68,6 +68,13 @@ files = { 'svc_systemd:pppoe:restart', }, }, + '/etc/ppp/wait-until-stopped': { + 'content_type': 'mako', + 'context': { + 'services': node.metadata.get('pppd', {}).get('wait-until-stopped', set()), + }, + 'mode': '0700', + }, '/etc/systemd/system/pppoe.service': { 'triggers': { 'action:systemd-reload', diff --git a/bundles/radvd/metadata.py b/bundles/radvd/metadata.py index d9a503f..56be74d 100644 --- a/bundles/radvd/metadata.py +++ b/bundles/radvd/metadata.py @@ -5,3 +5,17 @@ defaults = { }, }, } + + +@metadata_reactor +def pppd(metadata): + if metadata.get('wide-dhcp6c/integrate-with-pppd', False): + return { + 'pppd': { + 'wait-until-stopped': { + 'radvd.service', + }, + } + } + + return {} diff --git a/bundles/wide-dhcp6c/metadata.py b/bundles/wide-dhcp6c/metadata.py index ffa4e9d..aadae1c 100644 --- a/bundles/wide-dhcp6c/metadata.py +++ b/bundles/wide-dhcp6c/metadata.py @@ -16,3 +16,17 @@ defaults = { 'subnet_len': '8', }, } + + +@metadata_reactor +def pppd(metadata): + if metadata.get('wide-dhcp6c/integrate-with-pppd', False): + return { + 'pppd': { + 'wait-until-stopped': { + 'wide-dhcpv6-client.service', + }, + } + } + + return {}