blob: de079cbfdcab553525644755d5759c66f1291f54 [file] [log] [blame]
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +00001/* Shared library add-on to iptables to add IP range matching support. */
2#include <stdio.h>
3#include <netdb.h>
4#include <string.h>
5#include <stdlib.h>
6#include <getopt.h>
7
Thomas Jarosch240eee62008-10-23 15:40:52 +02008#include <netinet/in.h>
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +00009#include <xtables.h>
10#include <linux/netfilter.h>
11#include <linux/netfilter/xt_iprange.h>
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000012#include <linux/netfilter_ipv4/ipt_iprange.h>
13
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +000014enum {
15 F_SRCIP = 1 << 0,
16 F_DSTIP = 1 << 1,
17};
18
Jan Engelhardt41daaa02008-01-20 13:42:43 +000019static void iprange_mt_help(void)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000020{
21 printf(
Jan Engelhardt41daaa02008-01-20 13:42:43 +000022"iprange match options:\n"
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000023"[!] --src-range ip-ip Match source IP in the specified range\n"
Jan Engelhardt8b7c64d2008-04-15 11:48:25 +020024"[!] --dst-range ip-ip Match destination IP in the specified range\n");
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000025}
26
Jan Engelhardt41daaa02008-01-20 13:42:43 +000027static const struct option iprange_mt_opts[] = {
28 {.name = "src-range", .has_arg = true, .val = '1'},
29 {.name = "dst-range", .has_arg = true, .val = '2'},
Max Kellermann9ee386a2008-01-29 13:48:05 +000030 { .name = NULL }
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000031};
32
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000033static void
34parse_iprange(char *arg, struct ipt_iprange *range)
35{
36 char *dash;
Jan Engelhardtbd943842008-01-20 13:38:08 +000037 const struct in_addr *ip;
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000038
39 dash = strchr(arg, '-');
Jan Engelhardt41daaa02008-01-20 13:42:43 +000040 if (dash != NULL)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000041 *dash = '\0';
Jan Engelhardt41daaa02008-01-20 13:42:43 +000042
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +010043 ip = xtables_numeric_to_ipaddr(arg);
James Kingdbe6c3b2008-04-01 21:17:36 +020044 if (!ip)
Jan Engelhardt41daaa02008-01-20 13:42:43 +000045 exit_error(PARAMETER_PROBLEM, "iprange match: Bad IP address `%s'\n",
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000046 arg);
47 range->min_ip = ip->s_addr;
48
Jan Engelhardt41daaa02008-01-20 13:42:43 +000049 if (dash != NULL) {
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +010050 ip = xtables_numeric_to_ipaddr(dash+1);
James Kingdbe6c3b2008-04-01 21:17:36 +020051 if (!ip)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000052 exit_error(PARAMETER_PROBLEM, "iprange match: Bad IP address `%s'\n",
53 dash+1);
54 range->max_ip = ip->s_addr;
Jan Engelhardt41daaa02008-01-20 13:42:43 +000055 } else {
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000056 range->max_ip = range->min_ip;
Jan Engelhardt41daaa02008-01-20 13:42:43 +000057 }
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000058}
59
Jan Engelhardt59d16402007-10-04 16:28:39 +000060static int iprange_parse(int c, char **argv, int invert, unsigned int *flags,
61 const void *entry, struct xt_entry_match **match)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000062{
63 struct ipt_iprange_info *info = (struct ipt_iprange_info *)(*match)->data;
64
65 switch (c) {
66 case '1':
67 if (*flags & IPRANGE_SRC)
68 exit_error(PARAMETER_PROBLEM,
69 "iprange match: Only use --src-range ONCE!");
70 *flags |= IPRANGE_SRC;
71
72 info->flags |= IPRANGE_SRC;
73 check_inverse(optarg, &invert, &optind, 0);
Jan Engelhardt41daaa02008-01-20 13:42:43 +000074 if (invert)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000075 info->flags |= IPRANGE_SRC_INV;
Jan Engelhardt41daaa02008-01-20 13:42:43 +000076 parse_iprange(optarg, &info->src);
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000077
78 break;
79
80 case '2':
81 if (*flags & IPRANGE_DST)
82 exit_error(PARAMETER_PROBLEM,
83 "iprange match: Only use --dst-range ONCE!");
84 *flags |= IPRANGE_DST;
85
86 info->flags |= IPRANGE_DST;
87 check_inverse(optarg, &invert, &optind, 0);
88 if (invert)
89 info->flags |= IPRANGE_DST_INV;
90
Jan Engelhardt41daaa02008-01-20 13:42:43 +000091 parse_iprange(optarg, &info->dst);
Nicolas Boulianeb9c6ec12004-07-12 07:16:54 +000092
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +000093 break;
94
95 default:
96 return 0;
97 }
98 return 1;
99}
100
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000101static int
102iprange_mt4_parse(int c, char **argv, int invert, unsigned int *flags,
103 const void *entry, struct xt_entry_match **match)
104{
105 struct xt_iprange_mtinfo *info = (void *)(*match)->data;
106 const struct in_addr *ia;
107 char *end;
108
109 switch (c) {
Jan Engelhardtbfb7e0b2008-09-01 14:19:03 +0200110 case '1': /* --src-range */
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000111 end = strchr(optarg, '-');
112 if (end == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100113 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000114 *end = '\0';
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100115 ia = xtables_numeric_to_ipaddr(optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000116 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100117 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000118 memcpy(&info->src_min.in, ia, sizeof(*ia));
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100119 ia = xtables_numeric_to_ipaddr(end+1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000120 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100121 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000122 memcpy(&info->src_max.in, ia, sizeof(*ia));
Jan Engelhardt6a0cd582008-06-13 17:59:29 +0200123 info->flags |= IPRANGE_SRC;
124 if (invert)
125 info->flags |= IPRANGE_SRC_INV;
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000126 *flags |= F_SRCIP;
127 return true;
128
Jan Engelhardtbfb7e0b2008-09-01 14:19:03 +0200129 case '2': /* --dst-range */
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000130 end = strchr(optarg, '-');
131 if (end == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100132 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000133 *end = '\0';
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100134 ia = xtables_numeric_to_ipaddr(optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000135 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100136 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000137 memcpy(&info->dst_min.in, ia, sizeof(*ia));
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100138 ia = xtables_numeric_to_ipaddr(end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000139 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100140 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000141 memcpy(&info->dst_max.in, ia, sizeof(*ia));
Jan Engelhardt6a0cd582008-06-13 17:59:29 +0200142 info->flags |= IPRANGE_DST;
143 if (invert)
144 info->flags |= IPRANGE_DST_INV;
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000145 *flags |= F_DSTIP;
146 return true;
147 }
148 return false;
149}
150
151static int
152iprange_mt6_parse(int c, char **argv, int invert, unsigned int *flags,
153 const void *entry, struct xt_entry_match **match)
154{
155 struct xt_iprange_mtinfo *info = (void *)(*match)->data;
156 const struct in6_addr *ia;
157 char *end;
158
159 switch (c) {
Jan Engelhardtbfb7e0b2008-09-01 14:19:03 +0200160 case '1': /* --src-range */
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000161 end = strchr(optarg, '-');
162 if (end == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100163 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000164 *end = '\0';
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100165 ia = xtables_numeric_to_ip6addr(optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000166 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100167 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000168 memcpy(&info->src_min.in, ia, sizeof(*ia));
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100169 ia = xtables_numeric_to_ip6addr(end+1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000170 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100171 xtables_param_act(XTF_BAD_VALUE, "iprange", "--src-range", end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000172 memcpy(&info->src_max.in, ia, sizeof(*ia));
173 info->flags |= IPRANGE_SRC;
174 if (invert)
175 info->flags |= IPRANGE_SRC_INV;
176 *flags |= F_SRCIP;
177 return true;
178
Jan Engelhardtbfb7e0b2008-09-01 14:19:03 +0200179 case '2': /* --dst-range */
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000180 end = strchr(optarg, '-');
181 if (end == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100182 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000183 *end = '\0';
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100184 ia = xtables_numeric_to_ip6addr(optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000185 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100186 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", optarg);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000187 memcpy(&info->dst_min.in, ia, sizeof(*ia));
Jan Engelhardt1e01b0b2009-01-30 04:20:32 +0100188 ia = xtables_numeric_to_ip6addr(end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000189 if (ia == NULL)
Jan Engelhardta41545c2009-01-27 21:27:19 +0100190 xtables_param_act(XTF_BAD_VALUE, "iprange", "--dst-range", end + 1);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000191 memcpy(&info->dst_max.in, ia, sizeof(*ia));
192 info->flags |= IPRANGE_DST;
193 if (invert)
194 info->flags |= IPRANGE_DST_INV;
195 *flags |= F_DSTIP;
196 return true;
197 }
198 return false;
199}
200
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000201static void iprange_mt_check(unsigned int flags)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000202{
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000203 if (flags == 0)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000204 exit_error(PARAMETER_PROBLEM,
205 "iprange match: You must specify `--src-range' or `--dst-range'");
206}
207
208static void
209print_iprange(const struct ipt_iprange *range)
210{
211 const unsigned char *byte_min, *byte_max;
212
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000213 byte_min = (const unsigned char *)&range->min_ip;
214 byte_max = (const unsigned char *)&range->max_ip;
215 printf("%u.%u.%u.%u-%u.%u.%u.%u ",
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000216 byte_min[0], byte_min[1], byte_min[2], byte_min[3],
217 byte_max[0], byte_max[1], byte_max[2], byte_max[3]);
218}
219
Jan Engelhardt59d16402007-10-04 16:28:39 +0000220static void iprange_print(const void *ip, const struct xt_entry_match *match,
221 int numeric)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000222{
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000223 const struct ipt_iprange_info *info = (const void *)match->data;
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000224
225 if (info->flags & IPRANGE_SRC) {
226 printf("source IP range ");
227 if (info->flags & IPRANGE_SRC_INV)
228 printf("! ");
229 print_iprange(&info->src);
230 }
231 if (info->flags & IPRANGE_DST) {
232 printf("destination IP range ");
233 if (info->flags & IPRANGE_DST_INV)
234 printf("! ");
235 print_iprange(&info->dst);
236 }
237}
238
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000239static void
240iprange_mt4_print(const void *ip, const struct xt_entry_match *match,
241 int numeric)
242{
243 const struct xt_iprange_mtinfo *info = (const void *)match->data;
244
245 if (info->flags & IPRANGE_SRC) {
246 printf("source IP range ");
247 if (info->flags & IPRANGE_SRC_INV)
248 printf("! ");
249 /*
250 * ipaddr_to_numeric() uses a static buffer, so cannot
251 * combine the printf() calls.
252 */
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100253 printf("%s", xtables_ipaddr_to_numeric(&info->src_min.in));
254 printf("-%s ", xtables_ipaddr_to_numeric(&info->src_max.in));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000255 }
256 if (info->flags & IPRANGE_DST) {
257 printf("destination IP range ");
258 if (info->flags & IPRANGE_DST_INV)
259 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100260 printf("%s", xtables_ipaddr_to_numeric(&info->dst_min.in));
261 printf("-%s ", xtables_ipaddr_to_numeric(&info->dst_max.in));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000262 }
263}
264
265static void
266iprange_mt6_print(const void *ip, const struct xt_entry_match *match,
267 int numeric)
268{
269 const struct xt_iprange_mtinfo *info = (const void *)match->data;
270
271 if (info->flags & IPRANGE_SRC) {
272 printf("source IP range ");
273 if (info->flags & IPRANGE_SRC_INV)
274 printf("! ");
275 /*
276 * ipaddr_to_numeric() uses a static buffer, so cannot
277 * combine the printf() calls.
278 */
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100279 printf("%s", xtables_ip6addr_to_numeric(&info->src_min.in6));
280 printf("-%s ", xtables_ip6addr_to_numeric(&info->src_max.in6));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000281 }
282 if (info->flags & IPRANGE_DST) {
283 printf("destination IP range ");
284 if (info->flags & IPRANGE_DST_INV)
285 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100286 printf("%s", xtables_ip6addr_to_numeric(&info->dst_min.in6));
287 printf("-%s ", xtables_ip6addr_to_numeric(&info->dst_max.in6));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000288 }
289}
290
Jan Engelhardt59d16402007-10-04 16:28:39 +0000291static void iprange_save(const void *ip, const struct xt_entry_match *match)
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000292{
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000293 const struct ipt_iprange_info *info = (const void *)match->data;
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000294
295 if (info->flags & IPRANGE_SRC) {
296 if (info->flags & IPRANGE_SRC_INV)
297 printf("! ");
298 printf("--src-range ");
299 print_iprange(&info->src);
300 if (info->flags & IPRANGE_DST)
301 fputc(' ', stdout);
302 }
303 if (info->flags & IPRANGE_DST) {
304 if (info->flags & IPRANGE_DST_INV)
305 printf("! ");
306 printf("--dst-range ");
307 print_iprange(&info->dst);
308 }
309}
310
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000311static void iprange_mt4_save(const void *ip, const struct xt_entry_match *match)
312{
313 const struct xt_iprange_mtinfo *info = (const void *)match->data;
314
315 if (info->flags & IPRANGE_SRC) {
316 if (info->flags & IPRANGE_SRC_INV)
317 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100318 printf("--src-range %s", xtables_ipaddr_to_numeric(&info->src_min.in));
319 printf("-%s ", xtables_ipaddr_to_numeric(&info->src_max.in));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000320 }
321 if (info->flags & IPRANGE_DST) {
322 if (info->flags & IPRANGE_DST_INV)
323 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100324 printf("--dst-range %s", xtables_ipaddr_to_numeric(&info->dst_min.in));
325 printf("-%s ", xtables_ipaddr_to_numeric(&info->dst_max.in));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000326 }
327}
328
329static void iprange_mt6_save(const void *ip, const struct xt_entry_match *match)
330{
331 const struct xt_iprange_mtinfo *info = (const void *)match->data;
332
333 if (info->flags & IPRANGE_SRC) {
334 if (info->flags & IPRANGE_SRC_INV)
335 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100336 printf("--src-range %s", xtables_ip6addr_to_numeric(&info->src_min.in6));
337 printf("-%s ", xtables_ip6addr_to_numeric(&info->src_max.in6));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000338 }
339 if (info->flags & IPRANGE_DST) {
340 if (info->flags & IPRANGE_DST_INV)
341 printf("! ");
Jan Engelhardte44ea7f2009-01-30 03:55:09 +0100342 printf("--dst-range %s", xtables_ip6addr_to_numeric(&info->dst_min.in6));
343 printf("-%s ", xtables_ip6addr_to_numeric(&info->dst_max.in6));
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000344 }
345}
346
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000347static struct xtables_match iprange_match = {
Jan Engelhardt8b7c64d2008-04-15 11:48:25 +0200348 .version = XTABLES_VERSION,
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000349 .name = "iprange",
350 .revision = 0,
Jan Engelhardt03d99482008-11-18 12:27:54 +0100351 .family = NFPROTO_IPV4,
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000352 .size = XT_ALIGN(sizeof(struct ipt_iprange_info)),
353 .userspacesize = XT_ALIGN(sizeof(struct ipt_iprange_info)),
354 .help = iprange_mt_help,
355 .parse = iprange_parse,
356 .final_check = iprange_mt_check,
357 .print = iprange_print,
358 .save = iprange_save,
359 .extra_opts = iprange_mt_opts,
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000360};
361
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000362static struct xtables_match iprange_mt_reg = {
Jan Engelhardt8b7c64d2008-04-15 11:48:25 +0200363 .version = XTABLES_VERSION,
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000364 .name = "iprange",
365 .revision = 1,
Jan Engelhardt03d99482008-11-18 12:27:54 +0100366 .family = NFPROTO_IPV4,
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000367 .size = XT_ALIGN(sizeof(struct xt_iprange_mtinfo)),
368 .userspacesize = XT_ALIGN(sizeof(struct xt_iprange_mtinfo)),
369 .help = iprange_mt_help,
370 .parse = iprange_mt4_parse,
371 .final_check = iprange_mt_check,
372 .print = iprange_mt4_print,
373 .save = iprange_mt4_save,
374 .extra_opts = iprange_mt_opts,
375};
376
377static struct xtables_match iprange_mt6_reg = {
Jan Engelhardt8b7c64d2008-04-15 11:48:25 +0200378 .version = XTABLES_VERSION,
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000379 .name = "iprange",
380 .revision = 1,
Jan Engelhardt03d99482008-11-18 12:27:54 +0100381 .family = NFPROTO_IPV6,
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000382 .size = XT_ALIGN(sizeof(struct xt_iprange_mtinfo)),
383 .userspacesize = XT_ALIGN(sizeof(struct xt_iprange_mtinfo)),
384 .help = iprange_mt_help,
385 .parse = iprange_mt6_parse,
386 .final_check = iprange_mt_check,
387 .print = iprange_mt6_print,
388 .save = iprange_mt6_save,
389 .extra_opts = iprange_mt_opts,
390};
391
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000392void _init(void)
393{
Jan Engelhardt41daaa02008-01-20 13:42:43 +0000394 xtables_register_match(&iprange_match);
Jan Engelhardtfc11b0b2008-01-20 13:43:49 +0000395 xtables_register_match(&iprange_mt_reg);
396 xtables_register_match(&iprange_mt6_reg);
Joszef Kadlecsik9cb66152003-04-23 13:27:09 +0000397}