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

Apply custom rules on connection change #1253

Conversation

clocken
Copy link
Contributor

@clocken clocken commented Dec 30, 2021

Hi @ukanth, this fixes #579. Analysis of the issue:
InterfaceTracker#applyRules gets called when the (wifi) connection changes. This in turn calls Api#fastApply.
In there is a test for !rulesUpToDate which is usually false in the case of just a connection change, so in turn applyShortRules and iptablesCommands are executed and add their respective commands to the list. Nowhere Api#addCustomRules gets called, so the custom rules are ignored in this case.
I then saw that addCustomRules is called in Api#applyIptablesRulesImpl right before addInterfaceRouting which is why I put the call in applyShortRules just before addInterfaceRouting.

If I missed anything or you are not satisfied, let me know and I'll fix it.
Cheers

Copy link
Owner

@ukanth ukanth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@ukanth ukanth merged commit fa38319 into ukanth:beta Feb 13, 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.

Active rules enabled - Custom rules ignored?
2 participants