Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b076deb8498e26c9aa2f44046fe5e9936ae2fb5a
Commit:     b076deb8498e26c9aa2f44046fe5e9936ae2fb5a
Parent:     d3a2c3ca8e7d908824701db978b936d115aea506
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 12 22:17:05 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:29:02 2007 -0700

    [NETFILTER]: ipt_ULOG: add compat conversion functions
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/netfilter/ipt_ULOG.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index d26bbd2..a2bcba7 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,
        return 1;
 }
 
+#ifdef CONFIG_COMPAT
+struct compat_ipt_ulog_info {
+       compat_uint_t   nl_group;
+       compat_size_t   copy_range;
+       compat_size_t   qthreshold;
+       char            prefix[ULOG_PREFIX_LEN];
+};
+
+static void compat_from_user(void *dst, void *src)
+{
+       struct compat_ipt_ulog_info *cl = src;
+       struct ipt_ulog_info l = {
+               .nl_group       = cl->nl_group,
+               .copy_range     = cl->copy_range,
+               .qthreshold     = cl->qthreshold,
+       };
+
+       memcpy(l.prefix, cl->prefix, sizeof(l.prefix));
+       memcpy(dst, &l, sizeof(l));
+}
+
+static int compat_to_user(void __user *dst, void *src)
+{
+       struct ipt_ulog_info *l = src;
+       struct compat_ipt_ulog_info cl = {
+               .nl_group       = l->nl_group,
+               .copy_range     = l->copy_range,
+               .qthreshold     = l->qthreshold,
+       };
+
+       memcpy(cl.prefix, l->prefix, sizeof(cl.prefix));
+       return copy_to_user(dst, &cl, sizeof(cl)) ? -EFAULT : 0;
+}
+#endif /* CONFIG_COMPAT */
+
 static struct xt_target ipt_ulog_reg = {
        .name           = "ULOG",
        .family         = AF_INET,
        .target         = ipt_ulog_target,
        .targetsize     = sizeof(struct ipt_ulog_info),
        .checkentry     = ipt_ulog_checkentry,
+#ifdef CONFIG_COMPAT
+       .compatsize     = sizeof(struct compat_ipt_ulog_info),
+       .compat_from_user = compat_from_user,
+       .compat_to_user = compat_to_user,
+#endif
        .me             = THIS_MODULE,
 };
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to