-
Notifications
You must be signed in to change notification settings - Fork 28
[2/3 overriden] Reorder early state dispatch for quicker outcome #22
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
Conversation
locate offload at the end of slowpath ... use builtin tcpudp filter in place of extra filter ... and directly yield to offload-add kworker drop invalid asap and avoid further activity on useless packets ... which accidentally simplifies main state dispatch ... so make use of optimized dispatch alternatives depending on global settings Thanks-to: @CallMeR for tcpudp filter avoidance idea Discussed: openwrt#20 Signed-Off-By: Andris PE <neandris@hmail.com>
|
Dropping invalid packets over localhost would be swapping iif lo and ct state in output along removing iif != in new prerouting. I dont feel either way, so I maintained behaviour exactly. |
As in old days, guilty not having idea on splitting state handling earlier.
No need to consume CPU in default case for unrealistic corner case. loopback invalid thus better dropped at ease. Signed-off-by: Andris PE <neandris@gmail.com>
|
@jow- this alters semantics for improved safety discarding invalid (out of state and bad checksum) packets before nat alg helpers. |
firstly netfilter doc now has only vmap-y dispatch examples secondly vmap includes "immediate" action in itself, as opposed to setting bool in lookup and in separate bytecode insnis doing immediate or full action.
|
@jow- made it vmap, netfilters own examples now has vmaps everywhere....
|
Additionally since jump target is terminal no need to preserve callaback and use goto in place of jump.
Suggested by forum user kvic at https://forum.openwrt.org/t/first-rule-in-chain-input-output-for-firewall4/204723 Average latency is same, the jitter/distribution is halved, also max latency conclusively reduced.
Suggested at https://forum.openwrt.org/t/first-rule-in-chain-input-output-for-firewall4/204723 Formally speeds up "default" nat function over loopback ipc.
|
@jow- hi, got nice pro feedback at https://forum.openwrt.org/t/first-rule-in-chain-input-output-for-firewall4/204723 and implemented best parts, 1 cosmetic 2 improves NAT performance by dozen hairs |
|
Also discovered that this adds easy flowtable exception via /e/n.d/ for more fifo-ish behaviour (still to dig up test case) |
|
No, it should sray like this short simple. |
|
Yes, default configuration is revert (2 rules swapped tough) |
|
Ill split this in 2 pieces - 1/2 handling invalid packets early 2/2 jump-branching offload |
|
Hi @brada4 this patch is still valid with latest update right? |
|
It is still valid. if i split it 2nd half has to be heavily re-based |
@feckert 's idea of pre-including rules before loopback openwrt#55 Remove iif lo check from each packet Part openwrt#22 Somewhat improving over a5553da Signed-off-by:
@feckert 's idea of pre-including rules before loopback openwrt#55 Remove iif lo check from each packet Part openwrt#22 Improves: a5553da Signed-off-by: Andris PE <neandris@gmail.com>
|
I am splitting this in 3 pieces, later today. |
|
@brada4 thank you.
correct? |
|
Based on my own usage and observation, I have identified some potential negative impacts (PR #59) :
Scenario: Certain special protocols (such as non-standard NAT traversal, legacy applications) or abnormal network environments (such as incorrect configuration of NAT devices) may cause normal traffic to be mislabeled as "invalid". Impact: If legitimate traffic (such as UDP connections that are not correctly tracked, packets with failed fragmentation reassembly) is dropped, it may lead to connection interruptions or abnormal service operations.
Mechanism: Conntrack relies on the first fragment to establish the connection state. If the first fragment is lost, subsequent fragments will be regarded as "invalid" and dropped. Impact: For applications that rely on fragmented packet transmission (such as large file transfers, certain VPN protocols), it may cause performance problems or data loss. However, this is a normal protective behavior (subsequent packets without the initial fragment are inherently abnormal traffic). |
|
@CallMeR If you see the diagram conntrack state is classified at -200, last chance to make it valid (or notrack for more obvious usage) was respective raw table, e.g setting back same TTL to fix checksum. |
|
@glassd00r yes, thats correct. +if offload devs > 0
+ ct state established related goto handle_offload
+else
ct state established related accept
+endif
... later in file
+ if offload devs >0
+ chain handle offload
+ add flow ... accept
+ accept |
|
@glassd00r |
|
@brada4 cool. will test and feedback after you push part3 of the PR. same custom filter chains rules? |
|
@glassd00r i remember writing those in forum, yep ill add example in /etc/nftables.d ;-) |
|
Last 3rd here: |
|
I am just trying to concentrate scattered discussions in one place. |
|
I am closing this |
locate offload at the end of slowpath
... use builtin tcpudp filter in place of extra filter ... and directly yield to offload-add kworker
drop invalid asap and avoid further activity on useless packets ... which accidentally simplifies main state dispatch ... so make use of optimized output chain dispatch alternatives depending on global setting
Thanks-to: @CallMeR for tcpudp filter avoidance idea
Thanks-to: forum user kvic for detailed review and suggestions
Discussed: #20
Part-reverts: 19a8caf
Signed-Off-By: Andris PE neandris@gmail.com