aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-04-13 01:17:05 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:02 -0400
commitb076deb8498e26c9aa2f44046fe5e9936ae2fb5a (patch)
treecd0464e3c5074162ccd6bef31982064b76e976c1 /net
parentd3a2c3ca8e7d908824701db978b936d115aea506 (diff)
[NETFILTER]: ipt_ULOG: 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_ULOG.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index d26bbd2daaa9..a2bcba70af50 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -349,12 +349,52 @@ static int ipt_ulog_checkentry(const char *tablename,
349 return 1; 349 return 1;
350} 350}
351 351
352#ifdef CONFIG_COMPAT
353struct compat_ipt_ulog_info {
354 compat_uint_t nl_group;
355 compat_size_t copy_range;
356 compat_size_t qthreshold;
357 char prefix[ULOG_PREFIX_LEN];
358};
359
360static void compat_from_user(void *dst, void *src)
361{
362 struct compat_ipt_ulog_info *cl = src;
363 struct ipt_ulog_info l = {
364 .nl_group = cl->nl_group,
365 .copy_range = cl->copy_range,
366 .qthreshold = cl->qthreshold,
367 };
368
369 memcpy(l.prefix, cl->prefix, sizeof(l.prefix));
370 memcpy(dst, &l, sizeof(l));
371}
372
373static int compat_to_user(void __user *dst, void *src)
374{
375 struct ipt_ulog_info *l = src;
376 struct compat_ipt_ulog_info cl = {
377 .nl_group = l->nl_group,
378 .copy_range = l->copy_range,
379 .qthreshold = l->qthreshold,
380 };
381
382 memcpy(cl.prefix, l->prefix, sizeof(cl.prefix));
383 return copy_to_user(dst, &cl, sizeof(cl)) ? -EFAULT : 0;
384}
385#endif /* CONFIG_COMPAT */
386
352static struct xt_target ipt_ulog_reg = { 387static struct xt_target ipt_ulog_reg = {
353 .name = "ULOG", 388 .name = "ULOG",
354 .family = AF_INET, 389 .family = AF_INET,
355 .target = ipt_ulog_target, 390 .target = ipt_ulog_target,
356 .targetsize = sizeof(struct ipt_ulog_info), 391 .targetsize = sizeof(struct ipt_ulog_info),
357 .checkentry = ipt_ulog_checkentry, 392 .checkentry = ipt_ulog_checkentry,
393#ifdef CONFIG_COMPAT
394 .compatsize = sizeof(struct compat_ipt_ulog_info),
395 .compat_from_user = compat_from_user,
396 .compat_to_user = compat_to_user,
397#endif
358 .me = THIS_MODULE, 398 .me = THIS_MODULE,
359}; 399};
360 400