diff options
author | Andy Zhou <azhou@nicira.com> | 2015-05-15 14:15:35 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-19 00:15:26 -0400 |
commit | 5cf422808244ca8f1177c72fe6e1ce8322794b57 (patch) | |
tree | 4d708b5e01fc30682d5f4f2f4d6e6144e57eabaf /net | |
parent | a2ad5d2ad96e8d5b3b8f33583a82eae78dce4d49 (diff) | |
download | linux-stable-5cf422808244ca8f1177c72fe6e1ce8322794b57.tar.gz linux-stable-5cf422808244ca8f1177c72fe6e1ce8322794b57.tar.bz2 linux-stable-5cf422808244ca8f1177c72fe6e1ce8322794b57.zip |
ipv4: introduce frag_expire_skip_icmp()
Improve readability of skip ICMP for de-fragmentation expiration logic.
This change will also make the logic easier to maintain when the
following patches in this series are applied.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ip_fragment.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index cc1da6d9cb35..83424f1742b8 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -173,6 +173,13 @@ static void ipq_kill(struct ipq *ipq) inet_frag_kill(&ipq->q, &ip4_frags); } +static bool frag_expire_skip_icmp(u32 user) +{ + return user == IP_DEFRAG_AF_PACKET || + ip_defrag_user_in_between(user, IP_DEFRAG_CONNTRACK_IN, + __IP_DEFRAG_CONNTRACK_IN_END); +} + /* * Oops, a fragment queue timed out. Kill it and send an ICMP reply. */ @@ -217,10 +224,8 @@ static void ip_expire(unsigned long arg) /* Only an end host needs to send an ICMP * "Fragment Reassembly Timeout" message, per RFC792. */ - if (qp->user == IP_DEFRAG_AF_PACKET || - ((qp->user >= IP_DEFRAG_CONNTRACK_IN) && - (qp->user <= __IP_DEFRAG_CONNTRACK_IN_END) && - (skb_rtable(head)->rt_type != RTN_LOCAL))) + if (frag_expire_skip_icmp(qp->user) && + (skb_rtable(head)->rt_type != RTN_LOCAL)) goto out_rcu_unlock; /* Send an ICMP "Fragment Reassembly Timeout" message. */ |