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

Fix problem when rules missing in PREROUTING #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wydy
Copy link

@wydy wydy commented Sep 22, 2024

Sometimes the rules in PREROUTING and POSTROUTING are broken by another program. To solve this problem, the existence of a NATTER chain is no longer checked. Now Natter will always try to create all rules to be used.

Add the InputRule.iptables / InputRule.nftables method to prevent duplicate rules from being created.

Also fix the chain used with DNAT and SNAT according to the document of iptables and nftables. See the schematic below, DNAT has been tested on system with iptables and nftables. However, it is not certain that SNAT will work correctly, and further testing is needed. image

There are also problems that need to be solved when the nftables of many systems do not create chains such as ip nat prerouting by default, and running natter on these systems will result in errors.
But I'm not sure if I should let natter create these chains, or write the relevant content into a readme and leave it up to the user to create them.

Finally, a one-second pause was added before port testing (line 1786) to wait for external software to start the port when port forwarding is enabled, preventing the test from showing the port as closed.

Sometimes the rules in PREROUTING and POSTROUTING are broken by another program. To solve this problem, the existence of a NATTER chain is no longer checked. Now Natter will always try to create all rules to be used.

Add the InputRule.iptables / InputRule.nftables method to prevent duplicate rules from being created.

Also fix the chain used with DNAT and SNAT according to the document of iptables and nftables. See the schematic below, DNAT has been tested on system with iptables and nftables. However, it is not certain that SNAT will work correctly, and further testing is needed.
![image](https://github.com/user-attachments/assets/dcb9018f-2998-461e-8d2e-c3644d487a5b)

Finally, a one-second pause was added before port testing (line 1786) to wait for external software to start the port when port forwarding is enabled, preventing the test from showing the port as closed.
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.

1 participant