From 5612056806e16c3d1307d6c31ba99cc6990ed022 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Sun, 22 Sep 2024 23:18:54 +0800 Subject: [PATCH] mediatek: hnat: set skb frags flags for ext-devices --- .../ethernet/mediatek/mtk_hnat/hnat_nf_hook.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c index 91f61cde10..1f9b43239f 100644 --- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c +++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c @@ -657,6 +657,12 @@ static inline void hnat_set_alg(const struct nf_hook_state *state, skb_hnat_alg(skb) = val; } +static inline void hnat_set_tag(const struct nf_hook_state *state, + struct sk_buff *skb, int val) +{ + skb_hnat_magic_tag(skb) = val; +} + static inline void hnat_set_head_frags(const struct nf_hook_state *state, struct sk_buff *head_skb, int val, void (*fn)(const struct nf_hook_state *state, @@ -858,8 +864,8 @@ mtk_hnat_ipv6_nf_pre_routing(void *priv, struct sk_buff *skb, goto drop; if (!IS_WHNAT(state->in) && IS_EXT(state->in) && IS_SPACE_AVAILABLE_HEAD(skb)) { - skb_hnat_alg(skb) = 0; - skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG; + hnat_set_head_frags(state, skb, 0, hnat_set_alg); + hnat_set_head_frags(state, skb, HNAT_MAGIC_TAG, hnat_set_tag); } if (!is_magic_tag_valid(skb)) @@ -931,8 +937,8 @@ mtk_hnat_ipv4_nf_pre_routing(void *priv, struct sk_buff *skb, goto drop; if (!IS_WHNAT(state->in) && IS_EXT(state->in) && IS_SPACE_AVAILABLE_HEAD(skb)) { - skb_hnat_alg(skb) = 0; - skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG; + hnat_set_head_frags(state, skb, 0, hnat_set_alg); + hnat_set_head_frags(state, skb, HNAT_MAGIC_TAG, hnat_set_tag); } if (!is_magic_tag_valid(skb)) @@ -994,8 +1000,8 @@ mtk_hnat_br_nf_local_in(void *priv, struct sk_buff *skb, goto drop; if (!IS_WHNAT(state->in) && IS_EXT(state->in) && IS_SPACE_AVAILABLE_HEAD(skb)) { - skb_hnat_alg(skb) = 0; - skb_hnat_magic_tag(skb) = HNAT_MAGIC_TAG; + hnat_set_head_frags(state, skb, 0, hnat_set_alg); + hnat_set_head_frags(state, skb, HNAT_MAGIC_TAG, hnat_set_tag); } if (!is_magic_tag_valid(skb))