Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34721
b: refs/heads/master
c: 127f15d
h: refs/heads/master
i:
  34719: 00bbd71
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Sep 22, 2006
1 parent 9d1e372 commit 1bceee1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 02c63cf777c331121bfb6e9c1440a9835ad2f2a8
refs/heads/master: 127f15dd659b20e722561ff8c86dc058e1a72323
29 changes: 29 additions & 0 deletions trunk/net/ipv4/netfilter/ipt_hashlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,39 @@ hashlimit_destroy(const struct xt_match *match, void *matchinfo)
htable_put(r->hinfo);
}

#ifdef CONFIG_COMPAT
struct compat_ipt_hashlimit_info {
char name[IFNAMSIZ];
struct hashlimit_cfg cfg;
compat_uptr_t hinfo;
compat_uptr_t master;
};

static void compat_from_user(void *dst, void *src)
{
int off = offsetof(struct compat_ipt_hashlimit_info, hinfo);

memcpy(dst, src, off);
memset(dst + off, 0, sizeof(struct compat_ipt_hashlimit_info) - off);
}

static int compat_to_user(void __user *dst, void *src)
{
int off = offsetof(struct compat_ipt_hashlimit_info, hinfo);

return copy_to_user(dst, src, off) ? -EFAULT : 0;
}
#endif

static struct ipt_match ipt_hashlimit = {
.name = "hashlimit",
.match = hashlimit_match,
.matchsize = sizeof(struct ipt_hashlimit_info),
#ifdef CONFIG_COMPAT
.compatsize = sizeof(struct compat_ipt_hashlimit_info),
.compat_from_user = compat_from_user,
.compat_to_user = compat_to_user,
#endif
.checkentry = hashlimit_checkentry,
.destroy = hashlimit_destroy,
.me = THIS_MODULE
Expand Down

0 comments on commit 1bceee1

Please sign in to comment.