ruleset: skip redirect to localhost for local-bound traffic#99
Conversation
Add fib daddr type != local to redirect rules to avoid creating unnecessary conntrack NAT entries when the destination is already a local address. Signed-off-by: Shironeko <shironeko@tesaguri.club>
|
Also needs tests/03_rules/07_redirect changed |
brada4
left a comment
There was a problem hiding this comment.
idk (24.10.7) it does not even set dnat flag on direct to self packets.
chain dxx {
type filter hook prerouting priority 32768;
meta l4proto { tcp, udp } ct original proto-dst 53 iif "br-lan" counter ct status & dnat vmap { 0x0 counter : continue, dnat counter : continue }
}|
If you are ready for a ride try to parametrize this |
There was a problem hiding this comment.
Let me pick up AI rhyme ;-)
The change does not do what it seems to do
- there is a default non-configurable behaviour of kernel that equivalent of
fib daddr . iif type eq localpackets are not subject to redirect - what the patch excludes from redirect/dnat is dns requests directed to wan or other interface address configured on the router.
- source reference would be in some file at
torvalds/linux/net/netfilter/*
|
maybe I'm not using the right words here, but it is certainly my intent to exclude from dnat when the traffic targets any of the IPs configured on the router. |
|
I dont think it is right, at least not by default.For the counter-example - You are trying to make kids net one day they learn what is an IP address and bypass "intended restrictions" by entering parents DNS numbers in their computers.
or from the other side fw4 ruleset is not covering all corners, and you cannot chain dnat/redirect/snat exceptions between rules, like you can do with normal "access list" style rules. |
|
Ahh, yes - all conntrack entries are same size, including 4x IP(6) address , simply NAT state means they are different and some rewrite+re-checksumming is done by netfilter. |
Add fib daddr type != local to redirect rules to avoid creating unnecessary conntrack NAT entries when the destination is already a local address.