[NETFILTER]: x_tables: make xt_compat_match_from_user usable in iterator macros
authorPatrick McHardy <kaber@trash.net>
Tue, 18 Dec 2007 05:46:40 +0000 (21:46 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:58:28 +0000 (14:58 -0800)
Make xt_compat_match_from_user return an int to make it usable in the
*tables iterator macros and kill a now unnecessary wrapper function.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter/x_tables.h
net/ipv4/netfilter/ip_tables.c
net/netfilter/x_tables.c

index e305f2d0d4d1d98612d2e91d8e88e4852c6b533b..616e6f4ede5914a479c36afc1a16a2df4ed974ab 100644 (file)
@@ -382,8 +382,8 @@ extern void xt_compat_lock(int af);
 extern void xt_compat_unlock(int af);
 
 extern int xt_compat_match_offset(struct xt_match *match);
-extern void xt_compat_match_from_user(struct xt_entry_match *m,
-                                     void **dstptr, int *size);
+extern int xt_compat_match_from_user(struct xt_entry_match *m,
+                                    void **dstptr, int *size);
 extern int xt_compat_match_to_user(struct xt_entry_match *m,
                                   void __user **dstptr, int *size);
 
index 7d24262331a4e6ec9d45c5022c0f29e1e7c10005..4586af397ef4382ca99b9feea203f746ac411df0 100644 (file)
@@ -1654,16 +1654,6 @@ release_matches:
        return ret;
 }
 
-static inline int
-compat_copy_match_from_user(struct ipt_entry_match *m,
-                           void **dstptr, compat_uint_t *size,
-                           const char *name, const struct ipt_ip *ip,
-                           unsigned int hookmask)
-{
-       xt_compat_match_from_user(m, dstptr, size);
-       return 0;
-}
-
 static int
 compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
                            unsigned int *size, const char *name,
@@ -1681,8 +1671,7 @@ compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
        memcpy(de, e, sizeof(struct ipt_entry));
 
        *dstptr += sizeof(struct compat_ipt_entry);
-       ret = IPT_MATCH_ITERATE(e, compat_copy_match_from_user, dstptr, size,
-                               name, &de->ip, de->comefrom);
+       ret = IPT_MATCH_ITERATE(e, xt_compat_match_from_user, dstptr, size);
        if (ret)
                return ret;
        de->target_offset = e->target_offset - (origsize - *size);
index 07bb465d951814f623fc2d4be21cc448d208d5ab..b95284ee4fd471cd86d7b53f8176bfc96397b2be 100644 (file)
@@ -342,8 +342,8 @@ int xt_compat_match_offset(struct xt_match *match)
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_offset);
 
-void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
-                              int *size)
+int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
+                             int *size)
 {
        struct xt_match *match = m->u.kernel.match;
        struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
@@ -365,6 +365,7 @@ void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
 
        *size += off;
        *dstptr += msize;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_from_user);