]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Add IPv6 support to CLASSIFY target
authorYasuyuki KOZAKAI <yasuyuki@netfilter.org>
Sat, 4 Aug 2007 08:23:13 +0000 (08:23 +0000)
committerYasuyuki KOZAKAI <yasuyuki@netfilter.org>
Sat, 4 Aug 2007 08:23:13 +0000 (08:23 +0000)
extensions/Makefile
extensions/libxt_CLASSIFY.c [moved from extensions/libipt_CLASSIFY.c with 67% similarity]
include/linux/netfilter/xt_CLASSIFY.h [new file with mode: 0644]
include/linux/netfilter_ipv4/ipt_CLASSIFY.h [deleted file]

index ddde77de46010bdddb77af69d18fd0c5c5ce4855..53e3e9eb6092f5a2635c3b3f620fdbb47a030f7a 100644 (file)
@@ -5,9 +5,9 @@
 # header files are present in the include/linux directory of this iptables
 # package (HW)
 #
-PF_EXT_SLIB:=ah addrtype conntrack ecn helper icmp iprange owner policy realm tos ttl unclean CLASSIFY DNAT DSCP ECN LOG MASQUERADE MIRROR NETMAP REDIRECT REJECT SAME SNAT TOS TTL ULOG
+PF_EXT_SLIB:=ah addrtype conntrack ecn helper icmp iprange owner policy realm tos ttl unclean DNAT DSCP ECN LOG MASQUERADE MIRROR NETMAP REDIRECT REJECT SAME SNAT TOS TTL ULOG
 PF6_EXT_SLIB:=eui64 hl icmp6 owner policy HL LOG
-PFX_EXT_SLIB:=connmark connlimit comment dscp esp hashlimit length limit mac mark multiport physdev pkttype sctp state standard tcp tcpmss udp CONNMARK MARK NFQUEUE NOTRACK TCPMSS TRACE
+PFX_EXT_SLIB:=connmark connlimit comment dscp esp hashlimit length limit mac mark multiport physdev pkttype sctp state standard tcp tcpmss udp CLASSIFY CONNMARK MARK NFQUEUE NOTRACK TCPMSS TRACE
 
 ifeq ($(DO_SELINUX), 1)
 PF_EXT_SE_SLIB:=
similarity index 67%
rename from extensions/libipt_CLASSIFY.c
rename to extensions/libxt_CLASSIFY.c
index 3096edc8e56c095e8456189f09181014aa35b6d2..acebd926551ee8186886fca9c2b55c5ec76f30b7 100644 (file)
@@ -4,9 +4,9 @@
 #include <stdlib.h>
 #include <getopt.h>
 
-#include <iptables.h>
-#include <linux/netfilter_ipv4/ip_tables.h>
-#include <linux/netfilter_ipv4/ipt_CLASSIFY.h>
+#include <xtables.h>
+#include <linux/netfilter/x_tables.h>
+#include <linux/netfilter/xt_CLASSIFY.h>
 #include <linux/types.h>
 #include <linux/pkt_sched.h>
 
@@ -50,8 +50,8 @@ parse(int c, char **argv, int invert, unsigned int *flags,
       const void *entry,
       struct xt_entry_target **target)
 {
-       struct ipt_classify_target_info *clinfo
-               = (struct ipt_classify_target_info *)(*target)->data;
+       struct xt_classify_target_info *clinfo
+               = (struct xt_classify_target_info *)(*target)->data;
 
        switch (c) {
        case '1':
@@ -91,8 +91,8 @@ print(const void *ip,
       const struct xt_entry_target *target,
       int numeric)
 {
-       const struct ipt_classify_target_info *clinfo =
-               (const struct ipt_classify_target_info *)target->data;
+       const struct xt_classify_target_info *clinfo =
+               (const struct xt_classify_target_info *)target->data;
        printf("CLASSIFY set ");
        print_class(clinfo->priority, numeric);
 }
@@ -101,28 +101,45 @@ print(const void *ip,
 static void
 save(const void *ip, const struct xt_entry_target *target)
 {
-       const struct ipt_classify_target_info *clinfo =
-               (const struct ipt_classify_target_info *)target->data;
+       const struct xt_classify_target_info *clinfo =
+               (const struct xt_classify_target_info *)target->data;
 
        printf("--set-class %.4x:%.4x ",
               TC_H_MAJ(clinfo->priority)>>16, TC_H_MIN(clinfo->priority));
 }
 
-static struct iptables_target classify = { 
+static struct xtables_target classify = { 
+       .family         = AF_INET,
        .name           = "CLASSIFY",
        .version        = IPTABLES_VERSION,
-       .size           = IPT_ALIGN(sizeof(struct ipt_classify_target_info)),
-       .userspacesize  = IPT_ALIGN(sizeof(struct ipt_classify_target_info)),
+       .size           = XT_ALIGN(sizeof(struct xt_classify_target_info)),
+       .userspacesize  = XT_ALIGN(sizeof(struct xt_classify_target_info)),
        .help           = &help,
        .init           = &init,
        .parse          = &parse,
        .final_check    = &final_check,
        .print          = &print,
        .save           = &save,
-       .extra_opts     = opts
+       .extra_opts     = opts,
+};
+
+static struct xtables_target classify6 = { 
+       .family         = AF_INET6,
+       .name           = "CLASSIFY",
+       .version        = IPTABLES_VERSION,
+       .size           = XT_ALIGN(sizeof(struct xt_classify_target_info)),
+       .userspacesize  = XT_ALIGN(sizeof(struct xt_classify_target_info)),
+       .help           = &help,
+       .init           = &init,
+       .parse          = &parse,
+       .final_check    = &final_check,
+       .print          = &print,
+       .save           = &save,
+       .extra_opts     = opts,
 };
 
 void _init(void)
 {
-       register_target(&classify);
+       xtables_register_target(&classify);
+       xtables_register_target(&classify6);
 }
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
new file mode 100644 (file)
index 0000000..5811135
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _XT_CLASSIFY_H
+#define _XT_CLASSIFY_H
+
+struct xt_classify_target_info {
+       u_int32_t priority;
+};
+
+#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 100644 (file)
index 7596e3d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _IPT_CLASSIFY_H
-#define _IPT_CLASSIFY_H
-
-struct ipt_classify_target_info {
-       u_int32_t priority;
-};
-
-#endif /*_IPT_CLASSIFY_H */