Skip to contentSkip to conversation

hashlimit: trivial fix for bug introduced by hlist change

PATCH Applied Harald Welte 2 participants 2 messages Mar 27, 2005 – Apr 1, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hashlimit: trivial fix for bug introduced by hlist change

Hi Dave!

Please apply the following fix to ipt_hashlimit.

Thanks,

(No signed-off-by by original author, but at least from a legal point there is no need, since trivial bugfixes don't even constitute a copyrightable work)

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

Hi Harald,

I've introduced a really annoying bug with the hlist change.. *sigh* __dsthash_find() will return junk as soon as there's something in the bucket.

Patch's attached.

Sorry for the inconveniant, please apply ASAP.

net/ipv4/netfilter/ipt_hashlimit.c +3 -3
@@ -116,18 +116,18 @@ hash_dst(const struct ipt_hashlimit_htab
 static inline struct dsthash_ent *
 __dsthash_find(const struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst)
 {
-	struct dsthash_ent *ent = NULL;
+	struct dsthash_ent *ent;
 	struct hlist_node *pos;
 	u_int32_t hash = hash_dst(ht, dst);
 
 	if (!hlist_empty(&ht->hash[hash]))
 		hlist_for_each_entry(ent, pos, &ht->hash[hash], node) {
 			if (dst_cmp(ent, dst)) {
-				break;
+				return ent;
 			}
 		}
 	
-	return ent;
+	return NULL;
 }
 
 /* allocate dsthash_ent, initialize dst, put in htable and lock it */
maintainer Applied
#1 lore raw
Quoted 1 line · On Sun, 27 Mar 2005 11:28:49 +0200 Harald Welte <[email protected]> wrote:

Please apply the following fix to ipt_hashlimit.

Applied, thanks Harald.