[netfilter-cvslog] r6648 - trunk/iptables/libiptc

kaber at netfilter.org kaber at netfilter.org
Thu Jul 20 19:18:44 CEST 2006


Author: kaber at netfilter.org
Date: 2006-07-20 19:18:44 +0200 (Thu, 20 Jul 2006)
New Revision: 6648

Modified:
   trunk/iptables/libiptc/libiptc.c
Log:
[PATCH] BUG: libiptc chain references bug (Jesper Brouer <hawk at diku.dk>)

Correcting a chain references increment bug in libiptc.

The bug lies in function iptc_delete_entry() / TC_DELETE_ENTRY.  The
problem is the construction of "r" the rule entry, that is used for
comparison. The problem is that the function iptcc_map_target()
increase the target chains references count.


Modified: trunk/iptables/libiptc/libiptc.c
===================================================================
--- trunk/iptables/libiptc/libiptc.c	2006-07-20 17:01:54 UTC (rev 6647)
+++ trunk/iptables/libiptc/libiptc.c	2006-07-20 17:18:44 UTC (rev 6648)
@@ -1519,6 +1519,14 @@
 		DEBUGP("unable to map target of rule for chain `%s'\n", chain);
 		free(r);
 		return 0;
+	} else {
+		/* iptcc_map_target increment target chain references
+		 * since this is a fake rule only used for matching
+		 * the chain references count is decremented again. 
+		 */
+		if (r->type == IPTCC_R_JUMP
+		    && r->jump)
+			r->jump->references--;
 	}
 
 	list_for_each_entry(i, &c->rules, list) {




More information about the netfilter-cvslog mailing list