netfilter: net/ipv[46]/netfilter: Move && and || to end of previous line
[safe/jmp/linux-2.6] / net / ipv6 / netfilter / nf_conntrack_proto_icmpv6.c
index a0acd96..0f3df45 100644 (file)
@@ -95,17 +95,10 @@ static int icmpv6_packet(struct nf_conn *ct,
                       u_int8_t pf,
                       unsigned int hooknum)
 {
-       /* Try to delete connection immediately after all replies:
-          won't actually vanish as we still have skb, and del_timer
-          means this will only run once even if count hits zero twice
-          (theoretically possible with SMP) */
-       if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
-               if (atomic_dec_and_test(&ct->proto.icmp.count))
-                       nf_ct_kill_acct(ct, ctinfo, skb);
-       } else {
-               atomic_inc(&ct->proto.icmp.count);
-               nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmpv6_timeout);
-       }
+       /* Do not immediately delete the connection after the first
+          successful reply to avoid excessive conntrackd traffic
+          and also to handle correctly ICMP echo reply duplicates. */
+       nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmpv6_timeout);
 
        return NF_ACCEPT;
 }
@@ -131,7 +124,6 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
                                      type + 128);
                return false;
        }
-       atomic_set(&ct->proto.icmp.count, 0);
        return true;
 }
 
@@ -252,18 +244,18 @@ static const struct nla_policy icmpv6_nla_policy[CTA_PROTO_MAX+1] = {
 static int icmpv6_nlattr_to_tuple(struct nlattr *tb[],
                                struct nf_conntrack_tuple *tuple)
 {
-       if (!tb[CTA_PROTO_ICMPV6_TYPE]
-           || !tb[CTA_PROTO_ICMPV6_CODE]
-           || !tb[CTA_PROTO_ICMPV6_ID])
+       if (!tb[CTA_PROTO_ICMPV6_TYPE] ||
+           !tb[CTA_PROTO_ICMPV6_CODE] ||
+           !tb[CTA_PROTO_ICMPV6_ID])
                return -EINVAL;
 
        tuple->dst.u.icmp.type = nla_get_u8(tb[CTA_PROTO_ICMPV6_TYPE]);
        tuple->dst.u.icmp.code = nla_get_u8(tb[CTA_PROTO_ICMPV6_CODE]);
        tuple->src.u.icmp.id = nla_get_be16(tb[CTA_PROTO_ICMPV6_ID]);
 
-       if (tuple->dst.u.icmp.type < 128
-           || tuple->dst.u.icmp.type - 128 >= sizeof(invmap)
-           || !invmap[tuple->dst.u.icmp.type - 128])
+       if (tuple->dst.u.icmp.type < 128 ||
+           tuple->dst.u.icmp.type - 128 >= sizeof(invmap) ||
+           !invmap[tuple->dst.u.icmp.type - 128])
                return -EINVAL;
 
        return 0;