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

Add cleanup action for cleaning up after a device is removed #156

Merged
merged 5 commits into from
Aug 22, 2023

Conversation

tohojo
Copy link
Owner

@tohojo tohojo commented Feb 16, 2023

Add a new 'cleanup' action for cleaning up SQM state after an interface that has
gone away. Refactor the stop code a bit in the process, most notably to fix
stopping in the case where no downstream shaper is configured.

Fixes #155.

When rewinding the ipt log we should always restart it, so make the restart
part of the rewind function instead of having the caller call both.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
We're removing the IFB interface anyway, which means that the qdisc will go
with it, so there's no reason to explicitly remove the qdisc first.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
If DOWNLINK is set to 0, we didn't remove the egress qdisc either. Fix that
to unconditionally remove the egress qdisc, and only condition the removal
of the ingress qdisc.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Split out the cleaning of iptables rules and IFB interface to a separate
sqm_cleanup() function, which can optionally be called with a "silent"
parameter which will silence the IFB removal command. This is in
preparation for exposing this as a separate cleanup action that can be
called after the main netdevice is removed.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
If a network interface is removed before SQM is stopped on that interface,
removing the qdisc from that interface will result in errors in the log.
Whereas not running the 'stop' action will result in leftover state
files (and possibly an IFB interface).

While the right thing to do would be to stop SQM before removing the
interface, this is not always possible; for instance, pppd doesn't have a
'pre-down' hook. So to accommodate this use case, add a new 'cleanup'
action, which just unwinds the firewall rules, removes the IFB
interface (but silently in case it does not exist), and deletes the state
file.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
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.

After stopping the SQM speed limit, wrong information is recorded in the system log!
1 participant