From: Nikolay Aleksandrov <nikolay@redhat.com>
To: netdev@vger.kernel.org
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>,
Florian Westphal <fw@strlen.de>,
Nikolay Aleksandrov <nikolay@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
Alexander Aring <alex.aring@gmail.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: [PATCH net-next v2 5/6] inet: frags: use INET_FRAG_EVICTED to prevent icmp messages
Date: Fri, 1 Aug 2014 12:29:47 +0200 [thread overview]
Message-ID: <1406888988-20742-6-git-send-email-nikolay@redhat.com> (raw)
In-Reply-To: <1406888988-20742-1-git-send-email-nikolay@redhat.com>
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: Nikolay Aleksandrov <nikolay@redhat.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
---
v2: no changes
net/ipv4/inet_fragment.c | 2 --
net/ipv4/ip_fragment.c | 14 +++++++-------
net/ipv6/reassembly.c | 15 ++++++++-------
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index fa49916c23a0..4baa76c60398 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -151,8 +151,6 @@ evict_again:
goto evict_again;
}
- /* suppress xmit of (icmp) error packet */
- fq->flags &= ~INET_FRAG_FIRST_IN;
fq->flags |= INET_FRAG_EVICTED;
hlist_del(&fq->list);
hlist_add_head(&fq->list, &expired);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 6fce1ecc5bca..cb56bcc1eee2 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -189,16 +189,18 @@ static void ip_expire(unsigned long arg)
goto out;
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);
- 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;
const struct iphdr *iph;
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();
head->dev = dev_get_by_index_rcu(net, qp->iif);
if (!head->dev)
@@ -211,8 +213,7 @@ static void ip_expire(unsigned long arg)
if (err)
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.
*/
if (qp->user == IP_DEFRAG_AF_PACKET ||
@@ -221,7 +222,6 @@ static void ip_expire(unsigned long arg)
(skb_rtable(head)->rt_type != RTN_LOCAL)))
goto out_rcu_unlock;
-
/* Send an ICMP "Fragment Reassembly Timeout" message. */
icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
out_rcu_unlock:
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index b4baceed0d0d..beb6872a8fa5 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -141,19 +141,20 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
if (!dev)
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);
+ 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. */
if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments)
goto out_rcu_unlock;
- /*
- But use as source device on which LAST ARRIVED
- segment was received. And do not use fq->dev
- pointer directly, device might already disappeared.
+ /* But use as source device on which LAST ARRIVED
+ * segment was received. And do not use fq->dev
+ * pointer directly, device might already disappeared.
*/
fq->q.fragments->dev = dev;
icmpv6_send(fq->q.fragments, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0);
--
1.9.3
next prev parent reply other threads:[~2014-08-01 10:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 10:29 [PATCH net-next v2 0/6] inet: frags: cleanup and kmem_cache use Nikolay Aleksandrov
2014-08-01 10:29 ` [PATCH net-next v2 1/6] inet: frags: use INC_STATS_BH in the ipv6 reassembly code Nikolay Aleksandrov
2014-08-01 10:29 ` [PATCH net-next v2 2/6] inet: frags: rename last_in to flags Nikolay Aleksandrov
2014-08-01 10:29 ` [PATCH net-next v2 3/6] inet: frags: enum the flag definitions and add descriptions Nikolay Aleksandrov
2014-08-01 10:29 ` [PATCH net-next v2 4/6] inet: frags: fix function declaration alignments in inet_fragment Nikolay Aleksandrov
2014-08-01 10:29 ` Nikolay Aleksandrov [this message]
2014-08-01 10:29 ` [PATCH net-next v2 6/6] inet: frags: use kmem_cache for inet_frag_queue Nikolay Aleksandrov
2014-08-01 11:24 ` [PATCH net-next v2 0/6] inet: frags: cleanup and kmem_cache use Alexander Aring
2014-08-02 22:32 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406888988-20742-6-git-send-email-nikolay@redhat.com \
--to=nikolay@redhat.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=hannes@stressinduktion.org \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).