aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-09-20 15:06:40 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:20:05 -0400
commit7ce975b9da93b46dbf6ba70a1b4751bec211d079 (patch)
treefac49f960fff7ac2bfbfec200f30fe1a377d48cd
parentf1eda05386ade8dad4e8e9b48ecbd9432b6739d9 (diff)
[NETFILTER]: xt_CONNMARK: 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_CONNMARK.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index 6ccb45ee0880..c01524f817f0 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -108,6 +108,37 @@ checkentry(const char *tablename,
108 return 1; 108 return 1;
109} 109}
110 110
111#ifdef CONFIG_COMPAT
112struct compat_xt_connmark_target_info {
113 compat_ulong_t mark, mask;
114 u_int8_t mode;
115 u_int8_t __pad1;
116 u_int16_t __pad2;
117};
118
119static void compat_from_user(void *dst, void *src)
120{
121 struct compat_xt_connmark_target_info *cm = src;
122 struct xt_connmark_target_info m = {
123 .mark = cm->mark,
124 .mask = cm->mask,
125 .mode = cm->mode,
126 };
127 memcpy(dst, &m, sizeof(m));
128}
129
130static int compat_to_user(void __user *dst, void *src)
131{
132 struct xt_connmark_target_info *m = src;
133 struct compat_xt_connmark_target_info cm = {
134 .mark = m->mark,
135 .mask = m->mask,
136 .mode = m->mode,
137 };
138 return copy_to_user(dst, &cm, sizeof(cm)) ? -EFAULT : 0;
139}
140#endif /* CONFIG_COMPAT */
141
111static struct xt_target xt_connmark_target[] = { 142static struct xt_target xt_connmark_target[] = {
112 { 143 {
113 .name = "CONNMARK", 144 .name = "CONNMARK",
@@ -115,6 +146,11 @@ static struct xt_target xt_connmark_target[] = {
115 .checkentry = checkentry, 146 .checkentry = checkentry,
116 .target = target, 147 .target = target,
117 .targetsize = sizeof(struct xt_connmark_target_info), 148 .targetsize = sizeof(struct xt_connmark_target_info),
149#ifdef CONFIG_COMPAT
150 .compatsize = sizeof(struct compat_xt_connmark_target_info),
151 .compat_from_user = compat_from_user,
152 .compat_to_user = compat_to_user,
153#endif
118 .me = THIS_MODULE 154 .me = THIS_MODULE
119 }, 155 },
120 { 156 {