Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=da0dd231436ba7e81789e93dd933d7a275e1709d
Commit:     da0dd231436ba7e81789e93dd933d7a275e1709d
Parent:     802169a4b0f71d25a0f798a9c0657a565b1e79bc
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Thu May 10 14:17:58 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu May 10 23:48:00 2007 -0700

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

diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index f4ea8fe..189ded5 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -134,12 +134,66 @@ static void destroy(const struct xt_match *match, void 
*matchinfo)
        nf_ct_l3proto_module_put(match->family);
 }
 
+#ifdef CONFIG_COMPAT
+struct compat_xt_conntrack_info
+{
+       compat_uint_t                   statemask;
+       compat_uint_t                   statusmask;
+       struct ip_conntrack_old_tuple   tuple[IP_CT_DIR_MAX];
+       struct in_addr                  sipmsk[IP_CT_DIR_MAX];
+       struct in_addr                  dipmsk[IP_CT_DIR_MAX];
+       compat_ulong_t                  expires_min;
+       compat_ulong_t                  expires_max;
+       u_int8_t                        flags;
+       u_int8_t                        invflags;
+};
+
+static void compat_from_user(void *dst, void *src)
+{
+       struct compat_xt_conntrack_info *cm = src;
+       struct xt_conntrack_info m = {
+               .statemask      = cm->statemask,
+               .statusmask     = cm->statusmask,
+               .expires_min    = cm->expires_min,
+               .expires_max    = cm->expires_max,
+               .flags          = cm->flags,
+               .invflags       = cm->invflags,
+       };
+       memcpy(m.tuple, cm->tuple, sizeof(m.tuple));
+       memcpy(m.sipmsk, cm->sipmsk, sizeof(m.sipmsk));
+       memcpy(m.dipmsk, cm->dipmsk, sizeof(m.dipmsk));
+       memcpy(dst, &m, sizeof(m));
+}
+
+static int compat_to_user(void __user *dst, void *src)
+{
+       struct xt_conntrack_info *m = src;
+       struct compat_xt_conntrack_info cm = {
+               .statemask      = m->statemask,
+               .statusmask     = m->statusmask,
+               .expires_min    = m->expires_min,
+               .expires_max    = m->expires_max,
+               .flags          = m->flags,
+               .invflags       = m->invflags,
+       };
+       memcpy(cm.tuple, m->tuple, sizeof(cm.tuple));
+       memcpy(cm.sipmsk, m->sipmsk, sizeof(cm.sipmsk));
+       memcpy(cm.dipmsk, m->dipmsk, sizeof(cm.dipmsk));
+       return copy_to_user(dst, &cm, sizeof(cm)) ? -EFAULT : 0;
+}
+#endif
+
 static struct xt_match conntrack_match = {
        .name           = "conntrack",
        .match          = match,
        .checkentry     = checkentry,
        .destroy        = destroy,
        .matchsize      = sizeof(struct xt_conntrack_info),
+#ifdef CONFIG_COMPAT
+       .compatsize     = sizeof(struct compat_xt_conntrack_info),
+       .compat_from_user = compat_from_user,
+       .compat_to_user = compat_to_user,
+#endif
        .family         = AF_INET,
        .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