From 9f303c2748c6aa62764bc9194277286fe471e9cd Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 15 Nov 2022 14:45:04 +0300 Subject: [PATCH] nft openwrt : resolve physdev behind pppoe for hw offload --- common/nft.sh | 6 +++++- init.d/openwrt/functions | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/nft.sh b/common/nft.sh index fe13d6b..0fc44c6 100644 --- a/common/nft.sh +++ b/common/nft.sh @@ -309,6 +309,10 @@ nft_fill_ifsets() # $1 - space separated lan interface names # $2 - space separated wan interface names # $3 - space separated wan6 interface names + # 4,5,6 is needed for pppoe+openwrt case. looks like it's not easily possible to resolve ethernet device behind a pppoe interface + # $4 - space separated lan physical interface names (optional) + # $5 - space separated wan physical interface names (optional) + # $6 - space separated wan6 physical interface names (optional) local script i j ALLDEVS devs @@ -333,7 +337,7 @@ flush set inet $ZAPRET_NFT_TABLE lanif" nft_create_or_update_flowtable '' $ALLDEVS 2>/dev/null ;; hardware) - ALLDEVS=$(unique $1 $2 $3) + ALLDEVS=$(unique $1 $2 $3 $4 $5 $6) # first create unbound flowtable. may cause error in older nft version nft_create_or_update_flowtable 'offload' 2>/dev/null # then add elements. some of them can cause error because unsupported diff --git a/init.d/openwrt/functions b/init.d/openwrt/functions index a71fa5c..115d092 100644 --- a/init.d/openwrt/functions +++ b/init.d/openwrt/functions @@ -217,17 +217,20 @@ flow_offloading_unexempt() nft_fill_ifsets_overload() { - local ifaces DLAN DWAN DWAN6 + local ifaces DLAN DWAN DWAN6 PDLAN PDWAN PDWAN6 call_for_multiple_items network_get_device DLAN "$OPENWRT_LAN" + call_for_multiple_items network_get_physdev PDLAN "$OPENWRT_LAN" network_find_wan4_all ifaces call_for_multiple_items network_get_device DWAN "$ifaces" + call_for_multiple_items network_get_physdev PDWAN "$ifaces" network_find_wan6_all ifaces call_for_multiple_items network_get_device DWAN6 "$ifaces" + call_for_multiple_items network_get_physdev PDWAN6 "$ifaces" - nft_fill_ifsets "$DLAN" "$DWAN" "$DWAN6" + nft_fill_ifsets "$DLAN" "$DWAN" "$DWAN6" "$PDLAN" "$PDWAN" "$PDWAN6" } nft_fw_tpws4()