]> err.no Git - linux-2.6/blobdiff - net/ipv4/netfilter/ipt_recent.c
netfilter: nf_nat_sip: c= is optional for session
[linux-2.6] / net / ipv4 / netfilter / ipt_recent.c
index e3154a99c08ae9d975378b80684b8f361fd07839..21cb053f5d7dbe46b4d8b7aff9da9a6167fcf43d 100644 (file)
@@ -212,11 +212,11 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
                recent_entry_remove(t, e);
                ret = !ret;
        } else if (info->check_set & (IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) {
-               unsigned long t = jiffies - info->seconds * HZ;
+               unsigned long time = jiffies - info->seconds * HZ;
                unsigned int i, hits = 0;
 
                for (i = 0; i < e->nstamps; i++) {
-                       if (info->seconds && time_after(t, e->stamps[i]))
+                       if (info->seconds && time_after(time, e->stamps[i]))
                                continue;
                        if (++hits >= info->hit_count) {
                                ret = !ret;
@@ -252,6 +252,8 @@ recent_mt_check(const char *tablename, const void *ip,
        if ((info->check_set & (IPT_RECENT_SET | IPT_RECENT_REMOVE)) &&
            (info->seconds || info->hit_count))
                return false;
+       if (info->hit_count > ip_pkt_list_tot)
+               return false;
        if (info->name[0] == '\0' ||
            strnlen(info->name, IPT_RECENT_NAME_LEN) == IPT_RECENT_NAME_LEN)
                return false;
@@ -274,12 +276,11 @@ recent_mt_check(const char *tablename, const void *ip,
        for (i = 0; i < ip_list_hash_size; i++)
                INIT_LIST_HEAD(&t->iphash[i]);
 #ifdef CONFIG_PROC_FS
-       t->proc = create_proc_entry(t->name, ip_list_perms, proc_dir);
+       t->proc = proc_create(t->name, ip_list_perms, proc_dir, &recent_fops);
        if (t->proc == NULL) {
                kfree(t);
                goto out;
        }
-       t->proc->proc_fops = &recent_fops;
        t->proc->uid       = ip_list_uid;
        t->proc->gid       = ip_list_gid;
        t->proc->data      = t;
@@ -320,6 +321,7 @@ struct recent_iter_state {
 };
 
 static void *recent_seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(recent_lock)
 {
        struct recent_iter_state *st = seq->private;
        const struct recent_table *t = st->table;
@@ -338,7 +340,7 @@ static void *recent_seq_start(struct seq_file *seq, loff_t *pos)
 static void *recent_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
        struct recent_iter_state *st = seq->private;
-       struct recent_table *t = st->table;
+       const struct recent_table *t = st->table;
        struct recent_entry *e = v;
        struct list_head *head = e->list.next;
 
@@ -352,13 +354,14 @@ static void *recent_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void recent_seq_stop(struct seq_file *s, void *v)
+       __releases(recent_lock)
 {
        spin_unlock_bh(&recent_lock);
 }
 
 static int recent_seq_show(struct seq_file *seq, void *v)
 {
-       struct recent_entry *e = v;
+       const struct recent_entry *e = v;
        unsigned int i;
 
        i = (e->index - 1) % ip_pkt_list_tot;
@@ -393,7 +396,7 @@ static int recent_seq_open(struct inode *inode, struct file *file)
 static ssize_t recent_proc_write(struct file *file, const char __user *input,
                                 size_t size, loff_t *loff)
 {
-       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
        struct recent_table *t = pde->data;
        struct recent_entry *e;
        char buf[sizeof("+255.255.255.255")], *c = buf;