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 72e36f96d6..ea7b9df7c3 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 @@ -1184,12 +1184,16 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb, struct ipv6hdr *ip6h; struct tcpudphdr _ports; const struct tcpudphdr *pptr; + struct nf_conn *ct; + enum ip_conntrack_info ctinfo; u32 gmac = NR_DISCARD; int udp = 0; u32 qid = 0; u32 port_id = 0; int mape = 0; + ct = nf_ct_get(skb, &ctinfo); + if (ipv6_hdr(skb)->nexthdr == NEXTHDR_IPIP) /* point to ethernet header for DS-Lite and MapE */ eth = (struct ethhdr *)(skb->data - ETH_HLEN); @@ -1386,6 +1390,11 @@ static unsigned int skb_to_hnat_info(struct sk_buff *skb, entry.ipv6_5t_route.dport = foe->ipv6_5t_route.dport; } + + if (ct && (ct->status & IPS_SRC_NAT)) { + return -1; + } + entry.ipv6_5t_route.iblk2.dscp = (ip6h->priority << 4 | (ip6h->flow_lbl[0] >> 4));