aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-09-20 15:07:23 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:20:06 -0400
commit127f15dd659b20e722561ff8c86dc058e1a72323 (patch)
tree1a197ff0866d6984899e793d214c19ce565cafb6 /net
parent02c63cf777c331121bfb6e9c1440a9835ad2f2a8 (diff)
[NETFILTER]: ipt_hashlimit: add compat conversion functions
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/ipt_hashlimit.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
index b5b74b07370c..4f73a61aa3dd 100644
--- a/net/ipv4/netfilter/ipt_hashlimit.c
+++ b/net/ipv4/netfilter/ipt_hashlimit.c
@@ -535,10 +535,39 @@ hashlimit_destroy(const struct xt_match *match, void *matchinfo)
535 htable_put(r->hinfo); 535 htable_put(r->hinfo);
536} 536}
537 537
538#ifdef CONFIG_COMPAT
539struct compat_ipt_hashlimit_info {
540 char name[IFNAMSIZ];
541 struct hashlimit_cfg cfg;
542 compat_uptr_t hinfo;
543 compat_uptr_t master;
544};
545
546static void compat_from_user(void *dst, void *src)
547{
548 int off = offsetof(struct compat_ipt_hashlimit_info, hinfo);
549
550 memcpy(dst, src, off);
551 memset(dst + off, 0, sizeof(struct compat_ipt_hashlimit_info) - off);
552}
553
554static int compat_to_user(void __user *dst, void *src)
555{
556 int off = offsetof(struct compat_ipt_hashlimit_info, hinfo);
557
558 return copy_to_user(dst, src, off) ? -EFAULT : 0;
559}
560#endif
561
538static struct ipt_match ipt_hashlimit = { 562static struct ipt_match ipt_hashlimit = {
539 .name = "hashlimit", 563 .name = "hashlimit",
540 .match = hashlimit_match, 564 .match = hashlimit_match,
541 .matchsize = sizeof(struct ipt_hashlimit_info), 565 .matchsize = sizeof(struct ipt_hashlimit_info),
566#ifdef CONFIG_COMPAT
567 .compatsize = sizeof(struct compat_ipt_hashlimit_info),
568 .compat_from_user = compat_from_user,
569 .compat_to_user = compat_to_user,
570#endif
542 .checkentry = hashlimit_checkentry, 571 .checkentry = hashlimit_checkentry,
543 .destroy = hashlimit_destroy, 572 .destroy = hashlimit_destroy,
544 .me = THIS_MODULE 573 .me = THIS_MODULE