aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-12-18 00:46:40 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:58:28 -0500
commit8956695131b8a7878891667469899d667eb5892b (patch)
tree1034260f3a5d1e7258cc2193734516a697c83e47
parent4b4782486d49547bc589b64acfb956bda05f0fca (diff)
[NETFILTER]: x_tables: make xt_compat_match_from_user usable in iterator macros
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>
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--net/ipv4/netfilter/ip_tables.c13
-rw-r--r--net/netfilter/x_tables.c5
3 files changed, 6 insertions, 16 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index e305f2d0d4d1..616e6f4ede59 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -382,8 +382,8 @@ extern void xt_compat_lock(int af);
382extern void xt_compat_unlock(int af); 382extern void xt_compat_unlock(int af);
383 383
384extern int xt_compat_match_offset(struct xt_match *match); 384extern int xt_compat_match_offset(struct xt_match *match);
385extern void xt_compat_match_from_user(struct xt_entry_match *m, 385extern int xt_compat_match_from_user(struct xt_entry_match *m,
386 void **dstptr, int *size); 386 void **dstptr, int *size);
387extern int xt_compat_match_to_user(struct xt_entry_match *m, 387extern int xt_compat_match_to_user(struct xt_entry_match *m,
388 void __user **dstptr, int *size); 388 void __user **dstptr, int *size);
389 389
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 7d24262331a4..4586af397ef4 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1654,16 +1654,6 @@ release_matches:
1654 return ret; 1654 return ret;
1655} 1655}
1656 1656
1657static inline int
1658compat_copy_match_from_user(struct ipt_entry_match *m,
1659 void **dstptr, compat_uint_t *size,
1660 const char *name, const struct ipt_ip *ip,
1661 unsigned int hookmask)
1662{
1663 xt_compat_match_from_user(m, dstptr, size);
1664 return 0;
1665}
1666
1667static int 1657static int
1668compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr, 1658compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
1669 unsigned int *size, const char *name, 1659 unsigned int *size, const char *name,
@@ -1681,8 +1671,7 @@ compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
1681 memcpy(de, e, sizeof(struct ipt_entry)); 1671 memcpy(de, e, sizeof(struct ipt_entry));
1682 1672
1683 *dstptr += sizeof(struct compat_ipt_entry); 1673 *dstptr += sizeof(struct compat_ipt_entry);
1684 ret = IPT_MATCH_ITERATE(e, compat_copy_match_from_user, dstptr, size, 1674 ret = IPT_MATCH_ITERATE(e, xt_compat_match_from_user, dstptr, size);
1685 name, &de->ip, de->comefrom);
1686 if (ret) 1675 if (ret)
1687 return ret; 1676 return ret;
1688 de->target_offset = e->target_offset - (origsize - *size); 1677 de->target_offset = e->target_offset - (origsize - *size);
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 07bb465d9518..b95284ee4fd4 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -342,8 +342,8 @@ int xt_compat_match_offset(struct xt_match *match)
342} 342}
343EXPORT_SYMBOL_GPL(xt_compat_match_offset); 343EXPORT_SYMBOL_GPL(xt_compat_match_offset);
344 344
345void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, 345int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
346 int *size) 346 int *size)
347{ 347{
348 struct xt_match *match = m->u.kernel.match; 348 struct xt_match *match = m->u.kernel.match;
349 struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m; 349 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,
365 365
366 *size += off; 366 *size += off;
367 *dstptr += msize; 367 *dstptr += msize;
368 return 0;
368} 369}
369EXPORT_SYMBOL_GPL(xt_compat_match_from_user); 370EXPORT_SYMBOL_GPL(xt_compat_match_from_user);
370 371