patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / net / ipv4 / netfilter / arp_tables.c
index 822380b..65230e5 100644 (file)
@@ -179,11 +179,10 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
                return 0;
        }
 
-       /* Look for ifname matches; this should unroll nicely. */
-       for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
-               ret |= (((const unsigned long *)indev)[i]
-                       ^ ((const unsigned long *)arpinfo->iniface)[i])
-                       & ((const unsigned long *)arpinfo->iniface_mask)[i];
+       /* Look for ifname matches.  */
+       for (i = 0, ret = 0; i < IFNAMSIZ; i++) {
+               ret |= (indev[i] ^ arpinfo->iniface[i])
+                       & arpinfo->iniface_mask[i];
        }
 
        if (FWINV(ret != 0, ARPT_INV_VIA_IN)) {
@@ -388,12 +387,12 @@ find_inlist_lock(struct list_head *head,
 }
 #endif
 
-static inline struct arpt_table *find_table_lock(const char *name, int *error, struct semaphore *mutex)
+static inline struct arpt_table *arpt_find_table_lock(const char *name, int *error, struct semaphore *mutex)
 {
        return find_inlist_lock(&arpt_tables, name, "arptable_", error, mutex);
 }
 
-static inline struct arpt_target *find_target_lock(const char *name, int *error, struct semaphore *mutex)
+struct arpt_target *arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex)
 {
        return find_inlist_lock(&arpt_target, name, "arpt_", error, mutex);
 }
@@ -543,7 +542,7 @@ static inline int check_entry(struct arpt_entry *e, const char *name, unsigned i
        }
 
        t = arpt_get_target(e);
-       target = find_target_lock(t->u.user.name, &ret, &arpt_mutex);
+       target = arpt_find_target_lock(t->u.user.name, &ret, &arpt_mutex);
        if (!target) {
                duprintf("check_entry: `%s' not found\n", t->u.user.name);
                goto out;
@@ -778,7 +777,7 @@ static void get_counters(const struct arpt_table_info *t,
 
 static int copy_entries_to_user(unsigned int total_size,
                                struct arpt_table *table,
-                               void *userptr)
+                               void __user *userptr)
 {
        unsigned int off, num, countersize;
        struct arpt_entry *e;
@@ -838,12 +837,12 @@ static int copy_entries_to_user(unsigned int total_size,
 }
 
 static int get_entries(const struct arpt_get_entries *entries,
-                      struct arpt_get_entries *uptr)
+                      struct arpt_get_entries __user *uptr)
 {
        int ret;
        struct arpt_table *t;
 
-       t = find_table_lock(entries->name, &ret, &arpt_mutex);
+       t = arpt_find_table_lock(entries->name, &ret, &arpt_mutex);
        if (t) {
                duprintf("t->private->number = %u\n",
                         t->private->number);
@@ -864,7 +863,7 @@ static int get_entries(const struct arpt_get_entries *entries,
        return ret;
 }
 
-static int do_replace(void *user, unsigned int len)
+static int do_replace(void __user *user, unsigned int len)
 {
        int ret;
        struct arpt_replace tmp;
@@ -909,7 +908,7 @@ static int do_replace(void *user, unsigned int len)
 
        duprintf("arp_tables: Translated table\n");
 
-       t = find_table_lock(tmp.name, &ret, &arpt_mutex);
+       t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex);
        if (!t)
                goto free_newinfo_counters_untrans;
 
@@ -980,7 +979,7 @@ static inline int add_counter_to_entry(struct arpt_entry *e,
        return 0;
 }
 
-static int do_add_counters(void *user, unsigned int len)
+static int do_add_counters(void __user *user, unsigned int len)
 {
        unsigned int i;
        struct arpt_counters_info tmp, *paddc;
@@ -1002,7 +1001,7 @@ static int do_add_counters(void *user, unsigned int len)
                goto free;
        }
 
-       t = find_table_lock(tmp.name, &ret, &arpt_mutex);
+       t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex);
        if (!t)
                goto free;
 
@@ -1027,7 +1026,7 @@ static int do_add_counters(void *user, unsigned int len)
        return ret;
 }
 
-static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len)
+static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
 {
        int ret;
 
@@ -1051,7 +1050,7 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int le
        return ret;
 }
 
-static int do_arpt_get_ctl(struct sock *sk, int cmd, void *user, int *len)
+static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 {
        int ret;
 
@@ -1075,7 +1074,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void *user, int *len)
                        break;
                }
                name[ARPT_TABLE_MAXNAMELEN-1] = '\0';
-               t = find_table_lock(name, &ret, &arpt_mutex);
+               t = arpt_find_table_lock(name, &ret, &arpt_mutex);
                if (t) {
                        struct arpt_getinfo info;
 
@@ -1323,6 +1322,7 @@ static void __exit fini(void)
 EXPORT_SYMBOL(arpt_register_table);
 EXPORT_SYMBOL(arpt_unregister_table);
 EXPORT_SYMBOL(arpt_do_table);
+EXPORT_SYMBOL(arpt_find_target_lock);
 EXPORT_SYMBOL(arpt_register_target);
 EXPORT_SYMBOL(arpt_unregister_target);