Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[powerpc.git] / net / netfilter / nf_conntrack_expect.c
index c20f901..117cbfd 100644 (file)
@@ -91,25 +91,28 @@ EXPORT_SYMBOL_GPL(nf_conntrack_expect_find_get);
 struct nf_conntrack_expect *
 find_expectation(const struct nf_conntrack_tuple *tuple)
 {
-       struct nf_conntrack_expect *i;
+       struct nf_conntrack_expect *exp;
+
+       exp = __nf_conntrack_expect_find(tuple);
+       if (!exp)
+               return NULL;
 
-       list_for_each_entry(i, &nf_conntrack_expect_list, list) {
        /* If master is not in hash table yet (ie. packet hasn't left
           this machine yet), how can other end know about expected?
           Hence these are not the droids you are looking for (if
           master ct never got confirmed, we'd hold a reference to it
           and weird things would happen to future packets). */
-               if (nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask)
-                   && nf_ct_is_confirmed(i->master)) {
-                       if (i->flags & NF_CT_EXPECT_PERMANENT) {
-                               atomic_inc(&i->use);
-                               return i;
-                       } else if (del_timer(&i->timeout)) {
-                               nf_ct_unlink_expect(i);
-                               return i;
-                       }
-               }
+       if (!nf_ct_is_confirmed(exp->master))
+               return NULL;
+
+       if (exp->flags & NF_CT_EXPECT_PERMANENT) {
+               atomic_inc(&exp->use);
+               return exp;
+       } else if (del_timer(&exp->timeout)) {
+               nf_ct_unlink_expect(exp);
+               return exp;
        }
+
        return NULL;
 }
 
@@ -127,7 +130,7 @@ void nf_ct_remove_expectations(struct nf_conn *ct)
                if (i->master == ct && del_timer(&i->timeout)) {
                        nf_ct_unlink_expect(i);
                        nf_conntrack_expect_put(i);
-               }
+               }
        }
 }
 EXPORT_SYMBOL_GPL(nf_ct_remove_expectations);
@@ -174,7 +177,7 @@ void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp)
        struct nf_conntrack_expect *i;
 
        write_lock_bh(&nf_conntrack_lock);
-       /* choose the the oldest expectation to evict */
+       /* choose the oldest expectation to evict */
        list_for_each_entry_reverse(i, &nf_conntrack_expect_list, list) {
                if (expect_matches(i, exp) && del_timer(&i->timeout)) {
                        nf_ct_unlink_expect(i);
@@ -287,9 +290,7 @@ static void nf_conntrack_expect_insert(struct nf_conntrack_expect *exp)
        master_help->expecting++;
        list_add(&exp->list, &nf_conntrack_expect_list);
 
-       init_timer(&exp->timeout);
-       exp->timeout.data = (unsigned long)exp;
-       exp->timeout.function = expectation_timed_out;
+       setup_timer(&exp->timeout, expectation_timed_out, (unsigned long)exp);
        exp->timeout.expires = jiffies + master_help->helper->timeout * HZ;
        add_timer(&exp->timeout);
 
@@ -432,7 +433,7 @@ static int exp_open(struct inode *inode, struct file *file)
        return seq_open(file, &exp_seq_ops);
 }
 
-struct file_operations exp_file_ops = {
+const struct file_operations exp_file_ops = {
        .owner   = THIS_MODULE,
        .open    = exp_open,
        .read    = seq_read,