Commit 4470bbc749e5551cce914529309456f631e25120
Committed by
David S. Miller
1 parent
52d9c42ef2
Exists in
master
and in
7 other branches
[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>
Showing 32 changed files with 679 additions and 1007 deletions Side-by-side Diff
- net/ipv6/netfilter/ip6t_REJECT.c
- net/netfilter/xt_CLASSIFY.c
- net/netfilter/xt_CONNMARK.c
- net/netfilter/xt_CONNSECMARK.c
- net/netfilter/xt_DSCP.c
- net/netfilter/xt_MARK.c
- net/netfilter/xt_NFQUEUE.c
- net/netfilter/xt_NOTRACK.c
- net/netfilter/xt_SECMARK.c
- net/netfilter/xt_comment.c
- net/netfilter/xt_connbytes.c
- net/netfilter/xt_connmark.c
- net/netfilter/xt_conntrack.c
- net/netfilter/xt_dccp.c
- net/netfilter/xt_dscp.c
- net/netfilter/xt_esp.c
- net/netfilter/xt_helper.c
- net/netfilter/xt_length.c
- net/netfilter/xt_limit.c
- net/netfilter/xt_mac.c
- net/netfilter/xt_mark.c
- net/netfilter/xt_multiport.c
- net/netfilter/xt_physdev.c
- net/netfilter/xt_pkttype.c
- net/netfilter/xt_policy.c
- net/netfilter/xt_quota.c
- net/netfilter/xt_sctp.c
- net/netfilter/xt_state.c
- net/netfilter/xt_statistic.c
- net/netfilter/xt_string.c
- net/netfilter/xt_tcpmss.c
- net/netfilter/xt_tcpudp.c
net/ipv6/netfilter/ip6t_REJECT.c
... | ... | @@ -257,9 +257,7 @@ |
257 | 257 | |
258 | 258 | static int __init ip6t_reject_init(void) |
259 | 259 | { |
260 | - if (ip6t_register_target(&ip6t_reject_reg)) | |
261 | - return -EINVAL; | |
262 | - return 0; | |
260 | + return ip6t_register_target(&ip6t_reject_reg); | |
263 | 261 | } |
264 | 262 | |
265 | 263 | static void __exit ip6t_reject_fini(void) |
net/netfilter/xt_CLASSIFY.c
... | ... | @@ -40,47 +40,41 @@ |
40 | 40 | return XT_CONTINUE; |
41 | 41 | } |
42 | 42 | |
43 | -static struct xt_target classify_reg = { | |
44 | - .name = "CLASSIFY", | |
45 | - .target = target, | |
46 | - .targetsize = sizeof(struct xt_classify_target_info), | |
47 | - .table = "mangle", | |
48 | - .hooks = (1 << NF_IP_LOCAL_OUT) | (1 << NF_IP_FORWARD) | | |
49 | - (1 << NF_IP_POST_ROUTING), | |
50 | - .family = AF_INET, | |
51 | - .me = THIS_MODULE, | |
43 | +static struct xt_target xt_classify_target[] = { | |
44 | + { | |
45 | + .family = AF_INET, | |
46 | + .name = "CLASSIFY", | |
47 | + .target = target, | |
48 | + .targetsize = sizeof(struct xt_classify_target_info), | |
49 | + .table = "mangle", | |
50 | + .hooks = (1 << NF_IP_LOCAL_OUT) | | |
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 | }; |
53 | -static 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 | 67 | |
64 | - | |
65 | 68 | static int __init xt_classify_init(void) |
66 | 69 | { |
67 | - int ret; | |
68 | - | |
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; | |
70 | + return xt_register_targets(xt_classify_target, | |
71 | + ARRAY_SIZE(xt_classify_target)); | |
78 | 72 | } |
79 | 73 | |
80 | 74 | static void __exit xt_classify_fini(void) |
81 | 75 | { |
82 | - xt_unregister_target(&classify_reg); | |
83 | - xt_unregister_target(&classify6_reg); | |
76 | + xt_unregister_targets(xt_classify_target, | |
77 | + ARRAY_SIZE(xt_classify_target)); | |
84 | 78 | } |
85 | 79 | |
86 | 80 | module_init(xt_classify_init); |
net/netfilter/xt_CONNMARK.c
... | ... | @@ -110,45 +110,36 @@ |
110 | 110 | return 1; |
111 | 111 | } |
112 | 112 | |
113 | -static struct xt_target connmark_reg = { | |
114 | - .name = "CONNMARK", | |
115 | - .target = target, | |
116 | - .targetsize = sizeof(struct xt_connmark_target_info), | |
117 | - .checkentry = checkentry, | |
118 | - .family = AF_INET, | |
119 | - .me = THIS_MODULE | |
113 | +static struct xt_target xt_connmark_target[] = { | |
114 | + { | |
115 | + .name = "CONNMARK", | |
116 | + .family = AF_INET, | |
117 | + .checkentry = checkentry, | |
118 | + .target = target, | |
119 | + .targetsize = sizeof(struct xt_connmark_target_info), | |
120 | + .me = THIS_MODULE | |
121 | + }, | |
122 | + { | |
123 | + .name = "CONNMARK", | |
124 | + .family = AF_INET6, | |
125 | + .checkentry = checkentry, | |
126 | + .target = target, | |
127 | + .targetsize = sizeof(struct xt_connmark_target_info), | |
128 | + .me = THIS_MODULE | |
129 | + }, | |
120 | 130 | }; |
121 | 131 | |
122 | -static struct xt_target connmark6_reg = { | |
123 | - .name = "CONNMARK", | |
124 | - .target = target, | |
125 | - .targetsize = sizeof(struct xt_connmark_target_info), | |
126 | - .checkentry = checkentry, | |
127 | - .family = AF_INET6, | |
128 | - .me = THIS_MODULE | |
129 | -}; | |
130 | - | |
131 | 132 | static int __init xt_connmark_init(void) |
132 | 133 | { |
133 | - int ret; | |
134 | - | |
135 | 134 | need_conntrack(); |
136 | - | |
137 | - ret = xt_register_target(&connmark_reg); | |
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; | |
135 | + return xt_register_targets(xt_connmark_target, | |
136 | + ARRAY_SIZE(xt_connmark_target)); | |
146 | 137 | } |
147 | 138 | |
148 | 139 | static void __exit xt_connmark_fini(void) |
149 | 140 | { |
150 | - xt_unregister_target(&connmark_reg); | |
151 | - xt_unregister_target(&connmark6_reg); | |
141 | + xt_unregister_targets(xt_connmark_target, | |
142 | + ARRAY_SIZE(xt_connmark_target)); | |
152 | 143 | } |
153 | 144 | |
154 | 145 | module_init(xt_connmark_init); |
net/netfilter/xt_CONNSECMARK.c
... | ... | @@ -106,49 +106,38 @@ |
106 | 106 | return 1; |
107 | 107 | } |
108 | 108 | |
109 | -static struct xt_target ipt_connsecmark_reg = { | |
110 | - .name = "CONNSECMARK", | |
111 | - .target = target, | |
112 | - .targetsize = sizeof(struct xt_connsecmark_target_info), | |
113 | - .table = "mangle", | |
114 | - .checkentry = checkentry, | |
115 | - .me = THIS_MODULE, | |
116 | - .family = AF_INET, | |
117 | - .revision = 0, | |
109 | +static struct xt_target xt_connsecmark_target[] = { | |
110 | + { | |
111 | + .name = "CONNSECMARK", | |
112 | + .family = AF_INET, | |
113 | + .checkentry = checkentry, | |
114 | + .target = target, | |
115 | + .targetsize = sizeof(struct xt_connsecmark_target_info), | |
116 | + .table = "mangle", | |
117 | + .me = THIS_MODULE, | |
118 | + }, | |
119 | + { | |
120 | + .name = "CONNSECMARK", | |
121 | + .family = AF_INET6, | |
122 | + .checkentry = checkentry, | |
123 | + .target = target, | |
124 | + .targetsize = sizeof(struct xt_connsecmark_target_info), | |
125 | + .table = "mangle", | |
126 | + .me = THIS_MODULE, | |
127 | + }, | |
118 | 128 | }; |
119 | 129 | |
120 | -static struct xt_target ip6t_connsecmark_reg = { | |
121 | - .name = "CONNSECMARK", | |
122 | - .target = target, | |
123 | - .targetsize = sizeof(struct xt_connsecmark_target_info), | |
124 | - .table = "mangle", | |
125 | - .checkentry = checkentry, | |
126 | - .me = THIS_MODULE, | |
127 | - .family = AF_INET6, | |
128 | - .revision = 0, | |
129 | -}; | |
130 | - | |
131 | 130 | static int __init xt_connsecmark_init(void) |
132 | 131 | { |
133 | - int err; | |
134 | - | |
135 | 132 | need_conntrack(); |
136 | - | |
137 | - err = xt_register_target(&ipt_connsecmark_reg); | |
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; | |
133 | + return xt_register_targets(xt_connsecmark_targets, | |
134 | + ARRAY_SIZE(xt_connsecmark_targets)); | |
146 | 135 | } |
147 | 136 | |
148 | 137 | static void __exit xt_connsecmark_fini(void) |
149 | 138 | { |
150 | - xt_unregister_target(&ip6t_connsecmark_reg); | |
151 | - xt_unregister_target(&ipt_connsecmark_reg); | |
139 | + xt_unregister_targets(xt_connsecmark_targets, | |
140 | + ARRAY_SIZE(xt_connsecmark_targets)); | |
152 | 141 | } |
153 | 142 | |
154 | 143 | module_init(xt_connsecmark_init); |
net/netfilter/xt_DSCP.c
... | ... | @@ -86,44 +86,35 @@ |
86 | 86 | return 1; |
87 | 87 | } |
88 | 88 | |
89 | -static struct xt_target xt_dscp_reg = { | |
90 | - .name = "DSCP", | |
91 | - .target = target, | |
92 | - .targetsize = sizeof(struct xt_DSCP_info), | |
93 | - .table = "mangle", | |
94 | - .checkentry = checkentry, | |
95 | - .family = AF_INET, | |
96 | - .me = THIS_MODULE, | |
89 | +static struct xt_target xt_dscp_target[] = { | |
90 | + { | |
91 | + .name = "DSCP", | |
92 | + .family = AF_INET, | |
93 | + .checkentry = checkentry, | |
94 | + .target = target, | |
95 | + .targetsize = sizeof(struct xt_DSCP_info), | |
96 | + .table = "mangle", | |
97 | + .me = THIS_MODULE, | |
98 | + }, | |
99 | + { | |
100 | + .name = "DSCP", | |
101 | + .family = AF_INET6, | |
102 | + .checkentry = checkentry, | |
103 | + .target = target6, | |
104 | + .targetsize = sizeof(struct xt_DSCP_info), | |
105 | + .table = "mangle", | |
106 | + .me = THIS_MODULE, | |
107 | + }, | |
97 | 108 | }; |
98 | 109 | |
99 | -static struct xt_target xt_dscp6_reg = { | |
100 | - .name = "DSCP", | |
101 | - .target = target6, | |
102 | - .targetsize = sizeof(struct xt_DSCP_info), | |
103 | - .table = "mangle", | |
104 | - .checkentry = checkentry, | |
105 | - .family = AF_INET6, | |
106 | - .me = THIS_MODULE, | |
107 | -}; | |
108 | - | |
109 | 110 | static int __init xt_dscp_target_init(void) |
110 | 111 | { |
111 | - int ret; | |
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; | |
112 | + return xt_register_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target)); | |
121 | 113 | } |
122 | 114 | |
123 | 115 | static void __exit xt_dscp_target_fini(void) |
124 | 116 | { |
125 | - xt_unregister_target(&xt_dscp_reg); | |
126 | - xt_unregister_target(&xt_dscp6_reg); | |
117 | + xt_unregister_targets(xt_dscp_target, ARRAY_SIZE(xt_dscp_target)); | |
127 | 118 | } |
128 | 119 | |
129 | 120 | module_init(xt_dscp_target_init); |
net/netfilter/xt_MARK.c
... | ... | @@ -112,65 +112,47 @@ |
112 | 112 | return 1; |
113 | 113 | } |
114 | 114 | |
115 | -static struct xt_target ipt_mark_reg_v0 = { | |
116 | - .name = "MARK", | |
117 | - .target = target_v0, | |
118 | - .targetsize = sizeof(struct xt_mark_target_info), | |
119 | - .table = "mangle", | |
120 | - .checkentry = checkentry_v0, | |
121 | - .me = THIS_MODULE, | |
122 | - .family = AF_INET, | |
123 | - .revision = 0, | |
115 | +static struct xt_target xt_mark_target[] = { | |
116 | + { | |
117 | + .name = "MARK", | |
118 | + .family = AF_INET, | |
119 | + .revision = 0, | |
120 | + .checkentry = checkentry_v0, | |
121 | + .target = target_v0, | |
122 | + .targetsize = sizeof(struct xt_mark_target_info), | |
123 | + .table = "mangle", | |
124 | + .me = THIS_MODULE, | |
125 | + }, | |
126 | + { | |
127 | + .name = "MARK", | |
128 | + .family = AF_INET, | |
129 | + .revision = 1, | |
130 | + .checkentry = checkentry_v1, | |
131 | + .target = target_v1, | |
132 | + .targetsize = sizeof(struct xt_mark_target_info_v1), | |
133 | + .table = "mangle", | |
134 | + .me = THIS_MODULE, | |
135 | + }, | |
136 | + { | |
137 | + .name = "MARK", | |
138 | + .family = AF_INET6, | |
139 | + .revision = 0, | |
140 | + .checkentry = checkentry_v0, | |
141 | + .target = target_v0, | |
142 | + .targetsize = sizeof(struct xt_mark_target_info), | |
143 | + .table = "mangle", | |
144 | + .me = THIS_MODULE, | |
145 | + }, | |
124 | 146 | }; |
125 | 147 | |
126 | -static struct xt_target ipt_mark_reg_v1 = { | |
127 | - .name = "MARK", | |
128 | - .target = target_v1, | |
129 | - .targetsize = sizeof(struct xt_mark_target_info_v1), | |
130 | - .table = "mangle", | |
131 | - .checkentry = checkentry_v1, | |
132 | - .me = THIS_MODULE, | |
133 | - .family = AF_INET, | |
134 | - .revision = 1, | |
135 | -}; | |
136 | - | |
137 | -static struct xt_target ip6t_mark_reg_v0 = { | |
138 | - .name = "MARK", | |
139 | - .target = target_v0, | |
140 | - .targetsize = sizeof(struct xt_mark_target_info), | |
141 | - .table = "mangle", | |
142 | - .checkentry = checkentry_v0, | |
143 | - .me = THIS_MODULE, | |
144 | - .family = AF_INET6, | |
145 | - .revision = 0, | |
146 | -}; | |
147 | - | |
148 | 148 | static int __init xt_mark_init(void) |
149 | 149 | { |
150 | - int err; | |
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; | |
150 | + return xt_register_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target)); | |
167 | 151 | } |
168 | 152 | |
169 | 153 | static void __exit xt_mark_fini(void) |
170 | 154 | { |
171 | - xt_unregister_target(&ipt_mark_reg_v0); | |
172 | - xt_unregister_target(&ipt_mark_reg_v1); | |
173 | - xt_unregister_target(&ip6t_mark_reg_v0); | |
155 | + xt_unregister_targets(xt_mark_target, ARRAY_SIZE(xt_mark_target)); | |
174 | 156 | } |
175 | 157 | |
176 | 158 | module_init(xt_mark_init); |
net/netfilter/xt_NFQUEUE.c
... | ... | @@ -37,57 +37,39 @@ |
37 | 37 | return NF_QUEUE_NR(tinfo->queuenum); |
38 | 38 | } |
39 | 39 | |
40 | -static struct xt_target ipt_NFQ_reg = { | |
41 | - .name = "NFQUEUE", | |
42 | - .target = target, | |
43 | - .targetsize = sizeof(struct xt_NFQ_info), | |
44 | - .family = AF_INET, | |
45 | - .me = THIS_MODULE, | |
40 | +static struct xt_target xt_nfqueue_target[] = { | |
41 | + { | |
42 | + .name = "NFQUEUE", | |
43 | + .family = AF_INET, | |
44 | + .target = target, | |
45 | + .targetsize = sizeof(struct xt_NFQ_info), | |
46 | + .me = THIS_MODULE, | |
47 | + }, | |
48 | + { | |
49 | + .name = "NFQUEUE", | |
50 | + .family = AF_INET6, | |
51 | + .target = target, | |
52 | + .targetsize = sizeof(struct xt_NFQ_info), | |
53 | + .me = THIS_MODULE, | |
54 | + }, | |
55 | + { | |
56 | + .name = "NFQUEUE", | |
57 | + .family = NF_ARP, | |
58 | + .target = target, | |
59 | + .targetsize = sizeof(struct xt_NFQ_info), | |
60 | + .me = THIS_MODULE, | |
61 | + }, | |
46 | 62 | }; |
47 | 63 | |
48 | -static struct xt_target ip6t_NFQ_reg = { | |
49 | - .name = "NFQUEUE", | |
50 | - .target = target, | |
51 | - .targetsize = sizeof(struct xt_NFQ_info), | |
52 | - .family = AF_INET6, | |
53 | - .me = THIS_MODULE, | |
54 | -}; | |
55 | - | |
56 | -static struct xt_target arpt_NFQ_reg = { | |
57 | - .name = "NFQUEUE", | |
58 | - .target = target, | |
59 | - .targetsize = sizeof(struct xt_NFQ_info), | |
60 | - .family = NF_ARP, | |
61 | - .me = THIS_MODULE, | |
62 | -}; | |
63 | - | |
64 | 64 | static int __init xt_nfqueue_init(void) |
65 | 65 | { |
66 | - int ret; | |
67 | - ret = xt_register_target(&ipt_NFQ_reg); | |
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; | |
78 | -out_ip6: | |
79 | - xt_unregister_target(&ip6t_NFQ_reg); | |
80 | -out_ip: | |
81 | - xt_unregister_target(&ipt_NFQ_reg); | |
82 | - | |
83 | - return ret; | |
66 | + return xt_register_targets(xt_nfqueue_target, | |
67 | + ARRAY_SIZE(xt_nfqueue_target)); | |
84 | 68 | } |
85 | 69 | |
86 | 70 | static void __exit xt_nfqueue_fini(void) |
87 | 71 | { |
88 | - xt_unregister_target(&arpt_NFQ_reg); | |
89 | - xt_unregister_target(&ip6t_NFQ_reg); | |
90 | - xt_unregister_target(&ipt_NFQ_reg); | |
72 | + xt_register_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target)); | |
91 | 73 | } |
92 | 74 | |
93 | 75 | module_init(xt_nfqueue_init); |
net/netfilter/xt_NOTRACK.c
... | ... | @@ -34,43 +34,32 @@ |
34 | 34 | return XT_CONTINUE; |
35 | 35 | } |
36 | 36 | |
37 | -static struct xt_target notrack_reg = { | |
38 | - .name = "NOTRACK", | |
39 | - .target = target, | |
40 | - .targetsize = 0, | |
41 | - .table = "raw", | |
42 | - .family = AF_INET, | |
43 | - .me = THIS_MODULE, | |
37 | +static struct xt_target xt_notrack_target[] = { | |
38 | + { | |
39 | + .name = "NOTRACK", | |
40 | + .family = AF_INET, | |
41 | + .target = target, | |
42 | + .table = "raw", | |
43 | + .me = THIS_MODULE, | |
44 | + }, | |
45 | + { | |
46 | + .name = "NOTRACK", | |
47 | + .family = AF_INET6, | |
48 | + .target = target, | |
49 | + .table = "raw", | |
50 | + .me = THIS_MODULE, | |
51 | + }, | |
44 | 52 | }; |
45 | 53 | |
46 | -static struct xt_target notrack6_reg = { | |
47 | - .name = "NOTRACK", | |
48 | - .target = target, | |
49 | - .targetsize = 0, | |
50 | - .table = "raw", | |
51 | - .family = AF_INET6, | |
52 | - .me = THIS_MODULE, | |
53 | -}; | |
54 | - | |
55 | 54 | static int __init xt_notrack_init(void) |
56 | 55 | { |
57 | - int ret; | |
58 | - | |
59 | - ret = xt_register_target(¬rack_reg); | |
60 | - if (ret) | |
61 | - return ret; | |
62 | - | |
63 | - ret = xt_register_target(¬rack6_reg); | |
64 | - if (ret) | |
65 | - xt_unregister_target(¬rack_reg); | |
66 | - | |
67 | - return ret; | |
56 | + return xt_register_targets(xt_notrack_target, | |
57 | + ARRAY_SIZE(xt_notrack_target)); | |
68 | 58 | } |
69 | 59 | |
70 | 60 | static void __exit xt_notrack_fini(void) |
71 | 61 | { |
72 | - xt_unregister_target(¬rack6_reg); | |
73 | - xt_unregister_target(¬rack_reg); | |
62 | + xt_unregister_targets(xt_notrack_target, ARRAY_SIZE(xt_notrack_target)); | |
74 | 63 | } |
75 | 64 | |
76 | 65 | module_init(xt_notrack_init); |
net/netfilter/xt_SECMARK.c
... | ... | @@ -111,47 +111,36 @@ |
111 | 111 | return 1; |
112 | 112 | } |
113 | 113 | |
114 | -static struct xt_target ipt_secmark_reg = { | |
115 | - .name = "SECMARK", | |
116 | - .target = target, | |
117 | - .targetsize = sizeof(struct xt_secmark_target_info), | |
118 | - .table = "mangle", | |
119 | - .checkentry = checkentry, | |
120 | - .me = THIS_MODULE, | |
121 | - .family = AF_INET, | |
122 | - .revision = 0, | |
114 | +static struct xt_target xt_secmark_target = { | |
115 | + { | |
116 | + .name = "SECMARK", | |
117 | + .family = AF_INET, | |
118 | + .checkentry = checkentry, | |
119 | + .target = target, | |
120 | + .targetsize = sizeof(struct xt_secmark_target_info), | |
121 | + .table = "mangle", | |
122 | + .me = THIS_MODULE, | |
123 | + }, | |
124 | + { | |
125 | + .name = "SECMARK", | |
126 | + .family = AF_INET6, | |
127 | + .checkentry = checkentry, | |
128 | + .target = target, | |
129 | + .targetsize = sizeof(struct xt_secmark_target_info), | |
130 | + .table = "mangle", | |
131 | + .me = THIS_MODULE, | |
132 | + }, | |
123 | 133 | }; |
124 | 134 | |
125 | -static struct xt_target ip6t_secmark_reg = { | |
126 | - .name = "SECMARK", | |
127 | - .target = target, | |
128 | - .targetsize = sizeof(struct xt_secmark_target_info), | |
129 | - .table = "mangle", | |
130 | - .checkentry = checkentry, | |
131 | - .me = THIS_MODULE, | |
132 | - .family = AF_INET6, | |
133 | - .revision = 0, | |
134 | -}; | |
135 | - | |
136 | 135 | static int __init xt_secmark_init(void) |
137 | 136 | { |
138 | - int err; | |
139 | - | |
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; | |
137 | + return xt_register_targets(xt_secmark_target, | |
138 | + ARRAY_SIZE(xt_secmark_target)); | |
149 | 139 | } |
150 | 140 | |
151 | 141 | static void __exit xt_secmark_fini(void) |
152 | 142 | { |
153 | - xt_unregister_target(&ip6t_secmark_reg); | |
154 | - xt_unregister_target(&ipt_secmark_reg); | |
143 | + xt_unregister_targets(xt_secmark_target, ARRAY_SIZE(xt_secmark_target)); | |
155 | 144 | } |
156 | 145 | |
157 | 146 | module_init(xt_secmark_init); |
net/netfilter/xt_comment.c
... | ... | @@ -29,41 +29,32 @@ |
29 | 29 | return 1; |
30 | 30 | } |
31 | 31 | |
32 | -static struct xt_match comment_match = { | |
33 | - .name = "comment", | |
34 | - .match = match, | |
35 | - .matchsize = sizeof(struct xt_comment_info), | |
36 | - .family = AF_INET, | |
37 | - .me = THIS_MODULE | |
32 | +static struct xt_match xt_comment_match[] = { | |
33 | + { | |
34 | + .name = "comment", | |
35 | + .family = AF_INET, | |
36 | + .match = match, | |
37 | + .matchsize = sizeof(struct xt_comment_info), | |
38 | + .me = THIS_MODULE | |
39 | + }, | |
40 | + { | |
41 | + .name = "comment", | |
42 | + .family = AF_INET6, | |
43 | + .match = match, | |
44 | + .matchsize = sizeof(struct xt_comment_info), | |
45 | + .me = THIS_MODULE | |
46 | + }, | |
38 | 47 | }; |
39 | 48 | |
40 | -static struct xt_match comment6_match = { | |
41 | - .name = "comment", | |
42 | - .match = match, | |
43 | - .matchsize = sizeof(struct xt_comment_info), | |
44 | - .family = AF_INET6, | |
45 | - .me = THIS_MODULE | |
46 | -}; | |
47 | - | |
48 | 49 | static int __init xt_comment_init(void) |
49 | 50 | { |
50 | - int ret; | |
51 | - | |
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; | |
51 | + return xt_register_matches(xt_comment_match, | |
52 | + ARRAY_SIZE(xt_comment_match)); | |
61 | 53 | } |
62 | 54 | |
63 | 55 | static void __exit xt_comment_fini(void) |
64 | 56 | { |
65 | - xt_unregister_match(&comment_match); | |
66 | - xt_unregister_match(&comment6_match); | |
57 | + xt_unregister_matches(xt_comment_match, ARRAY_SIZE(xt_comment_match)); | |
67 | 58 | } |
68 | 59 | |
69 | 60 | module_init(xt_comment_init); |
net/netfilter/xt_connbytes.c
... | ... | @@ -143,40 +143,35 @@ |
143 | 143 | return 1; |
144 | 144 | } |
145 | 145 | |
146 | -static struct xt_match connbytes_match = { | |
147 | - .name = "connbytes", | |
148 | - .match = match, | |
149 | - .checkentry = check, | |
150 | - .matchsize = sizeof(struct xt_connbytes_info), | |
151 | - .family = AF_INET, | |
152 | - .me = THIS_MODULE | |
146 | +static struct xt_match xt_connbytes_match = { | |
147 | + { | |
148 | + .name = "connbytes", | |
149 | + .family = AF_INET, | |
150 | + .checkentry = check, | |
151 | + .match = match, | |
152 | + .matchsize = sizeof(struct xt_connbytes_info), | |
153 | + .me = THIS_MODULE | |
154 | + }, | |
155 | + { | |
156 | + .name = "connbytes", | |
157 | + .family = AF_INET6, | |
158 | + .checkentry = check, | |
159 | + .match = match, | |
160 | + .matchsize = sizeof(struct xt_connbytes_info), | |
161 | + .me = THIS_MODULE | |
162 | + }, | |
153 | 163 | }; |
154 | -static struct xt_match connbytes6_match = { | |
155 | - .name = "connbytes", | |
156 | - .match = match, | |
157 | - .checkentry = check, | |
158 | - .matchsize = sizeof(struct xt_connbytes_info), | |
159 | - .family = AF_INET6, | |
160 | - .me = THIS_MODULE | |
161 | -}; | |
162 | 164 | |
163 | 165 | static int __init xt_connbytes_init(void) |
164 | 166 | { |
165 | - int ret; | |
166 | - ret = xt_register_match(&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; | |
167 | + return xt_register_matches(xt_connbytes_match, | |
168 | + ARRAY_SIZE(xt_connbytes_match)); | |
174 | 169 | } |
175 | 170 | |
176 | 171 | static void __exit xt_connbytes_fini(void) |
177 | 172 | { |
178 | - xt_unregister_match(&connbytes_match); | |
179 | - xt_unregister_match(&connbytes6_match); | |
173 | + xt_unregister_matches(xt_connbytes_match, | |
174 | + ARRAY_SIZE(xt_connbytes_match)); | |
180 | 175 | } |
181 | 176 | |
182 | 177 | module_init(xt_connbytes_init); |
net/netfilter/xt_connmark.c
... | ... | @@ -82,46 +82,37 @@ |
82 | 82 | #endif |
83 | 83 | } |
84 | 84 | |
85 | -static struct xt_match connmark_match = { | |
86 | - .name = "connmark", | |
87 | - .match = match, | |
88 | - .matchsize = sizeof(struct xt_connmark_info), | |
89 | - .checkentry = checkentry, | |
90 | - .destroy = destroy, | |
91 | - .family = AF_INET, | |
92 | - .me = THIS_MODULE | |
85 | +static struct xt_match xt_connmark_match[] = { | |
86 | + { | |
87 | + .name = "connmark", | |
88 | + .family = AF_INET, | |
89 | + .checkentry = checkentry, | |
90 | + .match = match, | |
91 | + .destroy = destroy, | |
92 | + .matchsize = sizeof(struct xt_connmark_info), | |
93 | + .me = THIS_MODULE | |
94 | + }, | |
95 | + { | |
96 | + .name = "connmark", | |
97 | + .family = AF_INET6, | |
98 | + .checkentry = checkentry, | |
99 | + .match = match, | |
100 | + .destroy = destroy, | |
101 | + .matchsize = sizeof(struct xt_connmark_info), | |
102 | + .me = THIS_MODULE | |
103 | + }, | |
93 | 104 | }; |
94 | 105 | |
95 | -static struct xt_match connmark6_match = { | |
96 | - .name = "connmark", | |
97 | - .match = match, | |
98 | - .matchsize = sizeof(struct xt_connmark_info), | |
99 | - .checkentry = checkentry, | |
100 | - .destroy = destroy, | |
101 | - .family = AF_INET6, | |
102 | - .me = THIS_MODULE | |
103 | -}; | |
104 | - | |
105 | 106 | static int __init xt_connmark_init(void) |
106 | 107 | { |
107 | - int ret; | |
108 | - | |
109 | 108 | need_conntrack(); |
110 | - | |
111 | - ret = xt_register_match(&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; | |
109 | + return xt_register_matches(xt_connmark_match, | |
110 | + ARRAY_SIZE(xt_connmark_match)); | |
119 | 111 | } |
120 | 112 | |
121 | 113 | static void __exit xt_connmark_fini(void) |
122 | 114 | { |
123 | - xt_unregister_match(&connmark6_match); | |
124 | - xt_unregister_match(&connmark_match); | |
115 | + xt_register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match)); | |
125 | 116 | } |
126 | 117 | |
127 | 118 | module_init(xt_connmark_init); |
net/netfilter/xt_conntrack.c
... | ... | @@ -241,11 +241,8 @@ |
241 | 241 | |
242 | 242 | static int __init xt_conntrack_init(void) |
243 | 243 | { |
244 | - int ret; | |
245 | 244 | need_conntrack(); |
246 | - ret = xt_register_match(&conntrack_match); | |
247 | - | |
248 | - return ret; | |
245 | + return xt_register_match(&conntrack_match); | |
249 | 246 | } |
250 | 247 | |
251 | 248 | static void __exit xt_conntrack_fini(void) |
net/netfilter/xt_dccp.c
... | ... | @@ -141,28 +141,27 @@ |
141 | 141 | && !(info->invflags & ~info->flags); |
142 | 142 | } |
143 | 143 | |
144 | -static struct xt_match dccp_match = | |
145 | -{ | |
146 | - .name = "dccp", | |
147 | - .match = match, | |
148 | - .matchsize = sizeof(struct xt_dccp_info), | |
149 | - .proto = IPPROTO_DCCP, | |
150 | - .checkentry = checkentry, | |
151 | - .family = AF_INET, | |
152 | - .me = THIS_MODULE, | |
144 | +static struct xt_match xt_dccp_match[] = { | |
145 | + { | |
146 | + .name = "dccp", | |
147 | + .family = AF_INET, | |
148 | + .checkentry = checkentry, | |
149 | + .match = match, | |
150 | + .matchsize = sizeof(struct xt_dccp_info), | |
151 | + .proto = IPPROTO_DCCP, | |
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 | }; |
154 | -static 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 | 164 | |
165 | - | |
166 | 165 | static int __init xt_dccp_init(void) |
167 | 166 | { |
168 | 167 | int ret; |
169 | 168 | |
170 | 169 | |
171 | 170 | |
172 | 171 | |
... | ... | @@ -173,27 +172,19 @@ |
173 | 172 | dccp_optbuf = kmalloc(256 * 4, GFP_KERNEL); |
174 | 173 | if (!dccp_optbuf) |
175 | 174 | return -ENOMEM; |
176 | - ret = xt_register_match(&dccp_match); | |
175 | + ret = xt_register_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match)); | |
177 | 176 | if (ret) |
178 | 177 | goto out_kfree; |
179 | - ret = xt_register_match(&dccp6_match); | |
180 | - if (ret) | |
181 | - goto out_unreg; | |
182 | - | |
183 | 178 | return ret; |
184 | 179 | |
185 | -out_unreg: | |
186 | - xt_unregister_match(&dccp_match); | |
187 | 180 | out_kfree: |
188 | 181 | kfree(dccp_optbuf); |
189 | - | |
190 | 182 | return ret; |
191 | 183 | } |
192 | 184 | |
193 | 185 | static void __exit xt_dccp_fini(void) |
194 | 186 | { |
195 | - xt_unregister_match(&dccp6_match); | |
196 | - xt_unregister_match(&dccp_match); | |
187 | + xt_unregister_matches(xt_dccp_match, ARRAY_SIZE(xt_dccp_match)); | |
197 | 188 | kfree(dccp_optbuf); |
198 | 189 | } |
199 | 190 |
net/netfilter/xt_dscp.c
... | ... | @@ -71,42 +71,33 @@ |
71 | 71 | return 1; |
72 | 72 | } |
73 | 73 | |
74 | -static struct xt_match dscp_match = { | |
75 | - .name = "dscp", | |
76 | - .match = match, | |
77 | - .checkentry = checkentry, | |
78 | - .matchsize = sizeof(struct xt_dscp_info), | |
79 | - .family = AF_INET, | |
80 | - .me = THIS_MODULE, | |
74 | +static struct xt_match xt_dscp_match[] = { | |
75 | + { | |
76 | + .name = "dscp", | |
77 | + .family = AF_INET, | |
78 | + .checkentry = checkentry, | |
79 | + .match = match, | |
80 | + .matchsize = sizeof(struct xt_dscp_info), | |
81 | + .me = THIS_MODULE, | |
82 | + }, | |
83 | + { | |
84 | + .name = "dscp", | |
85 | + .family = AF_INET6, | |
86 | + .checkentry = checkentry, | |
87 | + .match = match6, | |
88 | + .matchsize = sizeof(struct xt_dscp_info), | |
89 | + .me = THIS_MODULE, | |
90 | + }, | |
81 | 91 | }; |
82 | 92 | |
83 | -static struct xt_match dscp6_match = { | |
84 | - .name = "dscp", | |
85 | - .match = match6, | |
86 | - .checkentry = checkentry, | |
87 | - .matchsize = sizeof(struct xt_dscp_info), | |
88 | - .family = AF_INET6, | |
89 | - .me = THIS_MODULE, | |
90 | -}; | |
91 | - | |
92 | 93 | static int __init xt_dscp_match_init(void) |
93 | 94 | { |
94 | - int ret; | |
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; | |
95 | + return xt_register_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match)); | |
104 | 96 | } |
105 | 97 | |
106 | 98 | static void __exit xt_dscp_match_fini(void) |
107 | 99 | { |
108 | - xt_unregister_match(&dscp_match); | |
109 | - xt_unregister_match(&dscp6_match); | |
100 | + xt_unregister_matches(xt_dscp_match, ARRAY_SIZE(xt_dscp_match)); | |
110 | 101 | } |
111 | 102 | |
112 | 103 | module_init(xt_dscp_match_init); |
net/netfilter/xt_esp.c
... | ... | @@ -92,44 +92,35 @@ |
92 | 92 | return 1; |
93 | 93 | } |
94 | 94 | |
95 | -static struct xt_match esp_match = { | |
96 | - .name = "esp", | |
97 | - .family = AF_INET, | |
98 | - .proto = IPPROTO_ESP, | |
99 | - .match = &match, | |
100 | - .matchsize = sizeof(struct xt_esp), | |
101 | - .checkentry = &checkentry, | |
102 | - .me = THIS_MODULE, | |
95 | +static struct xt_match xt_esp_match[] = { | |
96 | + { | |
97 | + .name = "esp", | |
98 | + .family = AF_INET, | |
99 | + .checkentry = checkentry, | |
100 | + .match = match, | |
101 | + .matchsize = sizeof(struct xt_esp), | |
102 | + .proto = IPPROTO_ESP, | |
103 | + .me = THIS_MODULE, | |
104 | + }, | |
105 | + { | |
106 | + .name = "esp", | |
107 | + .family = AF_INET6, | |
108 | + .checkentry = checkentry, | |
109 | + .match = match, | |
110 | + .matchsize = sizeof(struct xt_esp), | |
111 | + .proto = IPPROTO_ESP, | |
112 | + .me = THIS_MODULE, | |
113 | + }, | |
103 | 114 | }; |
104 | 115 | |
105 | -static struct xt_match esp6_match = { | |
106 | - .name = "esp", | |
107 | - .family = AF_INET6, | |
108 | - .proto = IPPROTO_ESP, | |
109 | - .match = &match, | |
110 | - .matchsize = sizeof(struct xt_esp), | |
111 | - .checkentry = &checkentry, | |
112 | - .me = THIS_MODULE, | |
113 | -}; | |
114 | - | |
115 | 116 | static int __init xt_esp_init(void) |
116 | 117 | { |
117 | - int ret; | |
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; | |
118 | + return xt_register_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match)); | |
127 | 119 | } |
128 | 120 | |
129 | 121 | static void __exit xt_esp_cleanup(void) |
130 | 122 | { |
131 | - xt_unregister_match(&esp_match); | |
132 | - xt_unregister_match(&esp6_match); | |
123 | + xt_unregister_matches(xt_esp_match, ARRAY_SIZE(xt_esp_match)); | |
133 | 124 | } |
134 | 125 | |
135 | 126 | module_init(xt_esp_init); |
net/netfilter/xt_helper.c
... | ... | @@ -163,45 +163,37 @@ |
163 | 163 | #endif |
164 | 164 | } |
165 | 165 | |
166 | -static struct xt_match helper_match = { | |
167 | - .name = "helper", | |
168 | - .match = match, | |
169 | - .matchsize = sizeof(struct xt_helper_info), | |
170 | - .checkentry = check, | |
171 | - .destroy = destroy, | |
172 | - .family = AF_INET, | |
173 | - .me = THIS_MODULE, | |
166 | +static struct xt_match xt_helper_match[] = { | |
167 | + { | |
168 | + .name = "helper", | |
169 | + .family = AF_INET, | |
170 | + .checkentry = check, | |
171 | + .match = match, | |
172 | + .destroy = destroy, | |
173 | + .matchsize = sizeof(struct xt_helper_info), | |
174 | + .me = THIS_MODULE, | |
175 | + }, | |
176 | + { | |
177 | + .name = "helper", | |
178 | + .family = AF_INET6, | |
179 | + .checkentry = check, | |
180 | + .match = match, | |
181 | + .destroy = destroy, | |
182 | + .matchsize = sizeof(struct xt_helper_info), | |
183 | + .me = THIS_MODULE, | |
184 | + }, | |
174 | 185 | }; |
175 | -static struct xt_match helper6_match = { | |
176 | - .name = "helper", | |
177 | - .match = match, | |
178 | - .matchsize = sizeof(struct xt_helper_info), | |
179 | - .checkentry = check, | |
180 | - .destroy = destroy, | |
181 | - .family = AF_INET6, | |
182 | - .me = THIS_MODULE, | |
183 | -}; | |
184 | 186 | |
185 | 187 | static int __init xt_helper_init(void) |
186 | 188 | { |
187 | - int ret; | |
188 | 189 | need_conntrack(); |
189 | - | |
190 | - ret = xt_register_match(&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; | |
190 | + return xt_register_matches(xt_helper_match, | |
191 | + ARRAY_SIZE(xt_helper_match)); | |
199 | 192 | } |
200 | 193 | |
201 | 194 | static void __exit xt_helper_fini(void) |
202 | 195 | { |
203 | - xt_unregister_match(&helper_match); | |
204 | - xt_unregister_match(&helper6_match); | |
196 | + xt_unregister_matches(xt_helper_match, ARRAY_SIZE(xt_helper_match)); | |
205 | 197 | } |
206 | 198 | |
207 | 199 | module_init(xt_helper_init); |
net/netfilter/xt_length.c
... | ... | @@ -52,39 +52,32 @@ |
52 | 52 | return (pktlen >= info->min && pktlen <= info->max) ^ info->invert; |
53 | 53 | } |
54 | 54 | |
55 | -static struct xt_match length_match = { | |
56 | - .name = "length", | |
57 | - .match = match, | |
58 | - .matchsize = sizeof(struct xt_length_info), | |
59 | - .family = AF_INET, | |
60 | - .me = THIS_MODULE, | |
55 | +static struct xt_match xt_length_match[] = { | |
56 | + { | |
57 | + .name = "length", | |
58 | + .family = AF_INET, | |
59 | + .match = match, | |
60 | + .matchsize = sizeof(struct xt_length_info), | |
61 | + .me = THIS_MODULE, | |
62 | + }, | |
63 | + { | |
64 | + .name = "length", | |
65 | + .family = AF_INET6, | |
66 | + .match = match6, | |
67 | + .matchsize = sizeof(struct xt_length_info), | |
68 | + .me = THIS_MODULE, | |
69 | + }, | |
61 | 70 | }; |
62 | 71 | |
63 | -static struct xt_match length6_match = { | |
64 | - .name = "length", | |
65 | - .match = match6, | |
66 | - .matchsize = sizeof(struct xt_length_info), | |
67 | - .family = AF_INET6, | |
68 | - .me = THIS_MODULE, | |
69 | -}; | |
70 | - | |
71 | 72 | static int __init xt_length_init(void) |
72 | 73 | { |
73 | - int ret; | |
74 | - ret = xt_register_match(&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; | |
74 | + return xt_register_matches(xt_length_match, | |
75 | + ARRAY_SIZE(xt_length_match)); | |
82 | 76 | } |
83 | 77 | |
84 | 78 | static void __exit xt_length_fini(void) |
85 | 79 | { |
86 | - xt_unregister_match(&length_match); | |
87 | - xt_unregister_match(&length6_match); | |
80 | + xt_unregister_matches(xt_length_match, ARRAY_SIZE(xt_length_match)); | |
88 | 81 | } |
89 | 82 | |
90 | 83 | module_init(xt_length_init); |
net/netfilter/xt_limit.c
... | ... | @@ -136,42 +136,33 @@ |
136 | 136 | return 1; |
137 | 137 | } |
138 | 138 | |
139 | -static struct xt_match ipt_limit_reg = { | |
140 | - .name = "limit", | |
141 | - .match = ipt_limit_match, | |
142 | - .matchsize = sizeof(struct xt_rateinfo), | |
143 | - .checkentry = ipt_limit_checkentry, | |
144 | - .family = AF_INET, | |
145 | - .me = THIS_MODULE, | |
139 | +static struct xt_match xt_limit_match[] = { | |
140 | + { | |
141 | + .name = "limit", | |
142 | + .family = AF_INET, | |
143 | + .checkentry = ipt_limit_checkentry, | |
144 | + .match = ipt_limit_match, | |
145 | + .matchsize = sizeof(struct xt_rateinfo), | |
146 | + .me = THIS_MODULE, | |
147 | + }, | |
148 | + { | |
149 | + .name = "limit", | |
150 | + .family = AF_INET6, | |
151 | + .checkentry = ipt_limit_checkentry, | |
152 | + .match = ipt_limit_match, | |
153 | + .matchsize = sizeof(struct xt_rateinfo), | |
154 | + .me = THIS_MODULE, | |
155 | + }, | |
146 | 156 | }; |
147 | -static struct xt_match limit6_reg = { | |
148 | - .name = "limit", | |
149 | - .match = ipt_limit_match, | |
150 | - .matchsize = sizeof(struct xt_rateinfo), | |
151 | - .checkentry = ipt_limit_checkentry, | |
152 | - .family = AF_INET6, | |
153 | - .me = THIS_MODULE, | |
154 | -}; | |
155 | 157 | |
156 | 158 | static int __init xt_limit_init(void) |
157 | 159 | { |
158 | - int ret; | |
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; | |
160 | + return xt_register_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match)); | |
169 | 161 | } |
170 | 162 | |
171 | 163 | static void __exit xt_limit_fini(void) |
172 | 164 | { |
173 | - xt_unregister_match(&ipt_limit_reg); | |
174 | - xt_unregister_match(&limit6_reg); | |
165 | + xt_unregister_matches(xt_limit_match, ARRAY_SIZE(xt_limit_match)); | |
175 | 166 | } |
176 | 167 | |
177 | 168 | module_init(xt_limit_init); |
net/netfilter/xt_mac.c
... | ... | @@ -43,43 +43,37 @@ |
43 | 43 | ^ info->invert)); |
44 | 44 | } |
45 | 45 | |
46 | -static struct xt_match mac_match = { | |
47 | - .name = "mac", | |
48 | - .match = match, | |
49 | - .matchsize = sizeof(struct xt_mac_info), | |
50 | - .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN) | | |
51 | - (1 << NF_IP_FORWARD), | |
52 | - .family = AF_INET, | |
53 | - .me = THIS_MODULE, | |
46 | +static struct xt_match xt_mac_match[] = { | |
47 | + { | |
48 | + .name = "mac", | |
49 | + .family = AF_INET, | |
50 | + .match = match, | |
51 | + .matchsize = sizeof(struct xt_mac_info), | |
52 | + .hooks = (1 << NF_IP_PRE_ROUTING) | | |
53 | + (1 << NF_IP_LOCAL_IN) | | |
54 | + (1 << NF_IP_FORWARD), | |
55 | + .me = THIS_MODULE, | |
56 | + }, | |
57 | + { | |
58 | + .name = "mac", | |
59 | + .family = AF_INET6, | |
60 | + .match = match, | |
61 | + .matchsize = sizeof(struct xt_mac_info), | |
62 | + .hooks = (1 << NF_IP_PRE_ROUTING) | | |
63 | + (1 << NF_IP_LOCAL_IN) | | |
64 | + (1 << NF_IP_FORWARD), | |
65 | + .me = THIS_MODULE, | |
66 | + }, | |
54 | 67 | }; |
55 | -static struct xt_match mac6_match = { | |
56 | - .name = "mac", | |
57 | - .match = match, | |
58 | - .matchsize = sizeof(struct xt_mac_info), | |
59 | - .hooks = (1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN) | | |
60 | - (1 << NF_IP_FORWARD), | |
61 | - .family = AF_INET6, | |
62 | - .me = THIS_MODULE, | |
63 | -}; | |
64 | 68 | |
65 | 69 | static int __init xt_mac_init(void) |
66 | 70 | { |
67 | - int ret; | |
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; | |
71 | + return xt_register_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match)); | |
77 | 72 | } |
78 | 73 | |
79 | 74 | static void __exit xt_mac_fini(void) |
80 | 75 | { |
81 | - xt_unregister_match(&mac_match); | |
82 | - xt_unregister_match(&mac6_match); | |
76 | + xt_unregister_matches(xt_mac_match, ARRAY_SIZE(xt_mac_match)); | |
83 | 77 | } |
84 | 78 | |
85 | 79 | module_init(xt_mac_init); |
net/netfilter/xt_mark.c
... | ... | @@ -51,42 +51,33 @@ |
51 | 51 | return 1; |
52 | 52 | } |
53 | 53 | |
54 | -static struct xt_match mark_match = { | |
55 | - .name = "mark", | |
56 | - .match = match, | |
57 | - .matchsize = sizeof(struct xt_mark_info), | |
58 | - .checkentry = checkentry, | |
59 | - .family = AF_INET, | |
60 | - .me = THIS_MODULE, | |
54 | +static struct xt_match xt_mark_match[] = { | |
55 | + { | |
56 | + .name = "mark", | |
57 | + .family = AF_INET, | |
58 | + .checkentry = checkentry, | |
59 | + .match = match, | |
60 | + .matchsize = sizeof(struct xt_mark_info), | |
61 | + .me = THIS_MODULE, | |
62 | + }, | |
63 | + { | |
64 | + .name = "mark", | |
65 | + .family = AF_INET6, | |
66 | + .checkentry = checkentry, | |
67 | + .match = match, | |
68 | + .matchsize = sizeof(struct xt_mark_info), | |
69 | + .me = THIS_MODULE, | |
70 | + }, | |
61 | 71 | }; |
62 | 72 | |
63 | -static struct xt_match mark6_match = { | |
64 | - .name = "mark", | |
65 | - .match = match, | |
66 | - .matchsize = sizeof(struct xt_mark_info), | |
67 | - .checkentry = checkentry, | |
68 | - .family = AF_INET6, | |
69 | - .me = THIS_MODULE, | |
70 | -}; | |
71 | - | |
72 | 73 | static int __init xt_mark_init(void) |
73 | 74 | { |
74 | - int ret; | |
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; | |
75 | + return xt_register_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match)); | |
84 | 76 | } |
85 | 77 | |
86 | 78 | static void __exit xt_mark_fini(void) |
87 | 79 | { |
88 | - xt_unregister_match(&mark_match); | |
89 | - xt_unregister_match(&mark6_match); | |
80 | + xt_unregister_matches(xt_mark_match, ARRAY_SIZE(xt_mark_match)); | |
90 | 81 | } |
91 | 82 | |
92 | 83 | module_init(xt_mark_init); |
net/netfilter/xt_multiport.c
... | ... | @@ -231,84 +231,55 @@ |
231 | 231 | multiinfo->count); |
232 | 232 | } |
233 | 233 | |
234 | -static struct xt_match multiport_match = { | |
235 | - .name = "multiport", | |
236 | - .revision = 0, | |
237 | - .matchsize = sizeof(struct xt_multiport), | |
238 | - .match = &match, | |
239 | - .checkentry = &checkentry, | |
240 | - .family = AF_INET, | |
241 | - .me = THIS_MODULE, | |
234 | +static struct xt_match xt_multiport_match[] = { | |
235 | + { | |
236 | + .name = "multiport", | |
237 | + .family = AF_INET, | |
238 | + .revision = 0, | |
239 | + .checkentry = checkentry, | |
240 | + .match = match, | |
241 | + .matchsize = sizeof(struct xt_multiport), | |
242 | + .me = THIS_MODULE, | |
243 | + }, | |
244 | + { | |
245 | + .name = "multiport", | |
246 | + .family = AF_INET, | |
247 | + .revision = 1, | |
248 | + .checkentry = checkentry_v1, | |
249 | + .match = match_v1, | |
250 | + .matchsize = sizeof(struct xt_multiport_v1), | |
251 | + .me = THIS_MODULE, | |
252 | + }, | |
253 | + { | |
254 | + .name = "multiport", | |
255 | + .family = AF_INET6, | |
256 | + .revision = 0, | |
257 | + .checkentry = checkentry6, | |
258 | + .match = match, | |
259 | + .matchsize = sizeof(struct xt_multiport), | |
260 | + .me = THIS_MODULE, | |
261 | + }, | |
262 | + { | |
263 | + .name = "multiport", | |
264 | + .family = AF_INET6, | |
265 | + .revision = 1, | |
266 | + .checkentry = checkentry6_v1, | |
267 | + .match = match_v1, | |
268 | + .matchsize = sizeof(struct xt_multiport_v1), | |
269 | + .me = THIS_MODULE, | |
270 | + }, | |
242 | 271 | }; |
243 | 272 | |
244 | -static struct xt_match multiport_match_v1 = { | |
245 | - .name = "multiport", | |
246 | - .revision = 1, | |
247 | - .matchsize = sizeof(struct xt_multiport_v1), | |
248 | - .match = &match_v1, | |
249 | - .checkentry = &checkentry_v1, | |
250 | - .family = AF_INET, | |
251 | - .me = THIS_MODULE, | |
252 | -}; | |
253 | - | |
254 | -static struct xt_match multiport6_match = { | |
255 | - .name = "multiport", | |
256 | - .revision = 0, | |
257 | - .matchsize = sizeof(struct xt_multiport), | |
258 | - .match = &match, | |
259 | - .checkentry = &checkentry6, | |
260 | - .family = AF_INET6, | |
261 | - .me = THIS_MODULE, | |
262 | -}; | |
263 | - | |
264 | -static struct xt_match multiport6_match_v1 = { | |
265 | - .name = "multiport", | |
266 | - .revision = 1, | |
267 | - .matchsize = sizeof(struct xt_multiport_v1), | |
268 | - .match = &match_v1, | |
269 | - .checkentry = &checkentry6_v1, | |
270 | - .family = AF_INET6, | |
271 | - .me = THIS_MODULE, | |
272 | -}; | |
273 | - | |
274 | 273 | static int __init xt_multiport_init(void) |
275 | 274 | { |
276 | - int ret; | |
277 | - | |
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 | - | |
296 | -out_unreg_multi6_v0: | |
297 | - xt_unregister_match(&multiport6_match); | |
298 | -out_unreg_multi_v1: | |
299 | - xt_unregister_match(&multiport_match_v1); | |
300 | -out_unreg_multi_v0: | |
301 | - xt_unregister_match(&multiport_match); | |
302 | -out: | |
303 | - return ret; | |
275 | + return xt_register_matches(xt_multiport_match, | |
276 | + ARRAY_SIZE(xt_multiport_match)); | |
304 | 277 | } |
305 | 278 | |
306 | 279 | static void __exit xt_multiport_fini(void) |
307 | 280 | { |
308 | - xt_unregister_match(&multiport_match); | |
309 | - xt_unregister_match(&multiport_match_v1); | |
310 | - xt_unregister_match(&multiport6_match); | |
311 | - xt_unregister_match(&multiport6_match_v1); | |
281 | + xt_unregister_matches(xt_multiport_match, | |
282 | + ARRAY_SIZE(xt_multiport_match)); | |
312 | 283 | } |
313 | 284 | |
314 | 285 | module_init(xt_multiport_init); |
net/netfilter/xt_physdev.c
... | ... | @@ -132,43 +132,34 @@ |
132 | 132 | return 1; |
133 | 133 | } |
134 | 134 | |
135 | -static struct xt_match physdev_match = { | |
136 | - .name = "physdev", | |
137 | - .match = match, | |
138 | - .matchsize = sizeof(struct xt_physdev_info), | |
139 | - .checkentry = checkentry, | |
140 | - .family = AF_INET, | |
141 | - .me = THIS_MODULE, | |
135 | +static struct xt_match xt_physdev_match[] = { | |
136 | + { | |
137 | + .name = "physdev", | |
138 | + .family = AF_INET, | |
139 | + .checkentry = checkentry, | |
140 | + .match = match, | |
141 | + .matchsize = sizeof(struct xt_physdev_info), | |
142 | + .me = THIS_MODULE, | |
143 | + }, | |
144 | + { | |
145 | + .name = "physdev", | |
146 | + .family = AF_INET6, | |
147 | + .checkentry = checkentry, | |
148 | + .match = match, | |
149 | + .matchsize = sizeof(struct xt_physdev_info), | |
150 | + .me = THIS_MODULE, | |
151 | + }, | |
142 | 152 | }; |
143 | 153 | |
144 | -static struct xt_match physdev6_match = { | |
145 | - .name = "physdev", | |
146 | - .match = match, | |
147 | - .matchsize = sizeof(struct xt_physdev_info), | |
148 | - .checkentry = checkentry, | |
149 | - .family = AF_INET6, | |
150 | - .me = THIS_MODULE, | |
151 | -}; | |
152 | - | |
153 | 154 | static int __init xt_physdev_init(void) |
154 | 155 | { |
155 | - int ret; | |
156 | - | |
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; | |
156 | + return xt_register_matches(xt_physdev_match, | |
157 | + ARRAY_SIZE(xt_physdev_match)); | |
166 | 158 | } |
167 | 159 | |
168 | 160 | static void __exit xt_physdev_fini(void) |
169 | 161 | { |
170 | - xt_unregister_match(&physdev_match); | |
171 | - xt_unregister_match(&physdev6_match); | |
162 | + xt_unregister_matches(xt_physdev_match, ARRAY_SIZE(xt_physdev_match)); | |
172 | 163 | } |
173 | 164 | |
174 | 165 | module_init(xt_physdev_init); |
net/netfilter/xt_pkttype.c
... | ... | @@ -43,40 +43,32 @@ |
43 | 43 | return (type == info->pkttype) ^ info->invert; |
44 | 44 | } |
45 | 45 | |
46 | -static struct xt_match pkttype_match = { | |
47 | - .name = "pkttype", | |
48 | - .match = match, | |
49 | - .matchsize = sizeof(struct xt_pkttype_info), | |
50 | - .family = AF_INET, | |
51 | - .me = THIS_MODULE, | |
46 | +static struct xt_match xt_pkttype_match[] = { | |
47 | + { | |
48 | + .name = "pkttype", | |
49 | + .family = AF_INET, | |
50 | + .match = match, | |
51 | + .matchsize = sizeof(struct xt_pkttype_info), | |
52 | + .me = THIS_MODULE, | |
53 | + }, | |
54 | + { | |
55 | + .name = "pkttype", | |
56 | + .family = AF_INET6, | |
57 | + .match = match, | |
58 | + .matchsize = sizeof(struct xt_pkttype_info), | |
59 | + .me = THIS_MODULE, | |
60 | + }, | |
52 | 61 | }; |
53 | 62 | |
54 | -static struct xt_match pkttype6_match = { | |
55 | - .name = "pkttype", | |
56 | - .match = match, | |
57 | - .matchsize = sizeof(struct xt_pkttype_info), | |
58 | - .family = AF_INET6, | |
59 | - .me = THIS_MODULE, | |
60 | -}; | |
61 | - | |
62 | 63 | static int __init xt_pkttype_init(void) |
63 | 64 | { |
64 | - int ret; | |
65 | - ret = xt_register_match(&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; | |
65 | + return xt_register_matches(xt_pkttype_match, | |
66 | + ARRAY_SIZE(xt_pkttype_match)); | |
74 | 67 | } |
75 | 68 | |
76 | 69 | static void __exit xt_pkttype_fini(void) |
77 | 70 | { |
78 | - xt_unregister_match(&pkttype_match); | |
79 | - xt_unregister_match(&pkttype6_match); | |
71 | + xt_unregister_matches(xt_pkttype_match, ARRAY_SIZE(xt_pkttype_match)); | |
80 | 72 | } |
81 | 73 | |
82 | 74 | module_init(xt_pkttype_init); |
net/netfilter/xt_policy.c
... | ... | @@ -165,43 +165,36 @@ |
165 | 165 | return 1; |
166 | 166 | } |
167 | 167 | |
168 | -static struct xt_match policy_match = { | |
169 | - .name = "policy", | |
170 | - .family = AF_INET, | |
171 | - .match = match, | |
172 | - .matchsize = sizeof(struct xt_policy_info), | |
173 | - .checkentry = checkentry, | |
174 | - .family = AF_INET, | |
175 | - .me = THIS_MODULE, | |
168 | +static struct xt_match xt_policy_match[] = { | |
169 | + { | |
170 | + .name = "policy", | |
171 | + .family = AF_INET, | |
172 | + .checkentry = checkentry, | |
173 | + .match = match, | |
174 | + .matchsize = sizeof(struct xt_policy_info), | |
175 | + .family = AF_INET, | |
176 | + .me = THIS_MODULE, | |
177 | + }, | |
178 | + { | |
179 | + .name = "policy", | |
180 | + .family = AF_INET6, | |
181 | + .checkentry = checkentry, | |
182 | + .match = match, | |
183 | + .matchsize = sizeof(struct xt_policy_info), | |
184 | + .family = AF_INET6, | |
185 | + .me = THIS_MODULE, | |
186 | + }, | |
176 | 187 | }; |
177 | 188 | |
178 | -static struct xt_match policy6_match = { | |
179 | - .name = "policy", | |
180 | - .family = AF_INET6, | |
181 | - .match = match, | |
182 | - .matchsize = sizeof(struct xt_policy_info), | |
183 | - .checkentry = checkentry, | |
184 | - .family = AF_INET6, | |
185 | - .me = THIS_MODULE, | |
186 | -}; | |
187 | - | |
188 | 189 | static int __init init(void) |
189 | 190 | { |
190 | - int ret; | |
191 | - | |
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; | |
191 | + return xt_register_matches(xt_policy_match, | |
192 | + ARRAY_SIZE(xt_policy_match)); | |
199 | 193 | } |
200 | 194 | |
201 | 195 | static void __exit fini(void) |
202 | 196 | { |
203 | - xt_unregister_match(&policy6_match); | |
204 | - xt_unregister_match(&policy_match); | |
197 | + xt_unregister_matches(xt_policy_match, ARRAY_SIZE(xt_policy_match)); | |
205 | 198 | } |
206 | 199 | |
207 | 200 | module_init(init); |
net/netfilter/xt_quota.c
... | ... | @@ -52,46 +52,33 @@ |
52 | 52 | return 1; |
53 | 53 | } |
54 | 54 | |
55 | -static struct xt_match quota_match = { | |
56 | - .name = "quota", | |
57 | - .family = AF_INET, | |
58 | - .match = match, | |
59 | - .matchsize = sizeof(struct xt_quota_info), | |
60 | - .checkentry = checkentry, | |
61 | - .me = THIS_MODULE | |
55 | +static struct xt_match xt_quota_match[] = { | |
56 | + { | |
57 | + .name = "quota", | |
58 | + .family = AF_INET, | |
59 | + .checkentry = checkentry, | |
60 | + .match = match, | |
61 | + .matchsize = sizeof(struct xt_quota_info), | |
62 | + .me = THIS_MODULE | |
63 | + }, | |
64 | + { | |
65 | + .name = "quota", | |
66 | + .family = AF_INET6, | |
67 | + .checkentry = checkentry, | |
68 | + .match = match, | |
69 | + .matchsize = sizeof(struct xt_quota_info), | |
70 | + .me = THIS_MODULE | |
71 | + }, | |
62 | 72 | }; |
63 | 73 | |
64 | -static struct xt_match quota_match6 = { | |
65 | - .name = "quota", | |
66 | - .family = AF_INET6, | |
67 | - .match = match, | |
68 | - .matchsize = sizeof(struct xt_quota_info), | |
69 | - .checkentry = checkentry, | |
70 | - .me = THIS_MODULE | |
71 | -}; | |
72 | - | |
73 | 74 | static int __init xt_quota_init(void) |
74 | 75 | { |
75 | - int ret; | |
76 | - | |
77 | - ret = xt_register_match("a_match); | |
78 | - if (ret) | |
79 | - goto err1; | |
80 | - ret = xt_register_match("a_match6); | |
81 | - if (ret) | |
82 | - goto err2; | |
83 | - return ret; | |
84 | - | |
85 | -err2: | |
86 | - xt_unregister_match("a_match); | |
87 | -err1: | |
88 | - return ret; | |
76 | + return xt_register_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match)); | |
89 | 77 | } |
90 | 78 | |
91 | 79 | static void __exit xt_quota_fini(void) |
92 | 80 | { |
93 | - xt_unregister_match("a_match6); | |
94 | - xt_unregister_match("a_match); | |
81 | + xt_unregister_matches(xt_quota_match, ARRAY_SIZE(xt_quota_match)); | |
95 | 82 | } |
96 | 83 | |
97 | 84 | module_init(xt_quota_init); |
net/netfilter/xt_sctp.c
... | ... | @@ -178,44 +178,35 @@ |
178 | 178 | | SCTP_CHUNK_MATCH_ONLY))); |
179 | 179 | } |
180 | 180 | |
181 | -static struct xt_match sctp_match = { | |
182 | - .name = "sctp", | |
183 | - .match = match, | |
184 | - .matchsize = sizeof(struct xt_sctp_info), | |
185 | - .proto = IPPROTO_SCTP, | |
186 | - .checkentry = checkentry, | |
187 | - .family = AF_INET, | |
188 | - .me = THIS_MODULE | |
181 | +static struct xt_match xt_sctp_match[] = { | |
182 | + { | |
183 | + .name = "sctp", | |
184 | + .family = AF_INET, | |
185 | + .checkentry = checkentry, | |
186 | + .match = match, | |
187 | + .matchsize = sizeof(struct xt_sctp_info), | |
188 | + .proto = IPPROTO_SCTP, | |
189 | + .me = THIS_MODULE | |
190 | + }, | |
191 | + { | |
192 | + .name = "sctp", | |
193 | + .family = AF_INET6, | |
194 | + .checkentry = checkentry, | |
195 | + .match = match, | |
196 | + .matchsize = sizeof(struct xt_sctp_info), | |
197 | + .proto = IPPROTO_SCTP, | |
198 | + .me = THIS_MODULE | |
199 | + }, | |
189 | 200 | }; |
190 | 201 | |
191 | -static struct xt_match sctp6_match = { | |
192 | - .name = "sctp", | |
193 | - .match = match, | |
194 | - .matchsize = sizeof(struct xt_sctp_info), | |
195 | - .proto = IPPROTO_SCTP, | |
196 | - .checkentry = checkentry, | |
197 | - .family = AF_INET6, | |
198 | - .me = THIS_MODULE | |
199 | -}; | |
200 | - | |
201 | 202 | static int __init xt_sctp_init(void) |
202 | 203 | { |
203 | - int ret; | |
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; | |
204 | + return xt_register_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match)); | |
213 | 205 | } |
214 | 206 | |
215 | 207 | static void __exit xt_sctp_fini(void) |
216 | 208 | { |
217 | - xt_unregister_match(&sctp6_match); | |
218 | - xt_unregister_match(&sctp_match); | |
209 | + xt_unregister_matches(xt_sctp_match, ARRAY_SIZE(xt_sctp_match)); | |
219 | 210 | } |
220 | 211 | |
221 | 212 | module_init(xt_sctp_init); |
net/netfilter/xt_state.c
... | ... | @@ -69,47 +69,36 @@ |
69 | 69 | #endif |
70 | 70 | } |
71 | 71 | |
72 | -static struct xt_match state_match = { | |
73 | - .name = "state", | |
74 | - .match = match, | |
75 | - .checkentry = check, | |
76 | - .destroy = destroy, | |
77 | - .matchsize = sizeof(struct xt_state_info), | |
78 | - .family = AF_INET, | |
79 | - .me = THIS_MODULE, | |
72 | +static struct xt_match xt_state_match[] = { | |
73 | + { | |
74 | + .name = "state", | |
75 | + .family = AF_INET, | |
76 | + .checkentry = check, | |
77 | + .match = match, | |
78 | + .destroy = destroy, | |
79 | + .matchsize = sizeof(struct xt_state_info), | |
80 | + .me = THIS_MODULE, | |
81 | + }, | |
82 | + { | |
83 | + .name = "state", | |
84 | + .family = AF_INET6, | |
85 | + .checkentry = check, | |
86 | + .match = match, | |
87 | + .destroy = destroy, | |
88 | + .matchsize = sizeof(struct xt_state_info), | |
89 | + .me = THIS_MODULE, | |
90 | + }, | |
80 | 91 | }; |
81 | 92 | |
82 | -static struct xt_match state6_match = { | |
83 | - .name = "state", | |
84 | - .match = match, | |
85 | - .checkentry = check, | |
86 | - .destroy = destroy, | |
87 | - .matchsize = sizeof(struct xt_state_info), | |
88 | - .family = AF_INET6, | |
89 | - .me = THIS_MODULE, | |
90 | -}; | |
91 | - | |
92 | 93 | static int __init xt_state_init(void) |
93 | 94 | { |
94 | - int ret; | |
95 | - | |
96 | 95 | need_conntrack(); |
97 | - | |
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; | |
96 | + return xt_register_matches(xt_state_match, ARRAY_SIZE(xt_state_match)); | |
107 | 97 | } |
108 | 98 | |
109 | 99 | static void __exit xt_state_fini(void) |
110 | 100 | { |
111 | - xt_unregister_match(&state_match); | |
112 | - xt_unregister_match(&state6_match); | |
101 | + xt_unregister_matches(xt_state_match, ARRAY_SIZE(xt_state_match)); | |
113 | 102 | } |
114 | 103 | |
115 | 104 | module_init(xt_state_init); |
net/netfilter/xt_statistic.c
... | ... | @@ -66,46 +66,35 @@ |
66 | 66 | return 1; |
67 | 67 | } |
68 | 68 | |
69 | -static struct xt_match statistic_match = { | |
70 | - .name = "statistic", | |
71 | - .match = match, | |
72 | - .matchsize = sizeof(struct xt_statistic_info), | |
73 | - .checkentry = checkentry, | |
74 | - .family = AF_INET, | |
75 | - .me = THIS_MODULE, | |
69 | +static struct xt_match xt_statistic_match[] = { | |
70 | + { | |
71 | + .name = "statistic", | |
72 | + .family = AF_INET, | |
73 | + .checkentry = checkentry, | |
74 | + .match = match, | |
75 | + .matchsize = sizeof(struct xt_statistic_info), | |
76 | + .me = THIS_MODULE, | |
77 | + }, | |
78 | + { | |
79 | + .name = "statistic", | |
80 | + .family = AF_INET6, | |
81 | + .checkentry = checkentry, | |
82 | + .match = match, | |
83 | + .matchsize = sizeof(struct xt_statistic_info), | |
84 | + .me = THIS_MODULE, | |
85 | + }, | |
76 | 86 | }; |
77 | 87 | |
78 | -static struct xt_match statistic_match6 = { | |
79 | - .name = "statistic", | |
80 | - .match = match, | |
81 | - .matchsize = sizeof(struct xt_statistic_info), | |
82 | - .checkentry = checkentry, | |
83 | - .family = AF_INET6, | |
84 | - .me = THIS_MODULE, | |
85 | -}; | |
86 | - | |
87 | 88 | static int __init xt_statistic_init(void) |
88 | 89 | { |
89 | - int ret; | |
90 | - | |
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; | |
99 | -err2: | |
100 | - xt_unregister_match(&statistic_match); | |
101 | -err1: | |
102 | - return ret; | |
90 | + return xt_register_matches(xt_statistic_match, | |
91 | + ARRAY_SIZE(xt_statistic_match)); | |
103 | 92 | } |
104 | 93 | |
105 | 94 | static void __exit xt_statistic_fini(void) |
106 | 95 | { |
107 | - xt_unregister_match(&statistic_match6); | |
108 | - xt_unregister_match(&statistic_match); | |
96 | + xt_unregister_matches(xt_statistic_match, | |
97 | + ARRAY_SIZE(xt_statistic_match)); | |
109 | 98 | } |
110 | 99 | |
111 | 100 | module_init(xt_statistic_init); |
net/netfilter/xt_string.c
... | ... | @@ -75,43 +75,35 @@ |
75 | 75 | textsearch_destroy(STRING_TEXT_PRIV(matchinfo)->config); |
76 | 76 | } |
77 | 77 | |
78 | -static struct xt_match string_match = { | |
79 | - .name = "string", | |
80 | - .match = match, | |
81 | - .matchsize = sizeof(struct xt_string_info), | |
82 | - .checkentry = checkentry, | |
83 | - .destroy = destroy, | |
84 | - .family = AF_INET, | |
85 | - .me = THIS_MODULE | |
78 | +static struct xt_match xt_string_match[] = { | |
79 | + { | |
80 | + .name = "string", | |
81 | + .family = AF_INET, | |
82 | + .checkentry = checkentry, | |
83 | + .match = match, | |
84 | + .destroy = destroy, | |
85 | + .matchsize = sizeof(struct xt_string_info), | |
86 | + .me = THIS_MODULE | |
87 | + }, | |
88 | + { | |
89 | + .name = "string", | |
90 | + .family = AF_INET6, | |
91 | + .checkentry = checkentry, | |
92 | + .match = match, | |
93 | + .destroy = destroy, | |
94 | + .matchsize = sizeof(struct xt_string_info), | |
95 | + .me = THIS_MODULE | |
96 | + }, | |
86 | 97 | }; |
87 | -static struct xt_match string6_match = { | |
88 | - .name = "string", | |
89 | - .match = match, | |
90 | - .matchsize = sizeof(struct xt_string_info), | |
91 | - .checkentry = checkentry, | |
92 | - .destroy = destroy, | |
93 | - .family = AF_INET6, | |
94 | - .me = THIS_MODULE | |
95 | -}; | |
96 | 98 | |
97 | 99 | static int __init xt_string_init(void) |
98 | 100 | { |
99 | - int ret; | |
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; | |
101 | + return xt_register_matches(xt_string_match, ARRAY_SIZE(xt_string_match)); | |
109 | 102 | } |
110 | 103 | |
111 | 104 | static void __exit xt_string_fini(void) |
112 | 105 | { |
113 | - xt_unregister_match(&string_match); | |
114 | - xt_unregister_match(&string6_match); | |
106 | + xt_unregister_matches(xt_string_match, ARRAY_SIZE(xt_string_match)); | |
115 | 107 | } |
116 | 108 | |
117 | 109 | module_init(xt_string_init); |
net/netfilter/xt_tcpmss.c
... | ... | @@ -93,43 +93,34 @@ |
93 | 93 | info->invert, hotdrop); |
94 | 94 | } |
95 | 95 | |
96 | -static struct xt_match tcpmss_match = { | |
97 | - .name = "tcpmss", | |
98 | - .match = match, | |
99 | - .matchsize = sizeof(struct xt_tcpmss_match_info), | |
100 | - .proto = IPPROTO_TCP, | |
101 | - .family = AF_INET, | |
102 | - .me = THIS_MODULE, | |
96 | +static struct xt_match xt_tcpmss_match[] = { | |
97 | + { | |
98 | + .name = "tcpmss", | |
99 | + .family = AF_INET, | |
100 | + .match = match, | |
101 | + .matchsize = sizeof(struct xt_tcpmss_match_info), | |
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 | |
105 | -static 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 | - | |
115 | 115 | static int __init xt_tcpmss_init(void) |
116 | 116 | { |
117 | - int ret; | |
118 | - ret = xt_register_match(&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; | |
117 | + return xt_register_matches(xt_tcpmss_match, | |
118 | + ARRAY_SIZE(xt_tcpmss_match)); | |
127 | 119 | } |
128 | 120 | |
129 | 121 | static void __exit xt_tcpmss_fini(void) |
130 | 122 | { |
131 | - xt_unregister_match(&tcpmss6_match); | |
132 | - xt_unregister_match(&tcpmss_match); | |
123 | + xt_unregister_matches(xt_tcpmss_match, ARRAY_SIZE(xt_tcpmss_match)); | |
133 | 124 | } |
134 | 125 | |
135 | 126 | module_init(xt_tcpmss_init); |
net/netfilter/xt_tcpudp.c
... | ... | @@ -199,81 +199,54 @@ |
199 | 199 | return !(udpinfo->invflags & ~XT_UDP_INV_MASK); |
200 | 200 | } |
201 | 201 | |
202 | -static struct xt_match tcp_matchstruct = { | |
203 | - .name = "tcp", | |
204 | - .match = tcp_match, | |
205 | - .matchsize = sizeof(struct xt_tcp), | |
206 | - .proto = IPPROTO_TCP, | |
207 | - .family = AF_INET, | |
208 | - .checkentry = tcp_checkentry, | |
209 | - .me = THIS_MODULE, | |
202 | +static struct xt_match xt_tcpudp_match[] = { | |
203 | + { | |
204 | + .name = "tcp", | |
205 | + .family = AF_INET, | |
206 | + .checkentry = tcp_checkentry, | |
207 | + .match = tcp_match, | |
208 | + .matchsize = sizeof(struct xt_tcp), | |
209 | + .proto = IPPROTO_TCP, | |
210 | + .me = THIS_MODULE, | |
211 | + }, | |
212 | + { | |
213 | + .name = "tcp", | |
214 | + .family = AF_INET6, | |
215 | + .checkentry = tcp_checkentry, | |
216 | + .match = tcp_match, | |
217 | + .matchsize = sizeof(struct xt_tcp), | |
218 | + .proto = IPPROTO_TCP, | |
219 | + .me = THIS_MODULE, | |
220 | + }, | |
221 | + { | |
222 | + .name = "udp", | |
223 | + .family = AF_INET, | |
224 | + .checkentry = udp_checkentry, | |
225 | + .match = udp_match, | |
226 | + .matchsize = sizeof(struct xt_udp), | |
227 | + .proto = IPPROTO_UDP, | |
228 | + .me = THIS_MODULE, | |
229 | + }, | |
230 | + { | |
231 | + .name = "udp", | |
232 | + .family = AF_INET6, | |
233 | + .checkentry = udp_checkentry, | |
234 | + .match = udp_match, | |
235 | + .matchsize = sizeof(struct xt_udp), | |
236 | + .proto = IPPROTO_UDP, | |
237 | + .me = THIS_MODULE, | |
238 | + }, | |
210 | 239 | }; |
211 | 240 | |
212 | -static struct xt_match tcp6_matchstruct = { | |
213 | - .name = "tcp", | |
214 | - .match = tcp_match, | |
215 | - .matchsize = sizeof(struct xt_tcp), | |
216 | - .proto = IPPROTO_TCP, | |
217 | - .family = AF_INET6, | |
218 | - .checkentry = tcp_checkentry, | |
219 | - .me = THIS_MODULE, | |
220 | -}; | |
221 | - | |
222 | -static struct xt_match udp_matchstruct = { | |
223 | - .name = "udp", | |
224 | - .match = udp_match, | |
225 | - .matchsize = sizeof(struct xt_udp), | |
226 | - .proto = IPPROTO_UDP, | |
227 | - .family = AF_INET, | |
228 | - .checkentry = udp_checkentry, | |
229 | - .me = THIS_MODULE, | |
230 | -}; | |
231 | -static struct xt_match udp6_matchstruct = { | |
232 | - .name = "udp", | |
233 | - .match = udp_match, | |
234 | - .matchsize = sizeof(struct xt_udp), | |
235 | - .proto = IPPROTO_UDP, | |
236 | - .family = AF_INET6, | |
237 | - .checkentry = udp_checkentry, | |
238 | - .me = THIS_MODULE, | |
239 | -}; | |
240 | - | |
241 | 241 | static int __init xt_tcpudp_init(void) |
242 | 242 | { |
243 | - int ret; | |
244 | - ret = xt_register_match(&tcp_matchstruct); | |
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 | - | |
262 | -out_unreg_udp: | |
263 | - xt_unregister_match(&udp_matchstruct); | |
264 | -out_unreg_tcp6: | |
265 | - xt_unregister_match(&tcp6_matchstruct); | |
266 | -out_unreg_tcp: | |
267 | - xt_unregister_match(&tcp_matchstruct); | |
268 | - return ret; | |
243 | + return xt_register_matches(xt_tcpudp_match, | |
244 | + ARRAY_SIZE(xt_tcpudp_match)); | |
269 | 245 | } |
270 | 246 | |
271 | 247 | static void __exit xt_tcpudp_fini(void) |
272 | 248 | { |
273 | - xt_unregister_match(&udp6_matchstruct); | |
274 | - xt_unregister_match(&udp_matchstruct); | |
275 | - xt_unregister_match(&tcp6_matchstruct); | |
276 | - xt_unregister_match(&tcp_matchstruct); | |
249 | + xt_unregister_matches(xt_tcpudp_match, ARRAY_SIZE(xt_tcpudp_match)); | |
277 | 250 | } |
278 | 251 | |
279 | 252 | module_init(xt_tcpudp_init); |