Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd: pivot WantedBy to interface rather than multi-user #144

Merged
merged 1 commit into from
Jan 11, 2022
Merged

systemd: pivot WantedBy to interface rather than multi-user #144

merged 1 commit into from
Jan 11, 2022

Conversation

jimdigriz
Copy link
Contributor

Fixes SQM restarts (issue #143) when the interface is removed and re-added (eg. PPP) and also SQM loads sooner rather than waiting for multi-user to start

Fixes SQM restarts when the interface is removed and readded (eg. PPP)
and also SQM loads sooner rather than waiting for multi-user to start

Signed-off-by: Alexander Clouter <[email protected]>
@tohojo
Copy link
Owner

tohojo commented Jan 11, 2022 via email

@jimdigriz
Copy link
Contributor Author

jimdigriz commented Jan 11, 2022

Yes, Works for Me(tm) :)

root@clearfog:/home/alex# systemctl status --no-pager -n0 [email protected][email protected] - SQM scripts for iface wan
     Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2022-01-11 17:11:15 UTC; 31min ago
    Process: 4452 ExecStart=/usr/lib/sqm/start-sqm (code=exited, status=0/SUCCESS)
   Main PID: 4452 (code=exited, status=0/SUCCESS)
        CPU: 164ms

root@clearfog:/home/alex# systemctl status --no-pager -n0 [email protected][email protected] - PPP connection for wan
     Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-01-11 17:11:18 UTC; 31min ago
       Docs: man:pppd(8)
    Process: 4428 ExecStartPre=/lib/systemd/systemd-networkd-wait-online -i eth1 -o carrier (code=exited, status=0/SUCCESS)
    Process: 4439 ExecStart=/usr/sbin/pppd plugin rp-pppoe.so eth1 call wan linkname eth1 ifname wan updetach (code=exited, status=0/SUCCESS)
   Main PID: 4588 (pppd)
      Tasks: 1 (limit: 4169)
     Memory: 884.0K
        CPU: 107ms
     CGroup: /system.slice/system-pppd\x2deth1.slice/[email protected]
             └─4588 /usr/sbin/pppd plugin rp-pppoe.so eth1 call wan linkname eth1 ifname wan updetach

root@clearfog:/home/alex# kill 4588

root@clearfog:/home/alex# systemctl status --no-pager -n0 [email protected][email protected] - PPP connection for wan
     Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-01-11 17:43:11 UTC; 1s ago
       Docs: man:pppd(8)
    Process: 4934 ExecStartPre=/lib/systemd/systemd-networkd-wait-online -i eth1 -o carrier (code=exited, status=0/SUCCESS)
    Process: 4935 ExecStart=/usr/sbin/pppd plugin rp-pppoe.so eth1 call wan linkname eth1 ifname wan updetach (code=exited, status=0/SUCCESS)
   Main PID: 5081 (pppd)
      Tasks: 1 (limit: 4169)
     Memory: 892.0K
        CPU: 72ms
     CGroup: /system.slice/system-pppd\x2deth1.slice/[email protected]
             └─5081 /usr/sbin/pppd plugin rp-pppoe.so eth1 call wan linkname eth1 ifname wan updetach

root@clearfog:/home/alex# systemctl status --no-pager -n0 [email protected][email protected] - SQM scripts for iface wan
     Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2022-01-11 17:43:07 UTC; 8s ago
    Process: 4946 ExecStart=/usr/lib/sqm/start-sqm (code=exited, status=0/SUCCESS)
   Main PID: 4946 (code=exited, status=0/SUCCESS)
        CPU: 165ms

root@clearfog:/home/alex# tc qdisc show dev wan
qdisc cake 802f: root refcnt 2 bandwidth 5795Kbit diffserv4 triple-isolate nat nowash no-ack-filter split-gso rtt 100ms ptm overhead 34 mpu 68 
qdisc ingress ffff: parent ffff:fff1 ---------------- 

The problem was before as a dependent of multi-user.target it never retriggers (as multi-user is not restarting). As a dependent of the actual device you want to apply the controls to, when it is (re-)created systemd automatically fires it off.

Fortunately we avoid any possible race as tc of course does not depend on the interface being configured, only that it exists even if it is down.

@tohojo
Copy link
Owner

tohojo commented Jan 11, 2022

Alright, awesome! Thanks for the patch!

@tohojo tohojo merged commit 38bac5a into tohojo:master Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants