mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-07 01:53:34 +08:00
parent
b9d3e4343a
commit
3e744a313d
@ -804,6 +804,12 @@ static unsigned int
|
||||
mtk_hnat_ipv6_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (!is_ppe_support_type(skb)) {
|
||||
hnat_set_head_frags(state, skb, 1, hnat_set_alg);
|
||||
return NF_ACCEPT;
|
||||
@ -817,8 +823,6 @@ mtk_hnat_ipv6_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
if (do_ext2ge_fast_try(state->in, skb)) {
|
||||
if (!do_hnat_ext_to_ge(skb, state->in, __func__))
|
||||
return NF_STOLEN;
|
||||
if (!skb)
|
||||
goto drop;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@ -849,12 +853,13 @@ mtk_hnat_ipv6_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
|
||||
return NF_ACCEPT;
|
||||
drop:
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
if (skb)
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -863,6 +868,12 @@ static unsigned int
|
||||
mtk_hnat_ipv4_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (!is_ppe_support_type(skb)) {
|
||||
hnat_set_head_frags(state, skb, 1, hnat_set_alg);
|
||||
return NF_ACCEPT;
|
||||
@ -876,8 +887,6 @@ mtk_hnat_ipv4_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
if (do_ext2ge_fast_try(state->in, skb)) {
|
||||
if (!do_hnat_ext_to_ge(skb, state->in, __func__))
|
||||
return NF_STOLEN;
|
||||
if (!skb)
|
||||
goto drop;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@ -892,12 +901,13 @@ mtk_hnat_ipv4_nf_pre_routing(void *priv, struct sk_buff *skb,
|
||||
|
||||
return NF_ACCEPT;
|
||||
drop:
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
if (skb)
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -908,6 +918,12 @@ mtk_hnat_br_nf_local_in(void *priv, struct sk_buff *skb,
|
||||
{
|
||||
struct vlan_ethhdr *veth;
|
||||
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (IS_HQOS_MODE && hnat_priv->data->whnat) {
|
||||
veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
|
||||
@ -940,8 +956,6 @@ mtk_hnat_br_nf_local_in(void *priv, struct sk_buff *skb,
|
||||
|
||||
if (!do_hnat_ext_to_ge(skb, state->in, __func__))
|
||||
return NF_STOLEN;
|
||||
if (!skb)
|
||||
goto drop;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@ -975,12 +989,13 @@ mtk_hnat_br_nf_local_in(void *priv, struct sk_buff *skb,
|
||||
|
||||
return NF_ACCEPT;
|
||||
drop:
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
if (skb)
|
||||
printk_ratelimited(KERN_WARNING
|
||||
"%s:drop (in_dev=%s, iif=0x%x, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, state->in->name, skb_hnat_iface(skb),
|
||||
HNAT_SKB_CB2(skb)->magic, skb_hnat_entry(skb),
|
||||
skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -2135,6 +2150,9 @@ mtk_hnat_ipv6_nf_local_out(void *priv, struct sk_buff *skb,
|
||||
const struct tcpudphdr *pptr;
|
||||
int udp = 0;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (unlikely(!skb_hnat_is_hashed(skb)))
|
||||
return NF_ACCEPT;
|
||||
|
||||
@ -2193,17 +2211,22 @@ static unsigned int
|
||||
mtk_hnat_ipv6_nf_post_routing(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
post_routing_print(skb, state->in, state->out, __func__);
|
||||
|
||||
if (!mtk_hnat_nf_post_routing(skb, state->out, hnat_ipv6_get_nexthop,
|
||||
__func__))
|
||||
return NF_ACCEPT;
|
||||
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
drop:
|
||||
if (skb)
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -2212,17 +2235,22 @@ static unsigned int
|
||||
mtk_hnat_ipv4_nf_post_routing(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
post_routing_print(skb, state->in, state->out, __func__);
|
||||
|
||||
if (!mtk_hnat_nf_post_routing(skb, state->out, hnat_ipv4_get_nexthop,
|
||||
__func__))
|
||||
return NF_ACCEPT;
|
||||
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
drop:
|
||||
if (skb)
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -2231,7 +2259,15 @@ static unsigned int
|
||||
mtk_pong_hqos_handler(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
struct vlan_ethhdr *veth;
|
||||
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
veth = (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
|
||||
if (IS_HQOS_MODE && eth_hdr(skb)->h_proto == HQOS_MAGIC_TAG) {
|
||||
skb_hnat_entry(skb) = ntohs(veth->h_vlan_TCI) & 0x3fff;
|
||||
@ -2272,16 +2308,21 @@ static unsigned int
|
||||
mtk_hnat_br_nf_local_out(void *priv, struct sk_buff *skb,
|
||||
const struct nf_hook_state *state)
|
||||
{
|
||||
if (!skb)
|
||||
goto drop;
|
||||
|
||||
post_routing_print(skb, state->in, state->out, __func__);
|
||||
|
||||
if (!mtk_hnat_nf_post_routing(skb, state->out, 0, __func__))
|
||||
return NF_ACCEPT;
|
||||
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
drop:
|
||||
if (skb)
|
||||
trace_printk(
|
||||
"%s:drop (iif=0x%x, out_dev=%s, CB2=0x%x, ppe_hash=0x%x, sport=0x%x, reason=0x%x, alg=0x%x)\n",
|
||||
__func__, skb_hnat_iface(skb), state->out->name, HNAT_SKB_CB2(skb)->magic,
|
||||
skb_hnat_entry(skb), skb_hnat_sport(skb), skb_hnat_reason(skb),
|
||||
skb_hnat_alg(skb));
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
@ -2294,6 +2335,9 @@ mtk_hnat_ipv4_nf_local_out(void *priv, struct sk_buff *skb,
|
||||
struct foe_entry *entry;
|
||||
struct iphdr *iph;
|
||||
|
||||
if (!is_magic_tag_valid(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
if (!skb_hnat_is_hashed(skb))
|
||||
return NF_ACCEPT;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user