[Description]
Fix the problem that deleting wifi subinterface fails. Fix duplication of adding the same subinterface to whnat_interface. The previous code will fail when encountering the following situations: 1:Add subinterface to whnat_interface and then delete it, finally, delete the subinterface failed. 2:Add wifi subinterface(eg:rax0.200) to whnat_interface, then rax0 down, add the same wifi subinterface to whnat_interface through echo command. there are two identical wifi subinrefaces in whnat_interface. The patch fix these. [Release-log] N/A Change-Id: I6ae98fbfc12522cfd6528df81509e5bc30a87e76 Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6873054 [Description] Add processing of uninitialized mac header skb in HNAT to avoid crash. [Release-log] N/A Change-Id: I7915ab5cb9c366728b70a6597ba06cb6f984e4a8 Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6887447
This commit is contained in:
@@ -1066,6 +1066,7 @@ static ssize_t hnat_whnat_write(struct file *file, const char __user *buf,
|
||||
mtk_ppe_dev_unregister_hook(dev);
|
||||
pr_info("unregister wifi extern if = %s\n", dev->name);
|
||||
}
|
||||
dev_put(dev);
|
||||
} else {
|
||||
pr_info("no such device!\n");
|
||||
}
|
||||
|
||||
@@ -1688,6 +1688,9 @@ int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no)
|
||||
(gmac_no != NR_WHNAT_WDMA_PORT))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (unlikely(!skb_mac_header_was_set(skb)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (!skb_hnat_is_hashed(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
@@ -1865,6 +1868,9 @@ void mtk_ppe_dev_register_hook(struct net_device *dev)
|
||||
__func__, dev->name, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 1; i < MAX_IF_NUM; i++) {
|
||||
if (!hnat_priv->wifi_hook_if[i]) {
|
||||
if (find_extif_from_devname(dev->name)) {
|
||||
extif_set_dev(dev);
|
||||
@@ -2010,6 +2016,9 @@ static unsigned int mtk_hnat_nf_post_routing(
|
||||
!IS_SPACE_AVAILABLE_HEAD(skb)))
|
||||
return 0;
|
||||
|
||||
if (unlikely(!skb_mac_header_was_set(skb)))
|
||||
return 0;
|
||||
|
||||
if (unlikely(!skb_hnat_is_hashed(skb)))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user