[netfilter-cvslog] r3825 - in trunk/patch-o-matic-ng/set: linux/net/ipv4/netfilter linux-2.6/net/ipv4/netfilter

kadlec at netfilter.org kadlec at netfilter.org
Tue Apr 5 09:57:20 CEST 2005


Author: kadlec at netfilter.org
Date: 2005-04-05 09:57:19 +0200 (Tue, 05 Apr 2005)
New Revision: 3825

Modified:
   trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set.c
   trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c
   trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set.c
   trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set_nethash.c
Log:
IP set fixes, see changelog in ipset (JK)


Modified: trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set.c
===================================================================
--- trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set.c	2005-04-04 11:10:09 UTC (rev 3824)
+++ trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set.c	2005-04-05 07:57:19 UTC (rev 3825)
@@ -246,6 +246,7 @@
 	int res, i= 0;
 
 	IP_SET_ASSERT(flags[i]);
+    retry:
 	READ_LOCK(&ip_set_lock);
 	do {
 		set = ip_set_list[index];
@@ -254,13 +255,15 @@
 		write_lock_bh(&set->lock);
 		res = set->type->addip_kernel(set, skb, flags[i], &ip);
 		write_unlock_bh(&set->lock);
-	} while ((res == -EAGAIN
-		  && set->type->retry
-		  && (res = set->type->retry(set)) == 0)
-		 || ((res == 0 || res == -EEXIST)
-		     && flags[++i] 
-		     && follow_bindings(index, set, ip)));
+	} while ((res == 0 || res == -EEXIST)
+		 && flags[++i] 
+		 && follow_bindings(index, set, ip));
 	READ_UNLOCK(&ip_set_lock);
+	
+	if (res == -EAGAIN
+	    && set->type->retry
+	    && (res = set->type->retry(set)) == 0)
+	    	goto retry;
 }
 
 void
@@ -1300,11 +1303,11 @@
 		       set_restore->members_size) {
 			line++;
 		       	DP("members: %u, line %u", members_size, line);
-			if (__ip_set_addip(index,
+			res = __ip_set_addip(index,
 					   data + used + members_size,
-					   set->type->reqsize)) {
+					   set->type->reqsize);
+			if (!(res == 0 || res == -EEXIST))
 				return line;
-			}
 			members_size += set->type->reqsize;
 		}
 

Modified: trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set_nethash.c
===================================================================
--- trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set_nethash.c	2005-04-04 11:10:09 UTC (rev 3824)
+++ trunk/patch-o-matic-ng/set/linux/net/ipv4/netfilter/ip_set_nethash.c	2005-04-05 07:57:19 UTC (rev 3825)
@@ -255,8 +255,8 @@
 	}
 	if (res) {
 		/* Failure, try again */
+		write_unlock_bh(&set->lock);
 		ip_set_free(tmp.members, newbytes);
-		write_unlock_bh(&set->lock);
 		goto again;
 	}
 	

Modified: trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set.c
===================================================================
--- trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set.c	2005-04-04 11:10:09 UTC (rev 3824)
+++ trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set.c	2005-04-05 07:57:19 UTC (rev 3825)
@@ -233,6 +233,7 @@
 	int res, i= 0;
 
 	IP_SET_ASSERT(flags[i]);
+   retry:
 	READ_LOCK(&ip_set_lock);
 	do {
 		set = ip_set_list[index];
@@ -241,13 +242,15 @@
 		write_lock_bh(&set->lock);
 		res = set->type->addip_kernel(set, skb, flags[i], &ip);
 		write_unlock_bh(&set->lock);
-	} while ((res == -EAGAIN
-		  && set->type->retry
-		  && (res = set->type->retry(set)) == 0)
-		 || ((res == 0 || res == -EEXIST)
-		     && flags[++i] 
-		     && follow_bindings(index, set, ip)));
+	} while ((res == 0 || res == -EEXIST)
+		 && flags[++i] 
+		 && follow_bindings(index, set, ip));
 	READ_UNLOCK(&ip_set_lock);
+
+	if (res == -EAGAIN
+	    && set->type->retry
+	    && (res = set->type->retry(set)) == 0)
+	    	goto retry;
 }
 
 void
@@ -1287,11 +1290,11 @@
 		       set_restore->members_size) {
 			line++;
 		       	DP("members: %u, line %u", members_size, line);
-			if (__ip_set_addip(index,
+			res = __ip_set_addip(index,
 					   data + used + members_size,
-					   set->type->reqsize)) {
+					   set->type->reqsize);
+			if (!(res == 0 || res == -EEXIST)) 
 				return line;
-			}
 			members_size += set->type->reqsize;
 		}
 

Modified: trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c
===================================================================
--- trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c	2005-04-04 11:10:09 UTC (rev 3824)
+++ trunk/patch-o-matic-ng/set/linux-2.6/net/ipv4/netfilter/ip_set_nethash.c	2005-04-05 07:57:19 UTC (rev 3825)
@@ -254,8 +254,8 @@
 	}
 	if (res) {
 		/* Failure, try again */
+		write_unlock_bh(&set->lock);
 		ip_set_free(tmp.members, newbytes);
-		write_unlock_bh(&set->lock);
 		goto again;
 	}
 	




More information about the netfilter-cvslog mailing list