openwrt / firewall4

[MIRROR] OpenWrt nftables firewall
https://git.openwrt.org/?p=project/firewall4.git;
17 stars 13 forks source link

Do not resolve physical devices for soft offload #25

Closed brada4 closed 8 months ago

brada4 commented 8 months ago

Let kernel heuristics take care of offloading decapsulation Packets may still enter flow engine one encapsulation below actual interface subject to heuristics, while exiting it on listed interfaces, in kernel subject to non-flow encapsulation offloads.

Fixes: https://github.com/openwrt/openwrt/issues/13410 Fixes: https://github.com/openwrt/openwrt/issues/10224

This is minimally intrusive, to address issue, likely should be bitmask to selectively enable (forward interfaces|one encap below|virt interfaces|wifi|wifi not unique AP|probably others) or flaggs to +/- exact interface names to list.

Signed-off-by: Andris PE neandris@gmail.com

jow- commented 8 months ago

Ah great, is this confirmed working with PPPoE?

brada4 commented 8 months ago

I tested with gre over vlan. Somebody may need to test in ppoee thread....

brada4 commented 8 months ago

gre heuristic is to always decap, ppoe checks if mtu is good and no magic bits in protocol are set, but no way to fall 2 encaps apart to disable flow translation completely.

brada4 commented 8 months ago

@jow- ? Or it would need to check if (l3dev) and l3dev != dev then l3dev else dev ?

--- a/root/usr/share/ucode/fw4.uc
+++ b/root/usr/share/ucode/fw4.uc
@@ -599,7 +599,7 @@ return {
                        for (let ifc in ifaces.interface) {
                                let net = {
                                        up: ifc.up,
-                                       device: ifc.l3_device ?? ifc.device,
+                                       device: ifc.l3_device,
                                        physdev: ifc.device,
                                        zone: ifc.data?.zone
                                };
@@ -647,7 +647,7 @@ return {
                                                        ...rulespec,

                                                        name: (rulespec.type != 'ipset') ? `ubus:${ifc.interface}[${ifc.proto}] ${rulespec.type || 'rule'} ${n}` : rulespec.name,
-                                                       device: rulespec.device ?? ifc.l3_device ?? ifc.device
+                                                       device: rulespec.device ?? ifc.l3_device
                                                });

                                                n++;
brada4 commented 8 months ago

@jow- ok, side effect is issue 10224 is partially addressed, not completely fixed. Should I polish message to less happy?

brada4 commented 8 months ago

For the other part of issue is TBD, seems netifd sometimes (pppoe) adds l3 device which is kind of to transfer all rules to, sometimes it has only l3device while GRE tunnel has no routes etc. No idea as of yet regarding needed logic vs netifd emissions

brada4 commented 8 months ago

Ill leave it half-way. Fixes: roaming Fixes half pppoe, nothing more.

brada4 commented 8 months ago

will repeat with clean tree.