aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-09-20 15:06:10 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:20:03 -0400
commitbe7263b7b72ed9d5d25958f2b71e77e889e4845a (patch)
tree1dbe32317083bd80b1b7b805b3e3889a86f1f302
parentbc80b656657251fc936d2d93fc70d5566c1c7d29 (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>
-rw-r--r--net/netfilter/xt_MARK.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/net/netfilter/xt_MARK.c b/net/netfilter/xt_MARK.c
index 782f8d8c3edf..c6e860a7114f 100644
--- a/net/netfilter/xt_MARK.c
+++ b/net/netfilter/xt_MARK.c
@@ -108,6 +108,35 @@ checkentry_v1(const char *tablename,
108 return 1; 108 return 1;
109} 109}
110 110
111#ifdef CONFIG_COMPAT
112struct compat_xt_mark_target_info_v1 {
113 compat_ulong_t mark;
114 u_int8_t mode;
115 u_int8_t __pad1;
116 u_int16_t __pad2;
117};
118
119static void compat_from_user_v1(void *dst, void *src)
120{
121 struct compat_xt_mark_target_info_v1 *cm = src;
122 struct xt_mark_target_info_v1 m = {
123 .mark = cm->mark,
124 .mode = cm->mode,
125 };
126 memcpy(dst, &m, sizeof(m));
127}
128
129static int compat_to_user_v1(void __user *dst, void *src)
130{
131 struct xt_mark_target_info_v1 *m = src;
132 struct compat_xt_mark_target_info_v1 cm = {
133 .mark = m->mark,
134 .mode = m->mode,
135 };
136 return copy_to_user(dst, &cm, sizeof(cm)) ? -EFAULT : 0;
137}
138#endif /* CONFIG_COMPAT */
139
111static struct xt_target xt_mark_target[] = { 140static struct xt_target xt_mark_target[] = {
112 { 141 {
113 .name = "MARK", 142 .name = "MARK",
@@ -126,6 +155,11 @@ static struct xt_target xt_mark_target[] = {
126 .checkentry = checkentry_v1, 155 .checkentry = checkentry_v1,
127 .target = target_v1, 156 .target = target_v1,
128 .targetsize = sizeof(struct xt_mark_target_info_v1), 157 .targetsize = sizeof(struct xt_mark_target_info_v1),
158#ifdef CONFIG_COMPAT
159 .compatsize = sizeof(struct compat_xt_mark_target_info_v1),
160 .compat_from_user = compat_from_user_v1,
161 .compat_to_user = compat_to_user_v1,
162#endif
129 .table = "mangle", 163 .table = "mangle",
130 .me = THIS_MODULE, 164 .me = THIS_MODULE,
131 }, 165 },