commit | dce18f58dba96b346fbbe2759f6a879e2a264ddd | [log] [tgz] |
---|---|---|
author | developer <developer@mediatek.com> | Sat Mar 18 22:11:13 2023 +0800 |
committer | developer <developer@mediatek.com> | Mon Mar 20 10:37:15 2023 +0800 |
tree | e258f91370d619af1cd114a20c8fb06cbcc81caa | |
parent | 4e28877e67c9f1be045486ca89d13f5a2606a717 [diff] |
[][Kernel][hnat][Fix hook drop packet] [Description] Fix hook drop normal packet In some cases, the packet match the to the logic of eth->wlan of the legacy chip(mt7621). After failing to find the interface, it will be discarded by the hnat function. Here packets should be handed over to the kernel [Release-log] N/A Change-Id: Idca4c6e899e743c89fbcb562f2695a77b02a98af Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7265953
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 d2e09e2..16cbed3 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
@@ -494,7 +494,14 @@ else index = entry->ipv6_5t_route.act_dp; - skb->dev = get_dev_from_index(index); + dev = get_dev_from_index(index); + if (!dev) { + trace_printk("%s: called from %s. Get wifi interface fail\n", + __func__, func); + return 0; + } + + skb->dev = dev; if (IS_HQOS_MODE && eth_hdr(skb)->h_proto == HQOS_MAGIC_TAG) { skb = skb_unshare(skb, GFP_ATOMIC);