[PATCH] sysctl: remove insert_at_head from register_sysctl
[powerpc.git] / net / netfilter / xt_CONNMARK.c
index b554823..795c058 100644 (file)
@@ -61,7 +61,7 @@ target(struct sk_buff **pskb,
 #else
                                nf_conntrack_event_cache(IPCT_MARK, *pskb);
 #endif
-               }
+                       }
                        break;
                case XT_CONNMARK_SAVE:
                        newmark = (*ctmark & ~markinfo->mask) |
@@ -78,8 +78,7 @@ target(struct sk_buff **pskb,
                case XT_CONNMARK_RESTORE:
                        mark = (*pskb)->mark;
                        diff = (*ctmark ^ mark) & markinfo->mask;
-                       if (diff != 0)
-                               (*pskb)->mark = mark ^ diff;
+                       (*pskb)->mark = mark ^ diff;
                        break;
                }
        }
@@ -96,6 +95,11 @@ checkentry(const char *tablename,
 {
        struct xt_connmark_target_info *matchinfo = targinfo;
 
+       if (nf_ct_l3proto_try_module_get(target->family) < 0) {
+               printk(KERN_WARNING "can't load conntrack support for "
+                                   "proto=%d\n", target->family);
+               return 0;
+       }
        if (matchinfo->mode == XT_CONNMARK_RESTORE) {
                if (strcmp(tablename, "mangle") != 0) {
                        printk(KERN_WARNING "CONNMARK: restore can only be "
@@ -111,6 +115,12 @@ checkentry(const char *tablename,
        return 1;
 }
 
+static void
+destroy(const struct xt_target *target, void *targinfo)
+{
+       nf_ct_l3proto_module_put(target->family);
+}
+
 #ifdef CONFIG_COMPAT
 struct compat_xt_connmark_target_info {
        compat_ulong_t  mark, mask;
@@ -147,6 +157,7 @@ static struct xt_target xt_connmark_target[] = {
                .name           = "CONNMARK",
                .family         = AF_INET,
                .checkentry     = checkentry,
+               .destroy        = destroy,
                .target         = target,
                .targetsize     = sizeof(struct xt_connmark_target_info),
 #ifdef CONFIG_COMPAT
@@ -160,6 +171,7 @@ static struct xt_target xt_connmark_target[] = {
                .name           = "CONNMARK",
                .family         = AF_INET6,
                .checkentry     = checkentry,
+               .destroy        = destroy,
                .target         = target,
                .targetsize     = sizeof(struct xt_connmark_target_info),
                .me             = THIS_MODULE
@@ -168,7 +180,6 @@ static struct xt_target xt_connmark_target[] = {
 
 static int __init xt_connmark_init(void)
 {
-       need_conntrack();
        return xt_register_targets(xt_connmark_target,
                                   ARRAY_SIZE(xt_connmark_target));
 }