mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-03 03:06:46 +07:00
[NETFILTER]: stop tracking ICMP error at early point
Currently connection tracking handles ICMP error like normal packets if it failed to get related connection. But it fails that after all. This makes connection tracking stop tracking ICMP error at early point. Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ed77de9fc6
commit
d63a928108
@ -151,13 +151,13 @@ icmp_error_message(struct sk_buff *skb,
|
|||||||
/* Not enough header? */
|
/* Not enough header? */
|
||||||
inside = skb_header_pointer(skb, skb->nh.iph->ihl*4, sizeof(_in), &_in);
|
inside = skb_header_pointer(skb, skb->nh.iph->ihl*4, sizeof(_in), &_in);
|
||||||
if (inside == NULL)
|
if (inside == NULL)
|
||||||
return NF_ACCEPT;
|
return -NF_ACCEPT;
|
||||||
|
|
||||||
/* Ignore ICMP's containing fragments (shouldn't happen) */
|
/* Ignore ICMP's containing fragments (shouldn't happen) */
|
||||||
if (inside->ip.frag_off & htons(IP_OFFSET)) {
|
if (inside->ip.frag_off & htons(IP_OFFSET)) {
|
||||||
DEBUGP("icmp_error_track: fragment of proto %u\n",
|
DEBUGP("icmp_error_track: fragment of proto %u\n",
|
||||||
inside->ip.protocol);
|
inside->ip.protocol);
|
||||||
return NF_ACCEPT;
|
return -NF_ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
innerproto = ip_conntrack_proto_find_get(inside->ip.protocol);
|
innerproto = ip_conntrack_proto_find_get(inside->ip.protocol);
|
||||||
@ -166,7 +166,7 @@ icmp_error_message(struct sk_buff *skb,
|
|||||||
if (!ip_ct_get_tuple(&inside->ip, skb, dataoff, &origtuple, innerproto)) {
|
if (!ip_ct_get_tuple(&inside->ip, skb, dataoff, &origtuple, innerproto)) {
|
||||||
DEBUGP("icmp_error: ! get_tuple p=%u", inside->ip.protocol);
|
DEBUGP("icmp_error: ! get_tuple p=%u", inside->ip.protocol);
|
||||||
ip_conntrack_proto_put(innerproto);
|
ip_conntrack_proto_put(innerproto);
|
||||||
return NF_ACCEPT;
|
return -NF_ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ordinarily, we'd expect the inverted tupleproto, but it's
|
/* Ordinarily, we'd expect the inverted tupleproto, but it's
|
||||||
@ -174,7 +174,7 @@ icmp_error_message(struct sk_buff *skb,
|
|||||||
if (!ip_ct_invert_tuple(&innertuple, &origtuple, innerproto)) {
|
if (!ip_ct_invert_tuple(&innertuple, &origtuple, innerproto)) {
|
||||||
DEBUGP("icmp_error_track: Can't invert tuple\n");
|
DEBUGP("icmp_error_track: Can't invert tuple\n");
|
||||||
ip_conntrack_proto_put(innerproto);
|
ip_conntrack_proto_put(innerproto);
|
||||||
return NF_ACCEPT;
|
return -NF_ACCEPT;
|
||||||
}
|
}
|
||||||
ip_conntrack_proto_put(innerproto);
|
ip_conntrack_proto_put(innerproto);
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ icmp_error_message(struct sk_buff *skb,
|
|||||||
|
|
||||||
if (!h) {
|
if (!h) {
|
||||||
DEBUGP("icmp_error_track: no match\n");
|
DEBUGP("icmp_error_track: no match\n");
|
||||||
return NF_ACCEPT;
|
return -NF_ACCEPT;
|
||||||
}
|
}
|
||||||
/* Reverse direction from that found */
|
/* Reverse direction from that found */
|
||||||
if (DIRECTION(h) != IP_CT_DIR_REPLY)
|
if (DIRECTION(h) != IP_CT_DIR_REPLY)
|
||||||
|
Loading…
Reference in New Issue
Block a user