netfilter: h323: Use mod_timer instead of set_expect_timeout
authorGao Feng <fgao@ikuai8.com>
Fri, 22 Jul 2016 04:59:15 +0000 (12:59 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 23 Jul 2016 09:44:05 +0000 (11:44 +0200)
Simplify the code without any side effect. The set_expect_timeout is
used to modify the timer expired time.  It tries to delete timer, and
add it again.  So we could use mod_timer directly.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conntrack_h323_main.c

index 9511af04dc814258ddc136bdaabe02fd053720fc..bb77a97961bfde7b64a74aabdeafe405f73090ec 100644 (file)
@@ -1272,19 +1272,6 @@ static struct nf_conntrack_expect *find_expect(struct nf_conn *ct,
        return NULL;
 }
 
-/****************************************************************************/
-static int set_expect_timeout(struct nf_conntrack_expect *exp,
-                             unsigned int timeout)
-{
-       if (!exp || !del_timer(&exp->timeout))
-               return 0;
-
-       exp->timeout.expires = jiffies + timeout * HZ;
-       add_timer(&exp->timeout);
-
-       return 1;
-}
-
 /****************************************************************************/
 static int expect_q931(struct sk_buff *skb, struct nf_conn *ct,
                       enum ip_conntrack_info ctinfo,
@@ -1486,7 +1473,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
                                 "timeout to %u seconds for",
                                 info->timeout);
                        nf_ct_dump_tuple(&exp->tuple);
-                       set_expect_timeout(exp, info->timeout);
+                       mod_timer(&exp->timeout, jiffies + info->timeout * HZ);
                }
                spin_unlock_bh(&nf_conntrack_expect_lock);
        }