diff options
author | Patrick McHardy <kaber@trash.net> | 2006-09-20 15:07:23 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:20:06 -0400 |
commit | 127f15dd659b20e722561ff8c86dc058e1a72323 (patch) | |
tree | 1a197ff0866d6984899e793d214c19ce565cafb6 /net | |
parent | 02c63cf777c331121bfb6e9c1440a9835ad2f2a8 (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.c | 29 |
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 | ||
539 | struct 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 | |||
546 | static 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 | |||
554 | static 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 | |||
538 | static struct ipt_match ipt_hashlimit = { | 562 | static 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 |