Skip to contentSkip to conversation

ipt_dstlimit spinlock fixup

PATCH In review Phil Oester 2 participants 4 messages Aug 22, 2004 – Aug 23, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipt_dstlimit spinlock fixup

Since ipt_dstlimit makes use of MUST_BE_LOCKED macro, compiling without CONFIG_NETFILTER_DEBUG causes errors. Fix below.

Similar patch posted by Samir Bellabes a few days ago, but this one removes an unneeded #ifdef pair

This fixes bugzilla #225

Phil

dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c 2004-08-22 11:30:10.156485400 -0400 renamed from dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c 2004-02-22 19:15:45.000000000 -0500 +8 -0
diff -ru pom-orig/dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c pom-new/dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c
@@ -83,7 +83,11 @@
        struct dstlimit_cfg cfg;        /* config */
 
        /* used internally */
+#ifdef CONFIG_NETFILTER_DEBUG
+       struct spinlock_debug lock;     /* lock for list_head */
+#else
        spinlock_t lock;                /* lock for list_head */
+#endif
        u_int32_t rnd;                  /* random seed for hash */
        struct timer_list timer;        /* timer for gc */
        atomic_t count;                 /* number entries in table */
@@ -212,7 +216,11 @@
        atomic_set(&hinfo->count, 0);
        atomic_set(&hinfo->use, 1);
        hinfo->rnd = 0;
+#ifdef CONFIG_NETFILTER_DEBUG
+       hinfo->lock.l = SPIN_LOCK_UNLOCKED;
+#else
        hinfo->lock = SPIN_LOCK_UNLOCKED;
+#endif
        hinfo->pde = create_proc_entry(minfo->name, 0, dstlimit_procdir);
        if (!hinfo->pde) {
                vfree(hinfo);
#1 lore raw
Quoted 9 lines · Phil Oester

Since ipt_dstlimit makes use of MUST_BE_LOCKED macro, compiling without CONFIG_NETFILTER_DEBUG causes errors. Fix below.

Similar patch posted by Samir Bellabes a few days ago, but this one removes an unneeded #ifdef pair

This fixes bugzilla #225

Jozsefs conntrack_locking patch has the same problem, I wonder if we should introduce a spinlock_debug_t (if that is not taken yet) or better yet, kill lockhelp.h.

Regards
Patrick

Quoted 33 lines

Phil

diff -ru pom-orig/dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c pom-new/dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c

dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c 2004-08-22 11:30:10.156485400 -0400 renamed from dstlimit/linux-2.6/net/ipv4/netfilter/ipt_dstlimit.c 2004-02-22 19:15:45.000000000 -0500 +8 -0
@@ -83,7 +83,11 @@
       struct dstlimit_cfg cfg;        /* config */
 
       /* used internally */
+#ifdef CONFIG_NETFILTER_DEBUG
+       struct spinlock_debug lock;     /* lock for list_head */
+#else
       spinlock_t lock;                /* lock for list_head */
+#endif
       u_int32_t rnd;                  /* random seed for hash */
       struct timer_list timer;        /* timer for gc */
       atomic_t count;                 /* number entries in table */
@@ -212,7 +216,11 @@
       atomic_set(&hinfo->count, 0);
       atomic_set(&hinfo->use, 1);
       hinfo->rnd = 0;
+#ifdef CONFIG_NETFILTER_DEBUG
+       hinfo->lock.l = SPIN_LOCK_UNLOCKED;
+#else
       hinfo->lock = SPIN_LOCK_UNLOCKED;
+#endif
       hinfo->pde = create_proc_entry(minfo->name, 0, dstlimit_procdir);
       if (!hinfo->pde) {
               vfree(hinfo);
#2 lore raw
Quoted 8 lines · Patrick McHardy
Quoted 3 lines · Phil Oester

Since ipt_dstlimit makes use of MUST_BE_LOCKED macro, compiling without CONFIG_NETFILTER_DEBUG causes errors. Fix below.

Jozsefs conntrack_locking patch has the same problem, I wonder if we should introduce a spinlock_debug_t (if that is not taken yet) or better yet, kill lockhelp.h.

Or option 3: remove the MUST_BE_LOCKED users in both files. lockhelp does seem to be, er, helpful in some cases.

Phil

#3 lore raw
Quoted 12 lines · Phil Oester
Quoted 9 lines · Patrick McHardy
Quoted 5 lines · Phil Oester

Since ipt_dstlimit makes use of MUST_BE_LOCKED macro, compiling without CONFIG_NETFILTER_DEBUG causes errors. Fix below.

Quoted 10 lines
Quoted 5 lines

Jozsefs conntrack_locking patch has the same problem, I wonder if we should introduce a spinlock_debug_t (if that is not taken yet) or better yet, kill lockhelp.h.

Or option 3: remove the MUST_BE_LOCKED users in both files. lockhelp does seem to be, er, helpful in some cases.

With the conntrack patches we need to remove it from ip_conntrack_core.c and ip_nat_core.c, after that there really would be no readon for keeping it at all. There isn't any readon even today, spinlock.h already offers the same features.

Regards
Patrick

Quoted 4 lines

Phil