diff options
author | Patrick McHardy <kaber@trash.net> | 2006-09-20 15:05:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 18:20:02 -0400 |
commit | bc80b656657251fc936d2d93fc70d5566c1c7d29 (patch) | |
tree | 3b781d832a742a57beda451e4c05a73b31b5d055 /net | |
parent | 9fa492cdc160cd27ce1046cb36f47d3b2b1efa21 (diff) |
[NETFILTER]: xt_mark: 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/netfilter/xt_mark.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/net/netfilter/xt_mark.c b/net/netfilter/xt_mark.c index e8059cd17275..934dddfbcd23 100644 --- a/net/netfilter/xt_mark.c +++ b/net/netfilter/xt_mark.c | |||
@@ -50,6 +50,37 @@ checkentry(const char *tablename, | |||
50 | return 1; | 50 | return 1; |
51 | } | 51 | } |
52 | 52 | ||
53 | #ifdef CONFIG_COMPAT | ||
54 | struct compat_xt_mark_info { | ||
55 | compat_ulong_t mark, mask; | ||
56 | u_int8_t invert; | ||
57 | u_int8_t __pad1; | ||
58 | u_int16_t __pad2; | ||
59 | }; | ||
60 | |||
61 | static void compat_from_user(void *dst, void *src) | ||
62 | { | ||
63 | struct compat_xt_mark_info *cm = src; | ||
64 | struct xt_mark_info m = { | ||
65 | .mark = cm->mark, | ||
66 | .mask = cm->mask, | ||
67 | .invert = cm->invert, | ||
68 | }; | ||
69 | memcpy(dst, &m, sizeof(m)); | ||
70 | } | ||
71 | |||
72 | static int compat_to_user(void __user *dst, void *src) | ||
73 | { | ||
74 | struct xt_mark_info *m = src; | ||
75 | struct compat_xt_mark_info cm = { | ||
76 | .mark = m->mark, | ||
77 | .mask = m->mask, | ||
78 | .invert = m->invert, | ||
79 | }; | ||
80 | return copy_to_user(dst, &cm, sizeof(cm)) ? -EFAULT : 0; | ||
81 | } | ||
82 | #endif /* CONFIG_COMPAT */ | ||
83 | |||
53 | static struct xt_match xt_mark_match[] = { | 84 | static struct xt_match xt_mark_match[] = { |
54 | { | 85 | { |
55 | .name = "mark", | 86 | .name = "mark", |
@@ -57,6 +88,11 @@ static struct xt_match xt_mark_match[] = { | |||
57 | .checkentry = checkentry, | 88 | .checkentry = checkentry, |
58 | .match = match, | 89 | .match = match, |
59 | .matchsize = sizeof(struct xt_mark_info), | 90 | .matchsize = sizeof(struct xt_mark_info), |
91 | #ifdef CONFIG_COMPAT | ||
92 | .compatsize = sizeof(struct compat_xt_mark_info), | ||
93 | .compat_from_user = compat_from_user, | ||
94 | .compat_to_user = compat_to_user, | ||
95 | #endif | ||
60 | .me = THIS_MODULE, | 96 | .me = THIS_MODULE, |
61 | }, | 97 | }, |
62 | { | 98 | { |