Skip to content

Conversation

@brada4
Copy link

@brada4 brada4 commented Oct 17, 2025

Correct rport null propagation moving compensatory conditional to reflection snat rule only.
Emit shorthand rules if user did not specify redirect target port
This saves 2 bytecodes in rule and kernel does not do no-op port rewrite.
Also tweak tests to cover changed rules.
V2 add test case from WIKI https://openwrt.org/docs/guide-user/firewall/fw3_configurations/intercept_dns#dns_redirection
V3 omit unchanged dport in config example

@brada4
Copy link
Author

brada4 commented Oct 17, 2025

# old
meta nfproto ipv4 tcp dport 53 counter dnat 192.0.2.0:53
# new
meta nfproto ipv4 tcp dport 53 counter dnat 192.0.2.0

It could be even shorter with no place for counter abusing nft-nat-s builtin nfproto filter.

tcp dport 53 dnat ip 192.0.2.0

@brada4
Copy link
Author

brada4 commented Oct 17, 2025

Also can zap remote port if equal and optimize user's rule.

Correct rport null propagation
 moving compensatory conditional to reflection snat rule only.
Emit shorthand rules if user did not specify redirect target port
This saves 2 bytecodes in rule and kernel does not do no-op port
rewrite.
V2 Adjust tests to cover more cases/code paths
V3 Adjust uci example to reflect default of not changing dport

Signed-off-by: Andris PE <neandris@gmail.com>
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