Commit 2e404f63 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

inet: frags: use INET_FRAG_EVICTED to prevent icmp messages

Now that we have INET_FRAG_EVICTED we might as well use it to stop
sending icmp messages in the "frag_expire" functions instead of
stripping INET_FRAG_FIRST_IN from their flags when evicting.
Also fix the comment style in ip6_expire_frag_queue().
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@redhat.com>
Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f926e236
...@@ -151,8 +151,6 @@ inet_evict_bucket(struct inet_frags *f, struct inet_frag_bucket *hb) ...@@ -151,8 +151,6 @@ inet_evict_bucket(struct inet_frags *f, struct inet_frag_bucket *hb)
goto evict_again; goto evict_again;
} }
/* suppress xmit of (icmp) error packet */
fq->flags &= ~INET_FRAG_FIRST_IN;
fq->flags |= INET_FRAG_EVICTED; fq->flags |= INET_FRAG_EVICTED;
hlist_del(&fq->list); hlist_del(&fq->list);
hlist_add_head(&fq->list, &expired); hlist_add_head(&fq->list, &expired);
......
...@@ -189,16 +189,18 @@ static void ip_expire(unsigned long arg) ...@@ -189,16 +189,18 @@ static void ip_expire(unsigned long arg)
goto out; goto out;
ipq_kill(qp); ipq_kill(qp);
if (!(qp->q.flags & INET_FRAG_EVICTED))
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT);
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
if ((qp->q.flags & INET_FRAG_FIRST_IN) && qp->q.fragments != NULL) { if (!(qp->q.flags & INET_FRAG_EVICTED)) {
struct sk_buff *head = qp->q.fragments; struct sk_buff *head = qp->q.fragments;
const struct iphdr *iph; const struct iphdr *iph;
int err; int err;
IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT);
if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments)
goto out;
rcu_read_lock(); rcu_read_lock();
head->dev = dev_get_by_index_rcu(net, qp->iif); head->dev = dev_get_by_index_rcu(net, qp->iif);
if (!head->dev) if (!head->dev)
...@@ -211,8 +213,7 @@ static void ip_expire(unsigned long arg) ...@@ -211,8 +213,7 @@ static void ip_expire(unsigned long arg)
if (err) if (err)
goto out_rcu_unlock; goto out_rcu_unlock;
/* /* Only an end host needs to send an ICMP
* Only an end host needs to send an ICMP
* "Fragment Reassembly Timeout" message, per RFC792. * "Fragment Reassembly Timeout" message, per RFC792.
*/ */
if (qp->user == IP_DEFRAG_AF_PACKET || if (qp->user == IP_DEFRAG_AF_PACKET ||
...@@ -221,7 +222,6 @@ static void ip_expire(unsigned long arg) ...@@ -221,7 +222,6 @@ static void ip_expire(unsigned long arg)
(skb_rtable(head)->rt_type != RTN_LOCAL))) (skb_rtable(head)->rt_type != RTN_LOCAL)))
goto out_rcu_unlock; goto out_rcu_unlock;
/* Send an ICMP "Fragment Reassembly Timeout" message. */ /* Send an ICMP "Fragment Reassembly Timeout" message. */
icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0); icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
out_rcu_unlock: out_rcu_unlock:
......
...@@ -141,19 +141,20 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, ...@@ -141,19 +141,20 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
if (!dev) if (!dev)
goto out_rcu_unlock; goto out_rcu_unlock;
if (!(fq->q.flags & INET_FRAG_EVICTED))
IP6_INC_STATS_BH(net, __in6_dev_get(dev),
IPSTATS_MIB_REASMTIMEOUT);
IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
if (fq->q.flags & INET_FRAG_EVICTED)
goto out_rcu_unlock;
IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMTIMEOUT);
/* Don't send error if the first segment did not arrive. */ /* Don't send error if the first segment did not arrive. */
if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments) if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments)
goto out_rcu_unlock; goto out_rcu_unlock;
/* /* But use as source device on which LAST ARRIVED
But use as source device on which LAST ARRIVED * segment was received. And do not use fq->dev
segment was received. And do not use fq->dev * pointer directly, device might already disappeared.
pointer directly, device might already disappeared.
*/ */
fq->q.fragments->dev = dev; fq->q.fragments->dev = dev;
icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0); icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment