From: Jo-Philipp Wich Date: Mon, 30 May 2022 18:44:17 +0000 (+0200) Subject: fw4: fix logic flaw in testing hw flow offloading support X-Git-Url: http://git.openwrt.org/feed/packages.git%5Ecd5c448758f30868770b9ebf8b656c1a4211a240?a=commitdiff_plain;h=6dd26176b684de6e16296d78660f35fe5c150e8d;p=project%2Ffirewall4.git fw4: fix logic flaw in testing hw flow offloading support The revised logic failed to account for cases where zero offload capable devices where resolved, in this case the capability check was not performed at all. Fixes: #9935 Fixes: 57984e0 ("fw4: always resolve lower flowtable devices") Signed-off-by: Jo-Philipp Wich --- diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index 02341cb..be347d7 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -462,17 +462,15 @@ return { for (let device in zone.related_physdevs) push(devices, ...resolve_lower_devices(devstatus, device, true)); - if (length(devices)) { - devices = sort(uniq(devices)); + devices = sort(uniq(devices)); - if (nft_try_hw_offload(devices)) - return devices; + if (length(devices) && nft_try_hw_offload(devices)) + return devices; - this.warn('Hardware flow offloading unavailable, falling back to software offloading'); - this.state.defaults.flow_offloading_hw = false; + this.warn('Hardware flow offloading unavailable, falling back to software offloading'); + this.state.defaults.flow_offloading_hw = false; - devices = []; - } + devices = []; } for (let zone in this.zones())