Copy over 2.6.36 files to 3.0 - so patch-o-matic finds them
[ipt_ACCOUNT] / linux / net / ipv4 / netfilter / ipt_ACCOUNT.c
index e6f4ad3..a6c522c 100644 (file)
@@ -137,7 +137,8 @@ static int ipt_acc_table_insert(char *name, u_int32_t ip, u_int32_t netmask)
     for (i = 0; i < ACCOUNT_MAX_TABLES; i++) {
         /* Found free slot */
         if (ipt_acc_tables[i].name[0] == 0) {
-            u_int32_t j, calc_mask, netsize=0;
+            u_int32_t calc_mask, netsize=0;
+            int j;  /* needs to be signed, otherwise we risk endless loop */
             
             DEBUGP("ACCOUNT: Found free slot: %d\n", i);
             strncpy (ipt_acc_tables[i].name, name, ACCOUNT_TABLE_NAME_LEN-1);
@@ -413,9 +414,9 @@ static void ipt_acc_depth2_insert(struct ipt_acc_mask_8 *mask_8,
 }
 
 static unsigned int ipt_acc_target(struct sk_buff **pskb,
-                                       unsigned int hooknum,
                                        const struct net_device *in,
                                        const struct net_device *out,
+                                       unsigned int hooknum,
                                        const void *targinfo,
                                        void *userinfo)
 {
@@ -591,7 +592,8 @@ static int ipt_acc_handle_prepare_read(char *tablename,
             (struct ipt_acc_mask_8 *)ipt_acc_tables[table_nr].data;
         struct ipt_acc_mask_8 *network_8 = 
             (struct ipt_acc_mask_8 *)dest->data;
-        u_int32_t a;
+        struct ipt_acc_mask_16 *src_16, *network_16;
+        u_int32_t a, b;
 
         for (a = 0; a <= 255; a++) {
             if (src_8->mask_16[a]) {
@@ -606,9 +608,8 @@ static int ipt_acc_handle_prepare_read(char *tablename,
                 memcpy(network_8->mask_16[a], src_8->mask_16[a], 
                        sizeof(struct ipt_acc_mask_16));
 
-                struct ipt_acc_mask_16 *src_16 = src_8->mask_16[a];
-                struct ipt_acc_mask_16 *network_16 = network_8->mask_16[a];
-                u_int32_t b;
+                src_16 = src_8->mask_16[a];
+                network_16 = network_8->mask_16[a];
 
                 for (b = 0; b <= 255; b++) {
                     if (src_16->mask_24[b]) {
@@ -890,6 +891,7 @@ static int ipt_acc_get_ctl(struct sock *sk, int cmd, void *user, int *len)
             down(&ipt_acc_userspace_mutex);
             if ((handle.handle_nr = ipt_acc_handle_find_slot()) == -1) {
                 ipt_acc_data_free(dest.data, dest.depth);
+                up(&ipt_acc_userspace_mutex);
                 return -EINVAL;
             }
             memcpy(&ipt_acc_handles[handle.handle_nr], &dest,