aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-08-22 03:34:04 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:32 -0400
commit4470bbc749e5551cce914529309456f631e25120 (patch)
tree972978df336c49235889dc745124fdfd1b990349
parent52d9c42ef2563d2c420eb23b96bf5a4cae9e167b (diff)
[NETFILTER]: x_tables: make use of mass registation helpers
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c4
-rw-r--r--net/netfilter/xt_CLASSIFY.c60
-rw-r--r--net/netfilter/xt_CONNMARK.c51
-rw-r--r--net/netfilter/xt_CONNSECMARK.c57
-rw-r--r--net/netfilter/xt_DSCP.c51
-rw-r--r--net/netfilter/xt_MARK.c84
-rw-r--r--net/netfilter/xt_NFQUEUE.c68
-rw-r--r--net/netfilter/xt_NOTRACK.c47
-rw-r--r--net/netfilter/xt_SECMARK.c55
-rw-r--r--net/netfilter/xt_comment.c45
-rw-r--r--net/netfilter/xt_connbytes.c47
-rw-r--r--net/netfilter/xt_connmark.c53
-rw-r--r--net/netfilter/xt_conntrack.c5
-rw-r--r--net/netfilter/xt_dccp.c51
-rw-r--r--net/netfilter/xt_dscp.c47
-rw-r--r--net/netfilter/xt_esp.c51
-rw-r--r--net/netfilter/xt_helper.c52
-rw-r--r--net/netfilter/xt_length.c43
-rw-r--r--net/netfilter/xt_limit.c47
-rw-r--r--net/netfilter/xt_mac.c52
-rw-r--r--net/netfilter/xt_mark.c47
-rw-r--r--net/netfilter/xt_multiport.c111
-rw-r--r--net/netfilter/xt_physdev.c49
-rw-r--r--net/netfilter/xt_pkttype.c44
-rw-r--r--net/netfilter/xt_policy.c51
-rw-r--r--net/netfilter/xt_quota.c51
-rw-r--r--net/netfilter/xt_sctp.c51
-rw-r--r--net/netfilter/xt_state.c53
-rw-r--r--net/netfilter/xt_statistic.c53
-rw-r--r--net/netfilter/xt_string.c50
-rw-r--r--net/netfilter/xt_tcpmss.c49
-rw-r--r--net/netfilter/xt_tcpudp.c107
32 files changed, 679 insertions, 1007 deletions
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index c4eba1aeb32..7929ff40216 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -257,9 +257,7 @@ static struct ip6t_target ip6t_reject_reg = {
257 257
258static int __init ip6t_reject_init(void) 258static int __init ip6t_reject_init(void)
259{ 259{
260 if (ip6t_register_target(&ip6t_reject_reg)) 260 return ip6t_register_target(&ip6t_reject_reg);
261 return -EINVAL;
262 return 0;
263} 261}
264 262
265static void __exit ip6t_reject_fini(void) 263static void __exit ip6t_reject_fini(void)
diff --git a/net/netfilter/xt_CLASSIFY.c b/net/netfilter/xt_CLASSIFY.c
index e54e5773001..1f92edd0593 100644
--- a/net/netfilter/xt_CLASSIFY.c
+++ b/net/netfilter/xt_CLASSIFY.c
@@ -40,47 +40,41 @@ target(struct sk_buff **pskb,
40 return XT_CONTINUE; 40 return XT_CONTINUE;
41} 41}
42 42
43static struct xt_target classify_reg = { 43static struct xt_target xt_classify_target[] = {
44 .name = "CLASSIFY", 44 {
45 .target = target, 45 .family = AF_INET,
46 .targetsize = sizeof(struct xt_classify_target_info), 46 .name = "CLASSIFY",
47 .table = "mangle", 47 .target = target,
48 .hooks = (1 << NF_IP_LOCAL_OUT) | (1 << NF_IP_FORWARD) | 48 .targetsize = sizeof(struct xt_classify_target_info),
49 (1 << NF_IP_POST_ROUTING), 49 .table = "mangle",
50 .family = AF_INET, 50 .hooks = (1 << NF_IP_LOCAL_OUT) |
51 .me = THIS_MODULE, 51 (1 << NF_IP_FORWARD) |
52 (1 << NF_IP_POST_ROUTING),
53 .me = THIS_MODULE,
54 },
55 {
56 .name = "CLASSIFY",
57 .family = AF_INET6,
58 .target = target,
59 .targetsize = sizeof(struct xt_classify_target_info),
60 .table = "mangle",
61 .hooks = (1 << NF_IP_LOCAL_OUT) |
62 (1 << NF_IP_FORWARD) |
63 (1 << NF_IP_POST_ROUTING),
64 .me = THIS_MODULE,
65 },
52}; 66};
53static struct xt_target classify6_reg = {
54 .name = "CLASSIFY",
55 .target = target,
56 .targetsize = sizeof(struct xt_classify_target_info),
57 .table = "mangle",
58 .hooks = (1 << NF_IP_LOCAL_OUT) | (1 << NF_IP_FORWARD) |
59 (1 << NF_IP_POST_ROUTING),
60 .family = AF_INET6,
61 .me = THIS_MODULE,
62};
63
64 67
65static int __init xt_classify_init(void) 68static int __init xt_classify_init(void)
66{ 69{
67 int ret; 70 return xt_register_targets(xt_classify_target,
68 71 ARRAY_SIZE(xt_classify_target));
69 ret = xt_register_target(&classify_reg);
70 if (ret)
71 return ret;
72
73 ret = xt_register_target(&classify6_reg);
74 if (ret)
75 xt_unregister_target(&classify_reg);
76
77 return ret;
78} 72}
79 73
80static void __exit xt_classify_fini(void) 74static void __exit xt_classify_fini(void)
81{ 75{
82 xt_unregister_target(&classify_reg); 76 xt_unregister_targets(xt_classify_target,
83 xt_unregister_target(&classify6_reg); 77 ARRAY_SIZE(xt_classify_target));
84} 78}
85 79
86module_init(xt_classify_init); 80module_init(xt_classify_init);
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index 19989a91543..e577356b5c7 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -110,45 +110,36 @@ checkentry(const char *tablename,
110 return 1; 110 return 1;
111} 111}
112 112
113static struct xt_target connmark_reg = { 113static struct xt_target xt_connmark_target[] = {
114 .name = "CONNMARK", 114 {
115 .target = target, 115 .name = "CONNMARK",
116 .targetsize = sizeof(struct xt_connmark_target_info), 116 .family = AF_INET,
117 .checkentry = checkentry, 117 .checkentry = checkentry,
118 .family = AF_INET, 118 .target = target,
119 .me = THIS_MODULE 119 .targetsize = sizeof(struct xt_connmark_target_info),
120}; 120 .me = THIS_MODULE
121 121 },
122static struct xt_target connmark6_reg = { 122 {
123 .name = "CONNMARK", 123 .name = "CONNMARK",
124 .target = target, 124 .family = AF_INET6,
125 .targetsize = sizeof(struct xt_connmark_target_info), 125 .checkentry = checkentry,
126 .checkentry = checkentry, 126 .target = target,
127 .family = AF_INET6, 127 .targetsize = sizeof(struct xt_connmark_target_info),
128 .me = THIS_MODULE 128 .me = THIS_MODULE
129 },
129}; 130};
130 131
131static int __init xt_connmark_init(void) 132static int __init xt_connmark_init(void)
132{ 133{
133 int ret;
134
135 need_conntrack(); 134 need_conntrack();
136 135 return xt_register_targets(xt_connmark_target,
137 ret = xt_register_target(&connmark_reg); 136 ARRAY_SIZE(xt_connmark_target));
138 if (ret)
139 return ret;
140
141 ret = xt_register_target(&connmark6_reg);
142 if (ret)
143 xt_unregister_target(&connmark_reg);
144
145 return ret;
146} 137}
147 138
148static void __exit xt_connmark_fini(void) 139static void __exit xt_connmark_fini(void)
149{ 140{
150 xt_unregister_target(&connmark_reg); 141 xt_unregister_targets(xt_connmark_target,
151 xt_unregister_target(&connmark6_reg); 142 ARRAY_SIZE(xt_connmark_target));
152} 143}
153 144
154module_init(xt_connmark_init); 145module_init(xt_connmark_init);
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index 8c011e02076..48f7fc3c85c 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -106,49 +106,38 @@ static int checkentry(const char *tablename, const void *entry,
106 return 1; 106 return 1;
107} 107}
108 108
109static struct xt_target ipt_connsecmark_reg = { 109static struct xt_target xt_connsecmark_target[] = {
110 .name = "CONNSECMARK", 110 {
111 .target = target, 111 .name = "CONNSECMARK",
112 .targetsize = sizeof(struct xt_connsecmark_target_info), 112 .family = AF_INET,
113 .table = "mangle", 113 .checkentry = checkentry,
114 .checkentry = checkentry, 114 .target = target,
115 .me = THIS_MODULE, 115 .targetsize = sizeof(struct xt_connsecmark_target_info),
116 .family = AF_INET, 116 .table = "mangle",
117 .revision = 0, 117 .me = THIS_MODULE,
118}; 118 },
119 119 {
120static struct xt_target ip6t_connsecmark_reg = { 120 .name = "CONNSECMARK",
121 .name = "CONNSECMARK", 121 .family = AF_INET6,
122 .target = target, 122 .checkentry = checkentry,
123 .targetsize = sizeof(struct xt_connsecmark_target_info), 123 .target = target,
124 .table = "mangle", 124 .targetsize = sizeof(struct xt_connsecmark_target_info),
125 .checkentry = checkentry, 125 .table = "mangle",
126 .me = THIS_MODULE, 126 .me = THIS_MODULE,
127 .family = AF_INET6, 127 },
128 .revision = 0,
129}; 128};
130 129
131static int __init xt_connsecmark_init(void) 130static int __init xt_connsecmark_init(void)
132{ 131{
133 int err;
134
135 need_conntrack(); 132 need_conntrack();
136 133 return xt_register_targets(xt_connsecmark_targets,
137 err = xt_register_target(&ipt_connsecmark_reg); 134 ARRAY_SIZE(xt_connsecmark_targets));
138 if (err)
139 return err;
140
141 err = xt_register_target(&ip6t_connsecmark_reg);
142 if (err)
143 xt_unregister_target(&ipt_connsecmark_reg);
144
145 return err;
146} 135}
147 136
148static void __exit xt_connsecmark_fini(void) 137static void __exit xt_connsecmark_fini(void)
149{ 138{
150 xt_unregister_target(&ip6t_connsecmark_reg); 139 xt_unregister_targets(xt_connsecmark_targets,
151 xt_unregister_target(&ipt_connsecmark_reg); 140 ARRAY_SIZE(xt_connsecmark_targets));
152} 141}
153 142
154module_init(xt_connsecmark_init); 143module_init(xt_connsecmark_init);
diff --git a/net/netfilter/xt_DSCP.c b/net/netfilter/xt_DSCP.c
index 79df8165cd7..a1cd9723644 100644
--- a/net/netfilter/xt_DSCP.c
+++ b/net/netfilter/xt_DSCP.c
@@ -86,44 +86,35 @@ static int checkentry(const char *tablename,
86 return 1; 86 return 1;
87} 87}
88 88
89static struct xt_target xt_dscp_reg = { 89static struct xt_target xt_dscp_target[] = {
90 .name = "DSCP", 90 {
91 .target = target, 91 .name = "DSCP",
92 .targetsize = sizeof(struct xt_DSCP_info), 92 .family = AF_INET,
93 .table = "mangle", 93 .checkentry = checkentry,
94 .checkentry = checkentry, 94 .target = target,
95 .family = AF_INET, 95 .targetsize = sizeof(struct xt_DSCP_info),
96 .me = THIS_MODULE, 96 .table = "mangle",
97}; 97 .me = THIS_MODULE,
98 98 },
99static struct xt_target xt_dscp6_reg = { 99 {
100 .name = "DSCP", 100 .name = "DSCP",
101 .target = target6, 101 .family = AF_INET6,
102 .targetsize = sizeof(struct xt_DSCP_info), 102 .checkentry = checkentry,
103 .table = "mangle", 103 .target = target6,
104 .checkentry = checkentry, 104 .targetsize = sizeof(struct xt_DSCP_info),
105 .family = AF_INET6, 105 .table = "mangle",
106 .me = THIS_MODULE, 106 .me = THIS_MODULE,
107 },
107}; 108};
108 109
109static int __init xt_dscp_target_init(void) 110static int __init xt_dscp_target_init(void)
110{ 111{
111 int ret; 112 return xt_register_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target));
112 ret = xt_register_target(&xt_dscp_reg);
113 if (ret)
114 return ret;
115
116 ret = xt_register_target(&xt_dscp6_reg);
117 if (ret)
118 xt_unregister_target(&xt_dscp_reg);
119
120 return ret;
121} 113}
122 114
123static void __exit xt_dscp_target_fini(void) 115static void __exit xt_dscp_target_fini(void)
124{ 116{
125 xt_unregister_target(&xt_dscp_reg); 117 xt_unregister_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target));
126 xt_unregister_target(&xt_dscp6_reg);
127} 118}
128 119
129module_init(xt_dscp_target_init); 120module_init(xt_dscp_target_init);
diff --git a/net/netfilter/xt_MARK.c b/net/netfilter/xt_MARK.c
index ee9c34edc76..0a612721946 100644
--- a/net/netfilter/xt_MARK.c
+++ b/net/netfilter/xt_MARK.c
@@ -112,65 +112,47 @@ checkentry_v1(const char *tablename,
112 return 1; 112 return 1;
113} 113}
114 114
115static struct xt_target ipt_mark_reg_v0 = { 115static struct xt_target xt_mark_target[] = {
116 .name = "MARK", 116 {
117 .target = target_v0, 117 .name = "MARK",
118 .targetsize = sizeof(struct xt_mark_target_info), 118 .family = AF_INET,
119 .table = "mangle", 119 .revision = 0,
120 .checkentry = checkentry_v0, 120 .checkentry = checkentry_v0,
121 .me = THIS_MODULE, 121 .target = target_v0,
122 .family = AF_INET, 122 .targetsize = sizeof(struct xt_mark_target_info),
123 .revision = 0, 123 .table = "mangle",
124}; 124 .me = THIS_MODULE,
125 125 },
126static struct xt_target ipt_mark_reg_v1 = { 126 {
127 .name = "MARK", 127 .name = "MARK",
128 .target = target_v1, 128 .family = AF_INET,
129 .targetsize = sizeof(struct xt_mark_target_info_v1), 129 .revision = 1,
130 .table = "mangle", 130 .checkentry = checkentry_v1,
131 .checkentry = checkentry_v1, 131 .target = target_v1,
132 .me = THIS_MODULE, 132 .targetsize = sizeof(struct xt_mark_target_info_v1),
133 .family = AF_INET, 133 .table = "mangle",
134 .revision = 1, 134 .me = THIS_MODULE,
135}; 135 },
136 136 {
137static struct xt_target ip6t_mark_reg_v0 = { 137 .name = "MARK",
138 .name = "MARK", 138 .family = AF_INET6,
139 .target = target_v0, 139 .revision = 0,
140 .targetsize = sizeof(struct xt_mark_target_info), 140 .checkentry = checkentry_v0,
141 .table = "mangle", 141 .target = target_v0,
142 .checkentry = checkentry_v0, 142 .targetsize = sizeof(struct xt_mark_target_info),
143 .me = THIS_MODULE, 143 .table = "mangle",
144 .family = AF_INET6, 144 .me = THIS_MODULE,
145 .revision = 0, 145 },
146}; 146};
147 147
148static int __init xt_mark_init(void) 148static int __init xt_mark_init(void)
149{ 149{
150 int err; 150 return xt_register_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target));
151
152 err = xt_register_target(&ipt_mark_reg_v0);
153 if (err)
154 return err;
155
156 err = xt_register_target(&ipt_mark_reg_v1);
157 if (err)
158 xt_unregister_target(&ipt_mark_reg_v0);
159
160 err = xt_register_target(&ip6t_mark_reg_v0);
161 if (err) {
162 xt_unregister_target(&ipt_mark_reg_v0);
163 xt_unregister_target(&ipt_mark_reg_v1);
164 }
165
166 return err;
167} 151}
168 152
169static void __exit xt_mark_fini(void) 153static void __exit xt_mark_fini(void)
170{ 154{
171 xt_unregister_target(&ipt_mark_reg_v0); 155 xt_unregister_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target));
172 xt_unregister_target(&ipt_mark_reg_v1);
173 xt_unregister_target(&ip6t_mark_reg_v0);
174} 156}
175 157
176module_init(xt_mark_init); 158module_init(xt_mark_init);
diff --git a/net/netfilter/xt_NFQUEUE.c b/net/netfilter/xt_NFQUEUE.c
index 86ccceb61fd..7b982283abd 100644
--- a/net/netfilter/xt_NFQUEUE.c
+++ b/net/netfilter/xt_NFQUEUE.c
@@ -37,57 +37,39 @@ target(struct sk_buff **pskb,
37 return NF_QUEUE_NR(tinfo->queuenum); 37 return NF_QUEUE_NR(tinfo->queuenum);
38} 38}
39 39
40static struct xt_target ipt_NFQ_reg = { 40static struct xt_target xt_nfqueue_target[] = {
41 .name = "NFQUEUE", 41 {
42 .target = target, 42 .name = "NFQUEUE",
43 .targetsize = sizeof(struct xt_NFQ_info), 43 .family = AF_INET,
44 .family = AF_INET, 44 .target = target,
45 .me = THIS_MODULE, 45 .targetsize = sizeof(struct xt_NFQ_info),
46}; 46 .me = THIS_MODULE,
47 47 },
48static struct xt_target ip6t_NFQ_reg = { 48 {
49 .name = "NFQUEUE", 49 .name = "NFQUEUE",
50 .target = target, 50 .family = AF_INET6,
51 .targetsize = sizeof(struct xt_NFQ_info), 51 .target = target,
52 .family = AF_INET6, 52 .targetsize = sizeof(struct xt_NFQ_info),
53 .me = THIS_MODULE, 53 .me = THIS_MODULE,
54}; 54 },
55 55 {
56static struct xt_target arpt_NFQ_reg = { 56 .name = "NFQUEUE",
57 .name = "NFQUEUE", 57 .family = NF_ARP,
58 .target = target, 58 .target = target,
59 .targetsize = sizeof(struct xt_NFQ_info), 59 .targetsize = sizeof(struct xt_NFQ_info),
60 .family = NF_ARP, 60 .me = THIS_MODULE,
61 .me = THIS_MODULE, 61 },
62}; 62};
63 63
64static int __init xt_nfqueue_init(void) 64static int __init xt_nfqueue_init(void)
65{ 65{
66 int ret; 66 return xt_register_targets(xt_nfqueue_target,
67 ret = xt_register_target(&ipt_NFQ_reg); 67 ARRAY_SIZE(xt_nfqueue_target));
68 if (ret)
69 return ret;
70 ret = xt_register_target(&ip6t_NFQ_reg);
71 if (ret)
72 goto out_ip;
73 ret = xt_register_target(&arpt_NFQ_reg);
74 if (ret)
75 goto out_ip6;
76
77 return ret;
78out_ip6:
79 xt_unregister_target(&ip6t_NFQ_reg);
80out_ip:
81 xt_unregister_target(&ipt_NFQ_reg);
82
83 return ret;
84} 68}
85 69
86static void __exit xt_nfqueue_fini(void) 70static void __exit xt_nfqueue_fini(void)
87{ 71{
88 xt_unregister_target(&arpt_NFQ_reg); 72 xt_register_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target));
89 xt_unregister_target(&ip6t_NFQ_reg);
90 xt_unregister_target(&ipt_NFQ_reg);
91} 73}
92 74
93module_init(xt_nfqueue_init); 75module_init(xt_nfqueue_init);
diff --git a/net/netfilter/xt_NOTRACK.c b/net/netfilter/xt_NOTRACK.c
index 98f4b5363ce..cab881d4424 100644
--- a/net/netfilter/xt_NOTRACK.c
+++ b/net/netfilter/xt_NOTRACK.c
@@ -34,43 +34,32 @@ target(struct sk_buff **pskb,
34 return XT_CONTINUE; 34 return XT_CONTINUE;
35} 35}
36 36
37static struct xt_target notrack_reg = { 37static struct xt_target xt_notrack_target[] = {
38 .name = "NOTRACK", 38 {
39 .target = target, 39 .name = "NOTRACK",
40 .targetsize = 0, 40 .family = AF_INET,
41 .table = "raw", 41 .target = target,
42 .family = AF_INET, 42 .table = "raw",
43 .me = THIS_MODULE, 43 .me = THIS_MODULE,
44}; 44 },
45 45 {
46static struct xt_target notrack6_reg = { 46 .name = "NOTRACK",
47 .name = "NOTRACK", 47 .family = AF_INET6,
48 .target = target, 48 .target = target,
49 .targetsize = 0, 49 .table = "raw",
50 .table = "raw", 50 .me = THIS_MODULE,
51 .family = AF_INET6, 51 },
52 .me = THIS_MODULE,
53}; 52};
54 53
55static int __init xt_notrack_init(void) 54static int __init xt_notrack_init(void)
56{ 55{
57 int ret; 56 return xt_register_targets(xt_notrack_target,
58 57 ARRAY_SIZE(xt_notrack_target));
59 ret = xt_register_target(&notrack_reg);
60 if (ret)
61 return ret;
62
63 ret = xt_register_target(&notrack6_reg);
64 if (ret)
65 xt_unregister_target(&notrack_reg);
66
67 return ret;
68} 58}
69 59
70static void __exit xt_notrack_fini(void) 60static void __exit xt_notrack_fini(void)
71{ 61{
72 xt_unregister_target(&notrack6_reg); 62 xt_unregister_targets(xt_notrack_target, ARRAY_SIZE(xt_notrack_target));
73 xt_unregister_target(&notrack_reg);
74} 63}
75 64
76module_init(xt_notrack_init); 65module_init(xt_notrack_init);
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
index de9537ad9a7..4300988786c 100644
--- a/net/netfilter/xt_SECMARK.c
+++ b/net/netfilter/xt_SECMARK.c
@@ -111,47 +111,36 @@ static int checkentry(const char *tablename, const void *entry,
111 return 1; 111 return 1;
112} 112}
113 113
114static struct xt_target ipt_secmark_reg = { 114static struct xt_target xt_secmark_target = {
115 .name = "SECMARK", 115 {
116 .target = target, 116 .name = "SECMARK",
117 .targetsize = sizeof(struct xt_secmark_target_info), 117 .family = AF_INET,
118 .table = "mangle", 118 .checkentry = checkentry,
119 .checkentry = checkentry, 119 .target = target,
120 .me = THIS_MODULE, 120 .targetsize = sizeof(struct xt_secmark_target_info),
121 .family = AF_INET, 121 .table = "mangle",
122 .revision = 0, 122 .me = THIS_MODULE,
123}; 123 },
124 124 {
125static struct xt_target ip6t_secmark_reg = { 125 .name = "SECMARK",
126 .name = "SECMARK", 126 .family = AF_INET6,
127 .target = target, 127 .checkentry = checkentry,
128 .targetsize = sizeof(struct xt_secmark_target_info), 128 .target = target,
129 .table = "mangle", 129 .targetsize = sizeof(struct xt_secmark_target_info),
130 .checkentry = checkentry, 130 .table = "mangle",
131 .me = THIS_MODULE, 131 .me = THIS_MODULE,
132 .family = AF_INET6, 132 },
133 .revision = 0,
134}; 133};
135 134
136static int __init xt_secmark_init(void) 135static int __init xt_secmark_init(void)
137{ 136{
138 int err; 137 return xt_register_targets(xt_secmark_target,
139 138 ARRAY_SIZE(xt_secmark_target));
140 err = xt_register_target(&ipt_secmark_reg);
141 if (err)
142 return err;
143
144 err = xt_register_target(&ip6t_secmark_reg);
145 if (err)
146 xt_unregister_target(&ipt_secmark_reg);
147
148 return err;
149} 139}
150 140
151static void __exit xt_secmark_fini(void) 141static void __exit xt_secmark_fini(void)
152{ 142{
153 xt_unregister_target(&ip6t_secmark_reg); 143 xt_unregister_targets(xt_secmark_target, ARRAY_SIZE(xt_secmark_target));
154 xt_unregister_target(&ipt_secmark_reg);
155} 144}
156 145
157module_init(xt_secmark_init); 146module_init(xt_secmark_init);
diff --git a/net/netfilter/xt_comment.c b/net/netfilter/xt_comment.c
index 197609cb06d..7db492d6522 100644
--- a/net/netfilter/xt_comment.c
+++ b/net/netfilter/xt_comment.c
@@ -29,41 +29,32 @@ match(const struct sk_buff *skb,
29 return 1; 29 return 1;
30} 30}
31 31
32static struct xt_match comment_match = { 32static struct xt_match xt_comment_match[] = {
33 .name = "comment", 33 {
34 .match = match, 34 .name = "comment",
35 .matchsize = sizeof(struct xt_comment_info), 35 .family = AF_INET,
36 .family = AF_INET, 36 .match = match,
37 .me = THIS_MODULE 37 .matchsize = sizeof(struct xt_comment_info),
38}; 38 .me = THIS_MODULE
39 39 },
40static struct xt_match comment6_match = { 40 {
41 .name = "comment", 41 .name = "comment",
42 .match = match, 42 .family = AF_INET6,
43 .matchsize = sizeof(struct xt_comment_info), 43 .match = match,
44 .family = AF_INET6, 44 .matchsize = sizeof(struct xt_comment_info),
45 .me = THIS_MODULE 45 .me = THIS_MODULE
46 },
46}; 47};
47 48
48static int __init xt_comment_init(void) 49static int __init xt_comment_init(void)
49{ 50{
50 int ret; 51 return xt_register_matches(xt_comment_match,
51 52 ARRAY_SIZE(xt_comment_match));
52 ret = xt_register_match(&comment_match);
53 if (ret)
54 return ret;
55
56 ret = xt_register_match(&comment6_match);
57 if (ret)
58 xt_unregister_match(&comment_match);
59
60 return ret;
61} 53}
62 54
63static void __exit xt_comment_fini(void) 55static void __exit xt_comment_fini(void)
64{ 56{
65 xt_unregister_match(&comment_match); 57 xt_unregister_matches(xt_comment_match, ARRAY_SIZE(xt_comment_match));
66 xt_unregister_match(&comment6_match);
67} 58}
68 59
69module_init(xt_comment_init); 60module_init(xt_comment_init);
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c
index 1396fe2d07c..2d49948d3c3 100644
--- a/net/netfilter/xt_connbytes.c
+++ b/net/netfilter/xt_connbytes.c
@@ -143,40 +143,35 @@ static int check(const char *tablename,
143 return 1; 143 return 1;
144} 144}
145 145
146static struct xt_match connbytes_match = { 146static struct xt_match xt_connbytes_match = {
147 .name = "connbytes", 147 {
148 .match = match, 148 .name = "connbytes",
149 .checkentry = check, 149 .family = AF_INET,
150 .matchsize = sizeof(struct xt_connbytes_info), 150 .checkentry = check,
151 .family = AF_INET, 151 .match = match,
152 .me = THIS_MODULE 152 .matchsize = sizeof(struct xt_connbytes_info),
153}; 153 .me = THIS_MODULE
154static struct xt_match connbytes6_match = { 154 },
155 .name = "connbytes", 155 {
156 .match = match, 156 .name = "connbytes",
157 .checkentry = check, 157 .family = AF_INET6,
158 .matchsize = sizeof(struct xt_connbytes_info), 158 .checkentry = check,
159 .family = AF_INET6, 159 .match = match,
160 .me = THIS_MODULE 160 .matchsize = sizeof(struct xt_connbytes_info),
161 .me = THIS_MODULE
162 },
161}; 163};
162 164
163static int __init xt_connbytes_init(void) 165static int __init xt_connbytes_init(void)
164{ 166{
165 int ret; 167 return xt_register_matches(xt_connbytes_match,
166 ret = xt_register_match(&connbytes_match); 168 ARRAY_SIZE(xt_connbytes_match));
167 if (ret)
168 return ret;
169
170 ret = xt_register_match(&connbytes6_match);
171 if (ret)
172 xt_unregister_match(&connbytes_match);
173 return ret;
174} 169}
175 170
176static void __exit xt_connbytes_fini(void) 171static void __exit xt_connbytes_fini(void)
177{ 172{
178 xt_unregister_match(&connbytes_match); 173 xt_unregister_matches(xt_connbytes_match,
179 xt_unregister_match(&connbytes6_match); 174 ARRAY_SIZE(xt_connbytes_match));
180} 175}
181 176
182module_init(xt_connbytes_init); 177module_init(xt_connbytes_init);
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
index 56324c8aff0..a97b2d455b7 100644
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -82,46 +82,37 @@ destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize)
82#endif 82#endif
83} 83}
84 84
85static struct xt_match connmark_match = { 85static struct xt_match xt_connmark_match[] = {
86 .name = "connmark", 86 {
87 .match = match, 87 .name = "connmark",
88 .matchsize = sizeof(struct xt_connmark_info), 88 .family = AF_INET,
89 .checkentry = checkentry, 89 .checkentry = checkentry,
90 .destroy = destroy, 90 .match = match,
91 .family = AF_INET, 91 .destroy = destroy,
92 .me = THIS_MODULE 92 .matchsize = sizeof(struct xt_connmark_info),
93}; 93 .me = THIS_MODULE
94 94 },
95static struct xt_match connmark6_match = { 95 {
96 .name = "connmark", 96 .name = "connmark",
97 .match = match, 97 .family = AF_INET6,
98 .matchsize = sizeof(struct xt_connmark_info), 98 .checkentry = checkentry,
99 .checkentry = checkentry, 99 .match = match,
100 .destroy = destroy, 100 .destroy = destroy,
101 .family = AF_INET6, 101 .matchsize = sizeof(struct xt_connmark_info),
102 .me = THIS_MODULE 102 .me = THIS_MODULE
103 },
103}; 104};
104 105
105static int __init xt_connmark_init(void) 106static int __init xt_connmark_init(void)
106{ 107{
107 int ret;
108
109 need_conntrack(); 108 need_conntrack();
110 109 return xt_register_matches(xt_connmark_match,
111 ret = xt_register_match(&connmark_match); 110 ARRAY_SIZE(xt_connmark_match));
112 if (ret)
113 return ret;
114
115 ret = xt_register_match(&connmark6_match);
116 if (ret)
117 xt_unregister_match(&connmark_match);
118 return ret;
119} 111}
120 112
121static void __exit xt_connmark_fini(void) 113static void __exit xt_connmark_fini(void)
122{ 114{
123 xt_unregister_match(&connmark6_match); 115 xt_register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match));
124 xt_unregister_match(&connmark_match);
125} 116}
126 117
127module_init(xt_connmark_init); 118module_init(xt_connmark_init);
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index 145489a4c3f..1540885174e 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -241,11 +241,8 @@ static struct xt_match conntrack_match = {
241 241
242static int __init xt_conntrack_init(void) 242static int __init xt_conntrack_init(void)
243{ 243{
244 int ret;
245 need_conntrack(); 244 need_conntrack();
246 ret = xt_register_match(&conntrack_match); 245 return xt_register_match(&conntrack_match);
247
248 return ret;
249} 246}
250 247
251static void __exit xt_conntrack_fini(void) 248static void __exit xt_conntrack_fini(void)
diff --git a/net/netfilter/xt_dccp.c b/net/netfilter/xt_dccp.c
index 2e2f825dad4..5ca6f5288f4 100644
--- a/net/netfilter/xt_dccp.c
+++ b/net/netfilter/xt_dccp.c
@@ -141,27 +141,26 @@ checkentry(const char *tablename,
141 && !(info->invflags & ~info->flags); 141 && !(info->invflags & ~info->flags);
142} 142}
143 143
144static struct xt_match dccp_match = 144static struct xt_match xt_dccp_match[] = {
145{ 145 {
146 .name = "dccp", 146 .name = "dccp",
147 .match = match, 147 .family = AF_INET,
148 .matchsize = sizeof(struct xt_dccp_info), 148 .checkentry = checkentry,
149 .proto = IPPROTO_DCCP, 149 .match = match,
150 .checkentry = checkentry, 150 .matchsize = sizeof(struct xt_dccp_info),
151 .family = AF_INET, 151 .proto = IPPROTO_DCCP,
152 .me = THIS_MODULE, 152 .me = THIS_MODULE,
153 },
154 {
155 .name = "dccp",
156 .family = AF_INET6,
157 .checkentry = checkentry,
158 .match = match,
159 .matchsize = sizeof(struct xt_dccp_info),
160 .proto = IPPROTO_DCCP,
161 .me = THIS_MODULE,
162 },
153}; 163};
154static struct xt_match dccp6_match =
155{
156 .name = "dccp",
157 .match = match,
158 .matchsize = sizeof(struct xt_dccp_info),
159 .proto = IPPROTO_DCCP,
160 .checkentry = checkentry,
161 .family = AF_INET6,
162 .me = THIS_MODULE,
163};
164
165 164
166static int __init xt_dccp_init(void) 165static int __init xt_dccp_init(void)
167{ 166{
@@ -173,27 +172,19 @@ static int __init xt_dccp_init(void)
173 dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL); 172 dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL);
174 if (!dccp_optbuf) 173 if (!dccp_optbuf)
175 return -ENOMEM; 174 return -ENOMEM;
176 ret = xt_register_match(&dccp_match); 175 ret = xt_register_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match));
177 if (ret) 176 if (ret)
178 goto out_kfree; 177 goto out_kfree;
179 ret = xt_register_match(&dccp6_match);
180 if (ret)
181 goto out_unreg;
182
183 return ret; 178 return ret;
184 179
185out_unreg:
186 xt_unregister_match(&dccp_match);
187out_kfree: 180out_kfree:
188 kfree(dccp_optbuf); 181 kfree(dccp_optbuf);
189
190 return ret; 182 return ret;
191} 183}
192 184
193static void __exit xt_dccp_fini(void) 185static void __exit xt_dccp_fini(void)
194{ 186{
195 xt_unregister_match(&dccp6_match); 187 xt_unregister_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match));
196 xt_unregister_match(&dccp_match);
197 kfree(dccp_optbuf); 188 kfree(dccp_optbuf);
198} 189}
199 190
diff --git a/net/netfilter/xt_dscp.c b/net/netfilter/xt_dscp.c
index 82e250d1f00..d84075c3015 100644
--- a/net/netfilter/xt_dscp.c
+++ b/net/netfilter/xt_dscp.c
@@ -71,42 +71,33 @@ static int checkentry(const char *tablename,
71 return 1; 71 return 1;
72} 72}
73 73
74static struct xt_match dscp_match = { 74static struct xt_match xt_dscp_match[] = {
75 .name = "dscp", 75 {
76 .match = match, 76 .name = "dscp",
77 .checkentry = checkentry, 77 .family = AF_INET,
78 .matchsize = sizeof(struct xt_dscp_info), 78 .checkentry = checkentry,
79 .family = AF_INET, 79 .match = match,
80 .me = THIS_MODULE, 80 .matchsize = sizeof(struct xt_dscp_info),
81}; 81 .me = THIS_MODULE,
82 82 },
83static struct xt_match dscp6_match = { 83 {
84 .name = "dscp", 84 .name = "dscp",
85 .match = match6, 85 .family = AF_INET6,
86 .checkentry = checkentry, 86 .checkentry = checkentry,
87 .matchsize = sizeof(struct xt_dscp_info), 87 .match = match6,
88 .family = AF_INET6, 88 .matchsize = sizeof(struct xt_dscp_info),
89 .me = THIS_MODULE, 89 .me = THIS_MODULE,
90 },
90}; 91};
91 92
92static int __init xt_dscp_match_init(void) 93static int __init xt_dscp_match_init(void)
93{ 94{
94 int ret; 95 return xt_register_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match));
95 ret = xt_register_match(&dscp_match);
96 if (ret)
97 return ret;
98
99 ret = xt_register_match(&dscp6_match);
100 if (ret)
101 xt_unregister_match(&dscp_match);
102
103 return ret;
104} 96}
105 97
106static void __exit xt_dscp_match_fini(void) 98static void __exit xt_dscp_match_fini(void)
107{ 99{
108 xt_unregister_match(&dscp_match); 100 xt_unregister_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match));
109 xt_unregister_match(&dscp6_match);
110} 101}
111 102
112module_init(xt_dscp_match_init); 103module_init(xt_dscp_match_init);
diff --git a/net/netfilter/xt_esp.c b/net/netfilter/xt_esp.c
index 9dad6281e0c..7b19bc9ea20 100644
--- a/net/netfilter/xt_esp.c
+++ b/net/netfilter/xt_esp.c
@@ -92,44 +92,35 @@ checkentry(const char *tablename,
92 return 1; 92 return 1;
93} 93}
94 94
95static struct xt_match esp_match = { 95static struct xt_match xt_esp_match[] = {
96 .name = "esp", 96 {
97 .family = AF_INET, 97 .name = "esp",
98 .proto = IPPROTO_ESP, 98 .family = AF_INET,
99 .match = &match, 99 .checkentry = checkentry,
100 .matchsize = sizeof(struct xt_esp), 100 .match = match,
101 .checkentry = &checkentry, 101 .matchsize = sizeof(struct xt_esp),
102 .me = THIS_MODULE, 102 .proto = IPPROTO_ESP,
103}; 103 .me = THIS_MODULE,
104 104 },
105static struct xt_match esp6_match = { 105 {
106 .name = "esp", 106 .name = "esp",
107 .family = AF_INET6, 107 .family = AF_INET6,
108 .proto = IPPROTO_ESP, 108 .checkentry = checkentry,
109 .match = &match, 109 .match = match,
110 .matchsize = sizeof(struct xt_esp), 110 .matchsize = sizeof(struct xt_esp),
111 .checkentry = &checkentry, 111 .proto = IPPROTO_ESP,
112 .me = THIS_MODULE, 112 .me = THIS_MODULE,
113 },
113}; 114};
114 115
115static int __init xt_esp_init(void) 116static int __init xt_esp_init(void)
116{ 117{
117 int ret; 118 return xt_register_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match));
118 ret = xt_register_match(&esp_match);
119 if (ret)
120 return ret;
121
122 ret = xt_register_match(&esp6_match);
123 if (ret)
124 xt_unregister_match(&esp_match);
125
126 return ret;
127} 119}
128 120
129static void __exit xt_esp_cleanup(void) 121static void __exit xt_esp_cleanup(void)
130{ 122{
131 xt_unregister_match(&esp_match); 123 xt_unregister_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match));
132 xt_unregister_match(&esp6_match);
133} 124}
134 125
135module_init(xt_esp_init); 126module_init(xt_esp_init);
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 799c2a43e3b..db453a7a154 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -163,45 +163,37 @@ destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize)
163#endif 163#endif
164} 164}
165 165
166static struct xt_match helper_match = { 166static struct xt_match xt_helper_match[] = {
167 .name = "helper", 167 {
168 .match = match, 168 .name = "helper",
169 .matchsize = sizeof(struct xt_helper_info), 169 .family = AF_INET,
170 .checkentry = check, 170 .checkentry = check,
171 .destroy = destroy, 171 .match = match,
172 .family = AF_INET, 172 .destroy = destroy,
173 .me = THIS_MODULE, 173 .matchsize = sizeof(struct xt_helper_info),
174}; 174 .me = THIS_MODULE,
175static struct xt_match helper6_match = { 175 },
176 .name = "helper", 176 {
177 .match = match, 177 .name = "helper",
178 .matchsize = sizeof(struct xt_helper_info), 178 .family = AF_INET6,
179 .checkentry = check, 179 .checkentry = check,
180 .destroy = destroy, 180 .match = match,
181 .family = AF_INET6, 181 .destroy = destroy,
182 .me = THIS_MODULE, 182 .matchsize = sizeof(struct xt_helper_info),
183 .me = THIS_MODULE,
184 },
183}; 185};
184 186
185static int __init xt_helper_init(void) 187static int __init xt_helper_init(void)
186{ 188{
187 int ret;
188 need_conntrack(); 189 need_conntrack();
189 190 return xt_register_matches(xt_helper_match,
190 ret = xt_register_match(&helper_match); 191 ARRAY_SIZE(xt_helper_match));
191 if (ret < 0)
192 return ret;
193
194 ret = xt_register_match(&helper6_match);
195 if (ret < 0)
196 xt_unregister_match(&helper_match);
197
198 return ret;
199} 192}
200 193
201static void __exit xt_helper_fini(void) 194static void __exit xt_helper_fini(void)
202{ 195{
203 xt_unregister_match(&helper_match); 196 xt_unregister_matches(xt_helper_match, ARRAY_SIZE(xt_helper_match));
204 xt_unregister_match(&helper6_match);
205} 197}
206 198
207module_init(xt_helper_init); 199module_init(xt_helper_init);
diff --git a/net/netfilter/xt_length.c b/net/netfilter/xt_length.c
index 109132c9a14..67fd30d9f30 100644
--- a/net/netfilter/xt_length.c
+++ b/net/netfilter/xt_length.c
@@ -52,39 +52,32 @@ match6(const struct sk_buff *skb,
52 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; 52 return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
53} 53}
54 54
55static struct xt_match length_match = { 55static struct xt_match xt_length_match[] = {
56 .name = "length", 56 {
57 .match = match, 57 .name = "length",
58 .matchsize = sizeof(struct xt_length_info), 58 .family = AF_INET,
59 .family = AF_INET, 59 .match = match,
60 .me = THIS_MODULE, 60 .matchsize = sizeof(struct xt_length_info),
61}; 61 .me = THIS_MODULE,
62 62 },
63static struct xt_match length6_match = { 63 {
64 .name = "length", 64 .name = "length",
65 .match = match6, 65 .family = AF_INET6,
66 .matchsize = sizeof(struct xt_length_info), 66 .match = match6,
67 .family = AF_INET6, 67 .matchsize = sizeof(struct xt_length_info),
68 .me = THIS_MODULE, 68 .me = THIS_MODULE,
69 },
69}; 70};
70 71
71static int __init xt_length_init(void) 72static int __init xt_length_init(void)
72{ 73{
73 int ret; 74 return xt_register_matches(xt_length_match,
74 ret = xt_register_match(&length_match); 75 ARRAY_SIZE(xt_length_match));
75 if (ret)
76 return ret;
77 ret = xt_register_match(&length6_match);
78 if (ret)
79 xt_unregister_match(&length_match);
80
81 return ret;
82} 76}
83 77
84static void __exit xt_length_fini(void) 78static void __exit xt_length_fini(void)
85{ 79{
86 xt_unregister_match(&length_match); 80 xt_unregister_matches(xt_length_match, ARRAY_SIZE(xt_length_match));
87 xt_unregister_match(&length6_match);
88} 81}
89 82
90module_init(xt_length_init); 83module_init(xt_length_init);
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c
index ce7fdb7e4e0..e8d5e7ac695 100644
--- a/net/netfilter/xt_limit.c
+++ b/net/netfilter/xt_limit.c
@@ -136,42 +136,33 @@ ipt_limit_checkentry(const char *tablename,
136 return 1; 136 return 1;
137} 137}
138 138
139static struct xt_match ipt_limit_reg = { 139static struct xt_match xt_limit_match[] = {
140 .name = "limit", 140 {
141 .match = ipt_limit_match, 141 .name = "limit",
142 .matchsize = sizeof(struct xt_rateinfo), 142 .family = AF_INET,
143 .checkentry = ipt_limit_checkentry, 143 .checkentry = ipt_limit_checkentry,
144 .family = AF_INET, 144 .match = ipt_limit_match,
145 .me = THIS_MODULE, 145 .matchsize = sizeof(struct xt_rateinfo),
146}; 146 .me = THIS_MODULE,
147static struct xt_match limit6_reg = { 147 },
148 .name = "limit", 148 {
149 .match = ipt_limit_match, 149 .name = "limit",
150 .matchsize = sizeof(struct xt_rateinfo), 150 .family = AF_INET6,
151 .checkentry = ipt_limit_checkentry, 151 .checkentry = ipt_limit_checkentry,
152 .family = AF_INET6, 152 .match = ipt_limit_match,
153 .me = THIS_MODULE, 153 .matchsize = sizeof(struct xt_rateinfo),
154 .me = THIS_MODULE,
155 },
154}; 156};
155 157
156static int __init xt_limit_init(void) 158static int __init xt_limit_init(void)
157{ 159{
158 int ret; 160 return xt_register_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match));
159
160 ret = xt_register_match(&ipt_limit_reg);
161 if (ret)
162 return ret;
163
164 ret = xt_register_match(&limit6_reg);
165 if (ret)
166 xt_unregister_match(&ipt_limit_reg);
167
168 return ret;
169} 161}
170 162
171static void __exit xt_limit_fini(void) 163static void __exit xt_limit_fini(void)
172{ 164{
173 xt_unregister_match(&ipt_limit_reg); 165 xt_unregister_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match));
174 xt_unregister_match(&limit6_reg);
175} 166}
176 167
177module_init(xt_limit_init); 168module_init(xt_limit_init);
diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c
index 356290ffe38..425fc21e31f 100644
--- a/net/netfilter/xt_mac.c
+++ b/net/netfilter/xt_mac.c
@@ -43,43 +43,37 @@ match(const struct sk_buff *skb,
43 ^ info->invert)); 43 ^ info->invert));
44} 44}
45 45
46static struct xt_match mac_match = { 46static struct xt_match xt_mac_match[] = {
47 .name = "mac", 47 {
48 .match = match, 48 .name = "mac",
49 .matchsize = sizeof(struct xt_mac_info), 49 .family = AF_INET,
50 .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN) | 50 .match = match,
51 (1 << NF_IP_FORWARD), 51 .matchsize = sizeof(struct xt_mac_info),
52 .family = AF_INET, 52 .hooks = (1 << NF_IP_PRE_ROUTING) |
53 .me = THIS_MODULE, 53 (1 << NF_IP_LOCAL_IN) |
54}; 54 (1 << NF_IP_FORWARD),
55static struct xt_match mac6_match = { 55 .me = THIS_MODULE,
56 .name = "mac", 56 },
57 .match = match, 57 {
58 .matchsize = sizeof(struct xt_mac_info), 58 .name = "mac",
59 .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN) | 59 .family = AF_INET6,
60 (1 << NF_IP_FORWARD), 60 .match = match,
61 .family = AF_INET6, 61 .matchsize = sizeof(struct xt_mac_info),
62 .me = THIS_MODULE, 62 .hooks = (1 << NF_IP_PRE_ROUTING) |
63 (1 << NF_IP_LOCAL_IN) |
64 (1 << NF_IP_FORWARD),
65 .me = THIS_MODULE,
66 },
63}; 67};
64 68
65static int __init xt_mac_init(void) 69static int __init xt_mac_init(void)
66{ 70{
67 int ret; 71 return xt_register_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match));
68 ret = xt_register_match(&mac_match);
69 if (ret)
70 return ret;
71
72 ret = xt_register_match(&mac6_match);
73 if (ret)
74 xt_unregister_match(&mac_match);
75
76 return ret;
77} 72}
78 73
79static void __exit xt_mac_fini(void) 74static void __exit xt_mac_fini(void)
80{ 75{
81 xt_unregister_match(&mac_match); 76 xt_unregister_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match));
82 xt_unregister_match(&mac6_match);
83} 77}
84 78
85module_init(xt_mac_init); 79module_init(xt_mac_init);
diff --git a/net/netfilter/xt_mark.c b/net/netfilter/xt_mark.c
index 876bc579773..39f9b079f5d 100644
--- a/net/netfilter/xt_mark.c
+++ b/net/netfilter/xt_mark.c
@@ -51,42 +51,33 @@ checkentry(const char *tablename,
51 return 1; 51 return 1;
52} 52}
53 53
54static struct xt_match mark_match = { 54static struct xt_match xt_mark_match[] = {
55 .name = "mark", 55 {
56 .match = match, 56 .name = "mark",
57 .matchsize = sizeof(struct xt_mark_info), 57 .family = AF_INET,
58 .checkentry = checkentry, 58 .checkentry = checkentry,
59 .family = AF_INET, 59 .match = match,
60 .me = THIS_MODULE, 60 .matchsize = sizeof(struct xt_mark_info),
61}; 61 .me = THIS_MODULE,
62 62 },
63static struct xt_match mark6_match = { 63 {
64 .name = "mark", 64 .name = "mark",
65 .match = match, 65 .family = AF_INET6,
66 .matchsize = sizeof(struct xt_mark_info), 66 .checkentry = checkentry,
67 .checkentry = checkentry, 67 .match = match,
68 .family = AF_INET6, 68 .matchsize = sizeof(struct xt_mark_info),
69 .me = THIS_MODULE, 69 .me = THIS_MODULE,
70 },
70}; 71};
71 72
72static int __init xt_mark_init(void) 73static int __init xt_mark_init(void)
73{ 74{
74 int ret; 75 return xt_register_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match));
75 ret = xt_register_match(&mark_match);
76 if (ret)
77 return ret;
78
79 ret = xt_register_match(&mark6_match);
80 if (ret)
81 xt_unregister_match(&mark_match);
82
83 return ret;
84} 76}
85 77
86static void __exit xt_mark_fini(void) 78static void __exit xt_mark_fini(void)
87{ 79{
88 xt_unregister_match(&mark_match); 80 xt_unregister_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match));
89 xt_unregister_match(&mark6_match);
90} 81}
91 82
92module_init(xt_mark_init); 83module_init(xt_mark_init);
diff --git a/net/netfilter/xt_multiport.c b/net/netfilter/xt_multiport.c
index 1ff0a25396e..e74f9bb98b3 100644
--- a/net/netfilter/xt_multiport.c
+++ b/net/netfilter/xt_multiport.c
@@ -231,84 +231,55 @@ checkentry6_v1(const char *tablename,
231 multiinfo->count); 231 multiinfo->count);
232} 232}
233 233
234static struct xt_match multiport_match = { 234static struct xt_match xt_multiport_match[] = {
235 .name = "multiport", 235 {
236 .revision = 0, 236 .name = "multiport",
237 .matchsize = sizeof(struct xt_multiport), 237 .family = AF_INET,
238 .match = &match, 238 .revision = 0,
239 .checkentry = &checkentry, 239 .checkentry = checkentry,
240 .family = AF_INET, 240 .match = match,
241 .me = THIS_MODULE, 241 .matchsize = sizeof(struct xt_multiport),
242}; 242 .me = THIS_MODULE,
243 243 },
244static struct xt_match multiport_match_v1 = { 244 {
245 .name = "multiport", 245 .name = "multiport",
246 .revision = 1, 246 .family = AF_INET,
247 .matchsize = sizeof(struct xt_multiport_v1), 247 .revision = 1,
248 .match = &match_v1, 248 .checkentry = checkentry_v1,
249 .checkentry = &checkentry_v1, 249 .match = match_v1,
250 .family = AF_INET, 250 .matchsize = sizeof(struct xt_multiport_v1),
251 .me = THIS_MODULE, 251 .me = THIS_MODULE,
252}; 252 },
253 253 {
254static struct xt_match multiport6_match = { 254 .name = "multiport",
255 .name = "multiport", 255 .family = AF_INET6,
256 .revision = 0, 256 .revision = 0,
257 .matchsize = sizeof(struct xt_multiport), 257 .checkentry = checkentry6,
258 .match = &match, 258 .match = match,
259 .checkentry = &checkentry6, 259 .matchsize = sizeof(struct xt_multiport),
260 .family = AF_INET6, 260 .me = THIS_MODULE,
261 .me = THIS_MODULE, 261 },
262}; 262 {
263 263 .name = "multiport",
264static struct xt_match multiport6_match_v1 = { 264 .family = AF_INET6,
265 .name = "multiport", 265 .revision = 1,
266 .revision = 1, 266 .checkentry = checkentry6_v1,
267 .matchsize = sizeof(struct xt_multiport_v1), 267 .match = match_v1,
268 .match = &match_v1, 268 .matchsize = sizeof(struct xt_multiport_v1),
269 .checkentry = &checkentry6_v1, 269 .me = THIS_MODULE,
270 .family = AF_INET6, 270 },
271 .me = THIS_MODULE,
272}; 271};
273 272
274static int __init xt_multiport_init(void) 273static int __init xt_multiport_init(void)
275{ 274{
276 int ret; 275 return xt_register_matches(xt_multiport_match,
277 276 ARRAY_SIZE(xt_multiport_match));
278 ret = xt_register_match(&multiport_match);
279 if (ret)
280 goto out;
281
282 ret = xt_register_match(&multiport_match_v1);
283 if (ret)
284 goto out_unreg_multi_v0;
285
286 ret = xt_register_match(&multiport6_match);
287 if (ret)
288 goto out_unreg_multi_v1;
289
290 ret = xt_register_match(&multiport6_match_v1);
291 if (ret)
292 goto out_unreg_multi6_v0;
293
294 return ret;
295
296out_unreg_multi6_v0:
297 xt_unregister_match(&multiport6_match);
298out_unreg_multi_v1:
299 xt_unregister_match(&multiport_match_v1);
300out_unreg_multi_v0:
301 xt_unregister_match(&multiport_match);
302out:
303 return ret;
304} 277}
305 278
306static void __exit xt_multiport_fini(void) 279static void __exit xt_multiport_fini(void)
307{ 280{
308 xt_unregister_match(&multiport_match); 281 xt_unregister_matches(xt_multiport_match,
309 xt_unregister_match(&multiport_match_v1); 282 ARRAY_SIZE(xt_multiport_match));
310 xt_unregister_match(&multiport6_match);
311 xt_unregister_match(&multiport6_match_v1);
312} 283}
313 284
314module_init(xt_multiport_init); 285module_init(xt_multiport_init);
diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c
index 63a96546746..af3d70f96ec 100644
--- a/net/netfilter/xt_physdev.c
+++ b/net/netfilter/xt_physdev.c
@@ -132,43 +132,34 @@ checkentry(const char *tablename,
132 return 1; 132 return 1;
133} 133}
134 134
135static struct xt_match physdev_match = { 135static struct xt_match xt_physdev_match[] = {
136 .name = "physdev", 136 {
137 .match = match, 137 .name = "physdev",
138 .matchsize = sizeof(struct xt_physdev_info), 138 .family = AF_INET,
139 .checkentry = checkentry, 139 .checkentry = checkentry,
140 .family = AF_INET, 140 .match = match,
141 .me = THIS_MODULE, 141 .matchsize = sizeof(struct xt_physdev_info),
142}; 142 .me = THIS_MODULE,
143 143 },
144static struct xt_match physdev6_match = { 144 {
145 .name = "physdev", 145 .name = "physdev",
146 .match = match, 146 .family = AF_INET6,
147 .matchsize = sizeof(struct xt_physdev_info), 147 .checkentry = checkentry,
148 .checkentry = checkentry, 148 .match = match,
149 .family = AF_INET6, 149 .matchsize = sizeof(struct xt_physdev_info),
150 .me = THIS_MODULE, 150 .me = THIS_MODULE,
151 },
151}; 152};
152 153
153static int __init xt_physdev_init(void) 154static int __init xt_physdev_init(void)
154{ 155{
155 int ret; 156 return xt_register_matches(xt_physdev_match,
156 157 ARRAY_SIZE(xt_physdev_match));
157 ret = xt_register_match(&physdev_match);
158 if (ret < 0)
159 return ret;
160
161 ret = xt_register_match(&physdev6_match);
162 if (ret < 0)
163 xt_unregister_match(&physdev_match);
164
165 return ret;
166} 158}
167 159
168static void __exit xt_physdev_fini(void) 160static void __exit xt_physdev_fini(void)
169{ 161{
170 xt_unregister_match(&physdev_match); 162 xt_unregister_matches(xt_physdev_match, ARRAY_SIZE(xt_physdev_match));
171 xt_unregister_match(&physdev6_match);
172} 163}
173 164
174module_init(xt_physdev_init); 165module_init(xt_physdev_init);
diff --git a/net/netfilter/xt_pkttype.c b/net/netfilter/xt_pkttype.c
index d2f5320a80b..16e7b080428 100644
--- a/net/netfilter/xt_pkttype.c
+++ b/net/netfilter/xt_pkttype.c
@@ -43,40 +43,32 @@ static int match(const struct sk_buff *skb,
43 return (type == info->pkttype) ^ info->invert; 43 return (type == info->pkttype) ^ info->invert;
44} 44}
45 45
46static struct xt_match pkttype_match = { 46static struct xt_match xt_pkttype_match[] = {
47 .name = "pkttype", 47 {
48 .match = match, 48 .name = "pkttype",
49 .matchsize = sizeof(struct xt_pkttype_info), 49 .family = AF_INET,
50 .family = AF_INET, 50 .match = match,
51 .me = THIS_MODULE, 51 .matchsize = sizeof(struct xt_pkttype_info),
52}; 52 .me = THIS_MODULE,
53 53 },
54static struct xt_match pkttype6_match = { 54 {
55 .name = "pkttype", 55 .name = "pkttype",
56 .match = match, 56 .family = AF_INET6,
57 .matchsize = sizeof(struct xt_pkttype_info), 57 .match = match,
58 .family = AF_INET6, 58 .matchsize = sizeof(struct xt_pkttype_info),
59 .me = THIS_MODULE, 59 .me = THIS_MODULE,
60 },
60}; 61};
61 62
62static int __init xt_pkttype_init(void) 63static int __init xt_pkttype_init(void)
63{ 64{
64 int ret; 65 return xt_register_matches(xt_pkttype_match,
65 ret = xt_register_match(&pkttype_match); 66 ARRAY_SIZE(xt_pkttype_match));
66 if (ret)
67 return ret;
68
69 ret = xt_register_match(&pkttype6_match);
70 if (ret)
71 xt_unregister_match(&pkttype_match);
72
73 return ret;
74} 67}
75 68
76static void __exit xt_pkttype_fini(void) 69static void __exit xt_pkttype_fini(void)
77{ 70{
78 xt_unregister_match(&pkttype_match); 71 xt_unregister_matches(xt_pkttype_match, ARRAY_SIZE(xt_pkttype_match));
79 xt_unregister_match(&pkttype6_match);
80} 72}
81 73
82module_init(xt_pkttype_init); 74module_init(xt_pkttype_init);
diff --git a/net/netfilter/xt_policy.c b/net/netfilter/xt_policy.c
index ba1ca03abad..f5639c45111 100644
--- a/net/netfilter/xt_policy.c
+++ b/net/netfilter/xt_policy.c
@@ -165,43 +165,36 @@ static int checkentry(const char *tablename, const void *ip_void,
165 return 1; 165 return 1;
166} 166}
167 167
168static struct xt_match policy_match = { 168static struct xt_match xt_policy_match[] = {
169 .name = "policy", 169 {
170 .family = AF_INET, 170 .name = "policy",
171 .match = match, 171 .family = AF_INET,
172 .matchsize = sizeof(struct xt_policy_info), 172 .checkentry = checkentry,
173 .checkentry = checkentry, 173 .match = match,
174 .family = AF_INET, 174 .matchsize = sizeof(struct xt_policy_info),
175 .me = THIS_MODULE, 175 .family = AF_INET,
176}; 176 .me = THIS_MODULE,
177 177 },
178static struct xt_match policy6_match = { 178 {
179 .name = "policy", 179 .name = "policy",
180 .family = AF_INET6, 180 .family = AF_INET6,
181 .match = match, 181 .checkentry = checkentry,
182 .matchsize = sizeof(struct xt_policy_info), 182 .match = match,
183 .checkentry = checkentry, 183 .matchsize = sizeof(struct xt_policy_info),
184 .family = AF_INET6, 184 .family = AF_INET6,
185 .me = THIS_MODULE, 185 .me = THIS_MODULE,
186 },
186}; 187};
187 188
188static int __init init(void) 189static int __init init(void)
189{ 190{
190 int ret; 191 return xt_register_matches(xt_policy_match,
191 192 ARRAY_SIZE(xt_policy_match));
192 ret = xt_register_match(&policy_match);
193 if (ret)
194 return ret;
195 ret = xt_register_match(&policy6_match);
196 if (ret)
197 xt_unregister_match(&policy_match);
198 return ret;
199} 193}
200 194
201static void __exit fini(void) 195static void __exit fini(void)
202{ 196{
203 xt_unregister_match(&policy6_match); 197 xt_unregister_matches(xt_policy_match, ARRAY_SIZE(xt_policy_match));
204 xt_unregister_match(&policy_match);
205} 198}
206 199
207module_init(init); 200module_init(init);
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index be8d3c26b56..cc44f87cb8e 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -52,46 +52,33 @@ checkentry(const char *tablename, const void *entry,
52 return 1; 52 return 1;
53} 53}
54 54
55static struct xt_match quota_match = { 55static struct xt_match xt_quota_match[] = {
56 .name = "quota", 56 {
57 .family = AF_INET, 57 .name = "quota",
58 .match = match, 58 .family = AF_INET,
59 .matchsize = sizeof(struct xt_quota_info), 59 .checkentry = checkentry,
60 .checkentry = checkentry, 60 .match = match,
61 .me = THIS_MODULE 61 .matchsize = sizeof(struct xt_quota_info),
62}; 62 .me = THIS_MODULE
63 63 },
64static struct xt_match quota_match6 = { 64 {
65 .name = "quota", 65 .name = "quota",
66 .family = AF_INET6, 66 .family = AF_INET6,
67 .match = match, 67 .checkentry = checkentry,
68 .matchsize = sizeof(struct xt_quota_info), 68 .match = match,
69 .checkentry = checkentry, 69 .matchsize = sizeof(struct xt_quota_info),
70 .me = THIS_MODULE 70 .me = THIS_MODULE
71 },
71}; 72};
72 73
73static int __init xt_quota_init(void) 74static int __init xt_quota_init(void)
74{ 75{
75 int ret; 76 return xt_register_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match));
76
77 ret = xt_register_match(&quota_match);
78 if (ret)
79 goto err1;
80 ret = xt_register_match(&quota_match6);
81 if (ret)
82 goto err2;
83 return ret;
84
85err2:
86 xt_unregister_match(&quota_match);
87err1:
88 return ret;
89} 77}
90 78
91static void __exit xt_quota_fini(void) 79static void __exit xt_quota_fini(void)
92{ 80{
93 xt_unregister_match(&quota_match6); 81 xt_unregister_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match));
94 xt_unregister_match(&quota_match);
95} 82}
96 83
97module_init(xt_quota_init); 84module_init(xt_quota_init);
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index 843383e01d4..5628621170e 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -178,44 +178,35 @@ checkentry(const char *tablename,
178 | SCTP_CHUNK_MATCH_ONLY))); 178 | SCTP_CHUNK_MATCH_ONLY)));
179} 179}
180 180
181static struct xt_match sctp_match = { 181static struct xt_match xt_sctp_match[] = {
182 .name = "sctp", 182 {
183 .match = match, 183 .name = "sctp",
184 .matchsize = sizeof(struct xt_sctp_info), 184 .family = AF_INET,
185 .proto = IPPROTO_SCTP, 185 .checkentry = checkentry,
186 .checkentry = checkentry, 186 .match = match,
187 .family = AF_INET, 187 .matchsize = sizeof(struct xt_sctp_info),
188 .me = THIS_MODULE 188 .proto = IPPROTO_SCTP,
189}; 189 .me = THIS_MODULE
190 190 },
191static struct xt_match sctp6_match = { 191 {
192 .name = "sctp", 192 .name = "sctp",
193 .match = match, 193 .family = AF_INET6,
194 .matchsize = sizeof(struct xt_sctp_info), 194 .checkentry = checkentry,
195 .proto = IPPROTO_SCTP, 195 .match = match,
196 .checkentry = checkentry, 196 .matchsize = sizeof(struct xt_sctp_info),
197 .family = AF_INET6, 197 .proto = IPPROTO_SCTP,
198 .me = THIS_MODULE 198 .me = THIS_MODULE
199 },
199}; 200};
200 201
201static int __init xt_sctp_init(void) 202static int __init xt_sctp_init(void)
202{ 203{
203 int ret; 204 return xt_register_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match));
204 ret = xt_register_match(&sctp_match);
205 if (ret)
206 return ret;
207
208 ret = xt_register_match(&sctp6_match);
209 if (ret)
210 xt_unregister_match(&sctp_match);
211
212 return ret;
213} 205}
214 206
215static void __exit xt_sctp_fini(void) 207static void __exit xt_sctp_fini(void)
216{ 208{
217 xt_unregister_match(&sctp6_match); 209 xt_unregister_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match));
218 xt_unregister_match(&sctp_match);
219} 210}
220 211
221module_init(xt_sctp_init); 212module_init(xt_sctp_init);
diff --git a/net/netfilter/xt_state.c b/net/netfilter/xt_state.c
index f9e304dc450..5f9492e3b2b 100644
--- a/net/netfilter/xt_state.c
+++ b/net/netfilter/xt_state.c
@@ -69,47 +69,36 @@ destroy(const struct xt_match *match, void *matchinfo, unsigned int matchsize)
69#endif 69#endif
70} 70}
71 71
72static struct xt_match state_match = { 72static struct xt_match xt_state_match[] = {
73 .name = "state", 73 {
74 .match = match, 74 .name = "state",
75 .checkentry = check, 75 .family = AF_INET,
76 .destroy = destroy, 76 .checkentry = check,
77 .matchsize = sizeof(struct xt_state_info), 77 .match = match,
78 .family = AF_INET, 78 .destroy = destroy,
79 .me = THIS_MODULE, 79 .matchsize = sizeof(struct xt_state_info),
80}; 80 .me = THIS_MODULE,
81 81 },
82static struct xt_match state6_match = { 82 {
83 .name = "state", 83 .name = "state",
84 .match = match, 84 .family = AF_INET6,
85 .checkentry = check, 85 .checkentry = check,
86 .destroy = destroy, 86 .match = match,
87 .matchsize = sizeof(struct xt_state_info), 87 .destroy = destroy,
88 .family = AF_INET6, 88 .matchsize = sizeof(struct xt_state_info),
89 .me = THIS_MODULE, 89 .me = THIS_MODULE,
90 },
90}; 91};
91 92
92static int __init xt_state_init(void) 93static int __init xt_state_init(void)
93{ 94{
94 int ret;
95
96 need_conntrack(); 95 need_conntrack();
97 96 return xt_register_matches(xt_state_match, ARRAY_SIZE(xt_state_match));
98 ret = xt_register_match(&state_match);
99 if (ret < 0)
100 return ret;
101
102 ret = xt_register_match(&state6_match);
103 if (ret < 0)
104 xt_unregister_match(&state_match);
105
106 return ret;
107} 97}
108 98
109static void __exit xt_state_fini(void) 99static void __exit xt_state_fini(void)
110{ 100{
111 xt_unregister_match(&state_match); 101 xt_unregister_matches(xt_state_match, ARRAY_SIZE(xt_state_match));
112 xt_unregister_match(&state6_match);
113} 102}
114 103
115module_init(xt_state_init); 104module_init(xt_state_init);
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
index de1037f5859..5181630a87f 100644
--- a/net/netfilter/xt_statistic.c
+++ b/net/netfilter/xt_statistic.c
@@ -66,46 +66,35 @@ checkentry(const char *tablename, const void *entry,
66 return 1; 66 return 1;
67} 67}
68 68
69static struct xt_match statistic_match = { 69static struct xt_match xt_statistic_match[] = {
70 .name = "statistic", 70 {
71 .match = match, 71 .name = "statistic",
72 .matchsize = sizeof(struct xt_statistic_info), 72 .family = AF_INET,
73 .checkentry = checkentry, 73 .checkentry = checkentry,
74 .family = AF_INET, 74 .match = match,
75 .me = THIS_MODULE, 75 .matchsize = sizeof(struct xt_statistic_info),
76}; 76 .me = THIS_MODULE,
77 77 },
78static struct xt_match statistic_match6 = { 78 {
79 .name = "statistic", 79 .name = "statistic",
80 .match = match, 80 .family = AF_INET6,
81 .matchsize = sizeof(struct xt_statistic_info), 81 .checkentry = checkentry,
82 .checkentry = checkentry, 82 .match = match,
83 .family = AF_INET6, 83 .matchsize = sizeof(struct xt_statistic_info),
84 .me = THIS_MODULE, 84 .me = THIS_MODULE,
85 },
85}; 86};
86 87
87static int __init xt_statistic_init(void) 88static int __init xt_statistic_init(void)
88{ 89{
89 int ret; 90 return xt_register_matches(xt_statistic_match,
90 91 ARRAY_SIZE(xt_statistic_match));
91 ret = xt_register_match(&statistic_match);
92 if (ret)
93 goto err1;
94
95 ret = xt_register_match(&statistic_match6);
96 if (ret)
97 goto err2;
98 return ret;
99err2:
100 xt_unregister_match(&statistic_match);
101err1:
102 return ret;
103} 92}
104 93
105static void __exit xt_statistic_fini(void) 94static void __exit xt_statistic_fini(void)
106{ 95{
107 xt_unregister_match(&statistic_match6); 96 xt_unregister_matches(xt_statistic_match,
108 xt_unregister_match(&statistic_match); 97 ARRAY_SIZE(xt_statistic_match));
109} 98}
110 99
111module_init(xt_statistic_init); 100module_init(xt_statistic_init);
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c
index 275330fcdaa..1a1c1d17d85 100644
--- a/net/netfilter/xt_string.c
+++ b/net/netfilter/xt_string.c
@@ -75,43 +75,35 @@ static void destroy(const struct xt_match *match, void *matchinfo,
75 textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config); 75 textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config);
76} 76}
77 77
78static struct xt_match string_match = { 78static struct xt_match xt_string_match[] = {
79 .name = "string", 79 {
80 .match = match, 80 .name = "string",
81 .matchsize = sizeof(struct xt_string_info), 81 .family = AF_INET,
82 .checkentry = checkentry, 82 .checkentry = checkentry,
83 .destroy = destroy, 83 .match = match,
84 .family = AF_INET, 84 .destroy = destroy,
85 .me = THIS_MODULE 85 .matchsize = sizeof(struct xt_string_info),
86}; 86 .me = THIS_MODULE
87static struct xt_match string6_match = { 87 },
88 .name = "string", 88 {
89 .match = match, 89 .name = "string",
90 .matchsize = sizeof(struct xt_string_info), 90 .family = AF_INET6,
91 .checkentry = checkentry, 91 .checkentry = checkentry,
92 .destroy = destroy, 92 .match = match,
93 .family = AF_INET6, 93 .destroy = destroy,
94 .me = THIS_MODULE 94 .matchsize = sizeof(struct xt_string_info),
95 .me = THIS_MODULE
96 },
95}; 97};
96 98
97static int __init xt_string_init(void) 99static int __init xt_string_init(void)
98{ 100{
99 int ret; 101 return xt_register_matches(xt_string_match, ARRAY_SIZE(xt_string_match));
100
101 ret = xt_register_match(&string_match);
102 if (ret)
103 return ret;
104 ret = xt_register_match(&string6_match);
105 if (ret)
106 xt_unregister_match(&string_match);
107
108 return ret;
109} 102}
110 103
111static void __exit xt_string_fini(void) 104static void __exit xt_string_fini(void)
112{ 105{
113 xt_unregister_match(&string_match); 106 xt_unregister_matches(xt_string_match, ARRAY_SIZE(xt_string_match));
114 xt_unregister_match(&string6_match);
115} 107}
116 108
117module_init(xt_string_init); 109module_init(xt_string_init);
diff --git a/net/netfilter/xt_tcpmss.c b/net/netfilter/xt_tcpmss.c
index cf7d335cadc..7baa9ebc46c 100644
--- a/net/netfilter/xt_tcpmss.c
+++ b/net/netfilter/xt_tcpmss.c
@@ -93,43 +93,34 @@ match(const struct sk_buff *skb,
93 info->invert, hotdrop); 93 info->invert, hotdrop);
94} 94}
95 95
96static struct xt_match tcpmss_match = { 96static struct xt_match xt_tcpmss_match[] = {
97 .name = "tcpmss", 97 {
98 .match = match, 98 .name = "tcpmss",
99 .matchsize = sizeof(struct xt_tcpmss_match_info), 99 .family = AF_INET,
100 .proto = IPPROTO_TCP, 100 .match = match,
101 .family = AF_INET, 101 .matchsize = sizeof(struct xt_tcpmss_match_info),
102 .me = THIS_MODULE, 102 .proto = IPPROTO_TCP,
103 .me = THIS_MODULE,
104 },
105 {
106 .name = "tcpmss",
107 .family = AF_INET6,
108 .match = match,
109 .matchsize = sizeof(struct xt_tcpmss_match_info),
110 .proto = IPPROTO_TCP,
111 .me = THIS_MODULE,
112 },
103}; 113};
104 114
105static struct xt_match tcpmss6_match = {
106 .name = "tcpmss",
107 .match = match,
108 .matchsize = sizeof(struct xt_tcpmss_match_info),
109 .proto = IPPROTO_TCP,
110 .family = AF_INET6,
111 .me = THIS_MODULE,
112};
113
114
115static int __init xt_tcpmss_init(void) 115static int __init xt_tcpmss_init(void)
116{ 116{
117 int ret; 117 return xt_register_matches(xt_tcpmss_match,
118 ret = xt_register_match(&tcpmss_match); 118 ARRAY_SIZE(xt_tcpmss_match));
119 if (ret)
120 return ret;
121
122 ret = xt_register_match(&tcpmss6_match);
123 if (ret)
124 xt_unregister_match(&tcpmss_match);
125
126 return ret;
127} 119}
128 120
129static void __exit xt_tcpmss_fini(void) 121static void __exit xt_tcpmss_fini(void)
130{ 122{
131 xt_unregister_match(&tcpmss6_match); 123 xt_unregister_matches(xt_tcpmss_match, ARRAY_SIZE(xt_tcpmss_match));
132 xt_unregister_match(&tcpmss_match);
133} 124}
134 125
135module_init(xt_tcpmss_init); 126module_init(xt_tcpmss_init);
diff --git a/net/netfilter/xt_tcpudp.c b/net/netfilter/xt_tcpudp.c
index a9a63aa6893..54aab051af8 100644
--- a/net/netfilter/xt_tcpudp.c
+++ b/net/netfilter/xt_tcpudp.c
@@ -199,81 +199,54 @@ udp_checkentry(const char *tablename,
199 return !(udpinfo->invflags & ~XT_UDP_INV_MASK); 199 return !(udpinfo->invflags & ~XT_UDP_INV_MASK);
200} 200}
201 201
202static struct xt_match tcp_matchstruct = { 202static struct xt_match xt_tcpudp_match[] = {
203 .name = "tcp", 203 {
204 .match = tcp_match, 204 .name = "tcp",
205 .matchsize = sizeof(struct xt_tcp), 205 .family = AF_INET,
206 .proto = IPPROTO_TCP, 206 .checkentry = tcp_checkentry,
207 .family = AF_INET, 207 .match = tcp_match,
208 .checkentry = tcp_checkentry, 208 .matchsize = sizeof(struct xt_tcp),
209 .me = THIS_MODULE, 209 .proto = IPPROTO_TCP,
210}; 210 .me = THIS_MODULE,
211 211 },
212static struct xt_match tcp6_matchstruct = { 212 {
213 .name = "tcp", 213 .name = "tcp",
214 .match = tcp_match, 214 .family = AF_INET6,
215 .matchsize = sizeof(struct xt_tcp), 215 .checkentry = tcp_checkentry,
216 .proto = IPPROTO_TCP, 216 .match = tcp_match,
217 .family = AF_INET6, 217 .matchsize = sizeof(struct xt_tcp),
218 .checkentry = tcp_checkentry, 218 .proto = IPPROTO_TCP,
219 .me = THIS_MODULE, 219 .me = THIS_MODULE,
220}; 220 },
221 221 {
222static struct xt_match udp_matchstruct = { 222 .name = "udp",
223 .name = "udp", 223 .family = AF_INET,
224 .match = udp_match, 224 .checkentry = udp_checkentry,
225 .matchsize = sizeof(struct xt_udp), 225 .match = udp_match,
226 .proto = IPPROTO_UDP, 226 .matchsize = sizeof(struct xt_udp),
227 .family = AF_INET, 227 .proto = IPPROTO_UDP,
228 .checkentry = udp_checkentry, 228 .me = THIS_MODULE,
229 .me = THIS_MODULE, 229 },
230}; 230 {
231static struct xt_match udp6_matchstruct = { 231 .name = "udp",
232 .name = "udp", 232 .family = AF_INET6,
233 .match = udp_match, 233 .checkentry = udp_checkentry,
234 .matchsize = sizeof(struct xt_udp), 234 .match = udp_match,
235 .proto = IPPROTO_UDP, 235 .matchsize = sizeof(struct xt_udp),
236 .family = AF_INET6, 236 .proto = IPPROTO_UDP,
237 .checkentry = udp_checkentry, 237 .me = THIS_MODULE,
238 .me = THIS_MODULE, 238 },
239}; 239};
240 240
241static int __init xt_tcpudp_init(void) 241static int __init xt_tcpudp_init(void)
242{ 242{
243 int ret; 243 return xt_register_matches(xt_tcpudp_match,
244 ret = xt_register_match(&tcp_matchstruct); 244 ARRAY_SIZE(xt_tcpudp_match));
245 if (ret)
246 return ret;
247
248 ret = xt_register_match(&tcp6_matchstruct);
249 if (ret)
250 goto out_unreg_tcp;
251
252 ret = xt_register_match(&udp_matchstruct);
253 if (ret)
254 goto out_unreg_tcp6;
255
256 ret = xt_register_match(&udp6_matchstruct);
257 if (ret)
258 goto out_unreg_udp;
259
260 return ret;
261
262out_unreg_udp:
263 xt_unregister_match(&udp_matchstruct);
264out_unreg_tcp6:
265 xt_unregister_match(&tcp6_matchstruct);
266out_unreg_tcp:
267 xt_unregister_match(&tcp_matchstruct);
268 return ret;
269} 245}
270 246
271static void __exit xt_tcpudp_fini(void) 247static void __exit xt_tcpudp_fini(void)
272{ 248{
273 xt_unregister_match(&udp6_matchstruct); 249 xt_unregister_matches(xt_tcpudp_match, ARRAY_SIZE(xt_tcpudp_match));
274 xt_unregister_match(&udp_matchstruct);
275 xt_unregister_match(&tcp6_matchstruct);
276 xt_unregister_match(&tcp_matchstruct);
277} 250}
278 251
279module_init(xt_tcpudp_init); 252module_init(xt_tcpudp_init);