blob: fe5190789e306e65c0a8b54918fb89c59b8da500 [file] [log] [blame]
Harald Weltedaa1ef32005-07-19 21:44:58 +00001/* Shared library add-on to iptables for NFQ
2 *
3 * (C) 2005 by Harald Welte <laforge@netfilter.org>
4 *
5 * This program is distributed under the terms of GNU GPL v2, 1991
6 *
7 */
8#include <stdio.h>
Yasuyuki KOZAKAIa2e89cc2007-07-24 07:29:36 +00009#include <xtables.h>
Yasuyuki KOZAKAIa2e89cc2007-07-24 07:29:36 +000010#include <linux/netfilter/xt_NFQUEUE.h>
Harald Weltedaa1ef32005-07-19 21:44:58 +000011
Jan Engelhardt478be252011-03-06 17:54:50 +010012enum {
13 O_QUEUE_NUM = 0,
14 O_QUEUE_BALANCE,
15 O_QUEUE_BYPASS,
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000016 O_QUEUE_CPU_FANOUT,
Jan Engelhardtd8784612011-05-25 00:26:01 +020017 F_QUEUE_NUM = 1 << O_QUEUE_NUM,
18 F_QUEUE_BALANCE = 1 << O_QUEUE_BALANCE,
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000019 F_QUEUE_CPU_FANOUT = 1 << O_QUEUE_CPU_FANOUT,
Jan Engelhardt478be252011-03-06 17:54:50 +010020};
21
Jan Engelhardt932e6482007-10-04 16:27:30 +000022static void NFQUEUE_help(void)
Harald Weltedaa1ef32005-07-19 21:44:58 +000023{
24 printf(
25"NFQUEUE target options\n"
26" --queue-num value Send packet to QUEUE number <value>.\n"
27" Valid queue numbers are 0-65535\n"
28);
29}
30
Florian Westphal4282d892009-08-20 16:39:05 +020031static void NFQUEUE_help_v1(void)
32{
Florian Westphal4282d892009-08-20 16:39:05 +020033 printf(
Shivani Bhardwajd998de72016-04-14 20:56:49 +053034"NFQUEUE target options\n"
35" --queue-num value Send packet to QUEUE number <value>.\n"
36" Valid queue numbers are 0-65535\n"
Florian Westphal4282d892009-08-20 16:39:05 +020037" --queue-balance first:last Balance flows between queues <value> to <value>.\n");
38}
39
Florian Westphal6924b492011-01-20 11:27:42 +010040static void NFQUEUE_help_v2(void)
41{
Florian Westphal6924b492011-01-20 11:27:42 +010042 printf(
Shivani Bhardwajd998de72016-04-14 20:56:49 +053043"NFQUEUE target options\n"
44" --queue-num value Send packet to QUEUE number <value>.\n"
45" Valid queue numbers are 0-65535\n"
46" --queue-balance first:last Balance flows between queues <value> to <value>.\n"
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000047" --queue-bypass Bypass Queueing if no queue instance exists.\n"
48" --queue-cpu-fanout Use current CPU (no hashing)\n");
49}
50
51static void NFQUEUE_help_v3(void)
52{
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000053 printf(
Shivani Bhardwajd998de72016-04-14 20:56:49 +053054"NFQUEUE target options\n"
55" --queue-num value Send packet to QUEUE number <value>.\n"
56" Valid queue numbers are 0-65535\n"
57" --queue-balance first:last Balance flows between queues <value> to <value>.\n"
58" --queue-bypass Bypass Queueing if no queue instance exists.\n"
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000059" --queue-cpu-fanout Use current CPU (no hashing)\n");
Florian Westphal6924b492011-01-20 11:27:42 +010060}
61
Jan Engelhardt478be252011-03-06 17:54:50 +010062#define s struct xt_NFQ_info
63static const struct xt_option_entry NFQUEUE_opts[] = {
64 {.name = "queue-num", .id = O_QUEUE_NUM, .type = XTTYPE_UINT16,
Jan Engelhardtd8784612011-05-25 00:26:01 +020065 .flags = XTOPT_PUT, XTOPT_POINTER(s, queuenum),
66 .excl = F_QUEUE_BALANCE},
Jan Engelhardt478be252011-03-06 17:54:50 +010067 {.name = "queue-balance", .id = O_QUEUE_BALANCE,
Jan Engelhardtd8784612011-05-25 00:26:01 +020068 .type = XTTYPE_UINT16RC, .excl = F_QUEUE_NUM},
Jan Engelhardt478be252011-03-06 17:54:50 +010069 {.name = "queue-bypass", .id = O_QUEUE_BYPASS, .type = XTTYPE_NONE},
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +000070 {.name = "queue-cpu-fanout", .id = O_QUEUE_CPU_FANOUT,
71 .type = XTTYPE_NONE, .also = F_QUEUE_BALANCE},
Jan Engelhardt478be252011-03-06 17:54:50 +010072 XTOPT_TABLEEND,
Harald Weltedaa1ef32005-07-19 21:44:58 +000073};
Jan Engelhardt478be252011-03-06 17:54:50 +010074#undef s
Harald Weltedaa1ef32005-07-19 21:44:58 +000075
Jan Engelhardt478be252011-03-06 17:54:50 +010076static void NFQUEUE_parse(struct xt_option_call *cb)
Florian Westphal4282d892009-08-20 16:39:05 +020077{
Jan Engelhardt478be252011-03-06 17:54:50 +010078 xtables_option_parse(cb);
79 if (cb->entry->id == O_QUEUE_BALANCE)
Florian Westphal4282d892009-08-20 16:39:05 +020080 xtables_error(PARAMETER_PROBLEM, "NFQUEUE target: "
81 "--queue-balance not supported (kernel too old?)");
Florian Westphal4282d892009-08-20 16:39:05 +020082}
83
Jan Engelhardt478be252011-03-06 17:54:50 +010084static void NFQUEUE_parse_v1(struct xt_option_call *cb)
Florian Westphal4282d892009-08-20 16:39:05 +020085{
Jan Engelhardt478be252011-03-06 17:54:50 +010086 struct xt_NFQ_info_v1 *info = cb->data;
87 const uint16_t *r = cb->val.u16_range;
Florian Westphal4282d892009-08-20 16:39:05 +020088
Jan Engelhardt478be252011-03-06 17:54:50 +010089 xtables_option_parse(cb);
90 switch (cb->entry->id) {
91 case O_QUEUE_BALANCE:
92 if (cb->nvals != 2)
93 xtables_error(PARAMETER_PROBLEM,
94 "Bad range \"%s\"", cb->arg);
95 if (r[0] >= r[1])
Florian Westphal4282d892009-08-20 16:39:05 +020096 xtables_error(PARAMETER_PROBLEM, "%u should be less than %u",
Jan Engelhardt478be252011-03-06 17:54:50 +010097 r[0], r[1]);
98 info->queuenum = r[0];
99 info->queues_total = r[1] - r[0] + 1;
Florian Westphal4282d892009-08-20 16:39:05 +0200100 break;
Harald Weltedaa1ef32005-07-19 21:44:58 +0000101 }
Harald Weltedaa1ef32005-07-19 21:44:58 +0000102}
103
Jan Engelhardt478be252011-03-06 17:54:50 +0100104static void NFQUEUE_parse_v2(struct xt_option_call *cb)
Florian Westphal6924b492011-01-20 11:27:42 +0100105{
Jan Engelhardt478be252011-03-06 17:54:50 +0100106 struct xt_NFQ_info_v2 *info = cb->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530107 const uint16_t *r = cb->val.u16_range;
Jan Engelhardt478be252011-03-06 17:54:50 +0100108
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530109 xtables_option_parse(cb);
Jan Engelhardt478be252011-03-06 17:54:50 +0100110 switch (cb->entry->id) {
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530111 case O_QUEUE_BALANCE:
112 if (cb->nvals != 2)
113 xtables_error(PARAMETER_PROBLEM,
114 "Bad range \"%s\"", cb->arg);
115 if (r[0] >= r[1])
116 xtables_error(PARAMETER_PROBLEM,
117 "%u should be less than %u",
118 r[0], r[1]);
119 info->queuenum = r[0];
120 info->queues_total = r[1] - r[0] + 1;
121 break;
Jan Engelhardt478be252011-03-06 17:54:50 +0100122 case O_QUEUE_BYPASS:
Shivani Bhardwajd1555a02016-04-14 20:55:58 +0530123 info->bypass |= NFQ_FLAG_BYPASS;
Jan Engelhardt478be252011-03-06 17:54:50 +0100124 break;
Florian Westphal6924b492011-01-20 11:27:42 +0100125 }
Florian Westphal6924b492011-01-20 11:27:42 +0100126}
127
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000128static void NFQUEUE_parse_v3(struct xt_option_call *cb)
129{
130 struct xt_NFQ_info_v3 *info = cb->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530131 const uint16_t *r = cb->val.u16_range;
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000132
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530133 xtables_option_parse(cb);
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000134 switch (cb->entry->id) {
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530135 case O_QUEUE_BALANCE:
136 if (cb->nvals != 2)
137 xtables_error(PARAMETER_PROBLEM,
138 "Bad range \"%s\"", cb->arg);
139 if (r[0] >= r[1])
140 xtables_error(PARAMETER_PROBLEM,
141 "%u should be less than %u",
142 r[0], r[1]);
143 info->queuenum = r[0];
144 info->queues_total = r[1] - r[0] + 1;
145 break;
146 case O_QUEUE_BYPASS:
147 info->flags |= NFQ_FLAG_BYPASS;
148 break;
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000149 case O_QUEUE_CPU_FANOUT:
150 info->flags |= NFQ_FLAG_CPU_FANOUT;
151 break;
152 }
153}
154
Jan Engelhardt932e6482007-10-04 16:27:30 +0000155static void NFQUEUE_print(const void *ip,
156 const struct xt_entry_target *target, int numeric)
Harald Weltedaa1ef32005-07-19 21:44:58 +0000157{
Yasuyuki KOZAKAIa2e89cc2007-07-24 07:29:36 +0000158 const struct xt_NFQ_info *tinfo =
159 (const struct xt_NFQ_info *)target->data;
Jan Engelhardt73866352010-12-18 02:04:59 +0100160 printf(" NFQUEUE num %u", tinfo->queuenum);
Harald Weltedaa1ef32005-07-19 21:44:58 +0000161}
162
Florian Westphal4282d892009-08-20 16:39:05 +0200163static void NFQUEUE_print_v1(const void *ip,
164 const struct xt_entry_target *target, int numeric)
165{
166 const struct xt_NFQ_info_v1 *tinfo = (const void *)target->data;
167 unsigned int last = tinfo->queues_total;
168
169 if (last > 1) {
170 last += tinfo->queuenum - 1;
Jan Engelhardt73866352010-12-18 02:04:59 +0100171 printf(" NFQUEUE balance %u:%u", tinfo->queuenum, last);
Florian Westphal4282d892009-08-20 16:39:05 +0200172 } else {
Jan Engelhardt73866352010-12-18 02:04:59 +0100173 printf(" NFQUEUE num %u", tinfo->queuenum);
Florian Westphal4282d892009-08-20 16:39:05 +0200174 }
175}
176
Florian Westphal6924b492011-01-20 11:27:42 +0100177static void NFQUEUE_print_v2(const void *ip,
178 const struct xt_entry_target *target, int numeric)
179{
180 const struct xt_NFQ_info_v2 *info = (void *) target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530181 unsigned int last = info->queues_total;
Florian Westphal6924b492011-01-20 11:27:42 +0100182
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530183 if (last > 1) {
184 last += info->queuenum - 1;
185 printf(" NFQUEUE balance %u:%u", info->queuenum, last);
186 } else
187 printf(" NFQUEUE num %u", info->queuenum);
188
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000189 if (info->bypass & NFQ_FLAG_BYPASS)
Florian Westphal6924b492011-01-20 11:27:42 +0100190 printf(" bypass");
191}
192
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000193static void NFQUEUE_print_v3(const void *ip,
194 const struct xt_entry_target *target, int numeric)
195{
196 const struct xt_NFQ_info_v3 *info = (void *)target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530197 unsigned int last = info->queues_total;
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000198
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530199 if (last > 1) {
200 last += info->queuenum - 1;
201 printf(" NFQUEUE balance %u:%u", info->queuenum, last);
202 } else
203 printf(" NFQUEUE num %u", info->queuenum);
204
205 if (info->flags & NFQ_FLAG_BYPASS)
206 printf(" bypass");
207
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000208 if (info->flags & NFQ_FLAG_CPU_FANOUT)
209 printf(" cpu-fanout");
210}
211
Jan Engelhardt932e6482007-10-04 16:27:30 +0000212static void NFQUEUE_save(const void *ip, const struct xt_entry_target *target)
Harald Weltedaa1ef32005-07-19 21:44:58 +0000213{
Yasuyuki KOZAKAIa2e89cc2007-07-24 07:29:36 +0000214 const struct xt_NFQ_info *tinfo =
215 (const struct xt_NFQ_info *)target->data;
Harald Weltedaa1ef32005-07-19 21:44:58 +0000216
Jan Engelhardt73866352010-12-18 02:04:59 +0100217 printf(" --queue-num %u", tinfo->queuenum);
Harald Weltedaa1ef32005-07-19 21:44:58 +0000218}
219
Florian Westphal4282d892009-08-20 16:39:05 +0200220static void NFQUEUE_save_v1(const void *ip, const struct xt_entry_target *target)
221{
222 const struct xt_NFQ_info_v1 *tinfo = (const void *)target->data;
223 unsigned int last = tinfo->queues_total;
224
225 if (last > 1) {
226 last += tinfo->queuenum - 1;
Jan Engelhardt73866352010-12-18 02:04:59 +0100227 printf(" --queue-balance %u:%u", tinfo->queuenum, last);
Florian Westphal4282d892009-08-20 16:39:05 +0200228 } else {
Jan Engelhardt73866352010-12-18 02:04:59 +0100229 printf(" --queue-num %u", tinfo->queuenum);
Florian Westphal4282d892009-08-20 16:39:05 +0200230 }
231}
232
Florian Westphal6924b492011-01-20 11:27:42 +0100233static void NFQUEUE_save_v2(const void *ip, const struct xt_entry_target *target)
234{
235 const struct xt_NFQ_info_v2 *info = (void *) target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530236 unsigned int last = info->queues_total;
Florian Westphal6924b492011-01-20 11:27:42 +0100237
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530238 if (last > 1) {
239 last += info->queuenum - 1;
240 printf(" --queue-balance %u:%u", info->queuenum, last);
241 } else
242 printf(" --queue-num %u", info->queuenum);
Florian Westphal6924b492011-01-20 11:27:42 +0100243
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000244 if (info->bypass & NFQ_FLAG_BYPASS)
Florian Westphal3c461ce2011-10-31 16:10:57 +0100245 printf(" --queue-bypass");
Florian Westphal6924b492011-01-20 11:27:42 +0100246}
247
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000248static void NFQUEUE_save_v3(const void *ip,
249 const struct xt_entry_target *target)
250{
251 const struct xt_NFQ_info_v3 *info = (void *)target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530252 unsigned int last = info->queues_total;
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000253
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530254 if (last > 1) {
255 last += info->queuenum - 1;
256 printf(" --queue-balance %u:%u", info->queuenum, last);
257 } else
258 printf(" --queue-num %u", info->queuenum);
259
260 if (info->flags & NFQ_FLAG_BYPASS)
261 printf(" --queue-bypass");
262
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000263 if (info->flags & NFQ_FLAG_CPU_FANOUT)
264 printf(" --queue-cpu-fanout");
265}
266
Florian Westphal4282d892009-08-20 16:39:05 +0200267static void NFQUEUE_init_v1(struct xt_entry_target *t)
268{
269 struct xt_NFQ_info_v1 *tinfo = (void *)t->data;
270 tinfo->queues_total = 1;
271}
272
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200273static int NFQUEUE_xlate(struct xt_xlate *xl,
274 const struct xt_xlate_tg_params *params)
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530275{
276 const struct xt_NFQ_info *tinfo =
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200277 (const struct xt_NFQ_info *)params->target->data;
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530278
279 xt_xlate_add(xl, "queue num %u ", tinfo->queuenum);
280
281 return 1;
282}
283
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200284static int NFQUEUE_xlate_v1(struct xt_xlate *xl,
285 const struct xt_xlate_tg_params *params)
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530286{
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200287 const struct xt_NFQ_info_v1 *tinfo = (const void *)params->target->data;
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530288 unsigned int last = tinfo->queues_total;
289
290 if (last > 1) {
291 last += tinfo->queuenum - 1;
292 xt_xlate_add(xl, "queue num %u-%u ", tinfo->queuenum, last);
293 } else {
294 xt_xlate_add(xl, "queue num %u ", tinfo->queuenum);
295 }
296
297 return 1;
298}
299
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200300static int NFQUEUE_xlate_v2(struct xt_xlate *xl,
301 const struct xt_xlate_tg_params *params)
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530302{
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200303 const struct xt_NFQ_info_v2 *info = (void *)params->target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530304 unsigned int last = info->queues_total;
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530305
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530306 if (last > 1) {
307 last += info->queuenum - 1;
308 xt_xlate_add(xl, "queue num %u-%u ", info->queuenum, last);
309 } else
310 xt_xlate_add(xl, "queue num %u ", info->queuenum);
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530311
312 if (info->bypass & NFQ_FLAG_BYPASS)
313 xt_xlate_add(xl, "bypass");
314
315 return 1;
316}
317
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200318static int NFQUEUE_xlate_v3(struct xt_xlate *xl,
319 const struct xt_xlate_tg_params *params)
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530320{
Pablo Neira Ayuso7a0992d2016-07-24 12:45:53 +0200321 const struct xt_NFQ_info_v3 *info = (void *)params->target->data;
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530322 unsigned int last = info->queues_total;
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530323
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530324 if (last > 1) {
325 last += info->queuenum - 1;
326 xt_xlate_add(xl, "queue num %u-%u ", info->queuenum, last);
327 } else
328 xt_xlate_add(xl, "queue num %u ", info->queuenum);
329
330 if (info->flags & NFQ_FLAG_BYPASS)
331 xt_xlate_add(xl, "bypass");
332
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530333 if (info->flags & NFQ_FLAG_CPU_FANOUT)
Shivani Bhardwajd998de72016-04-14 20:56:49 +0530334 xt_xlate_add(xl, "%sfanout ",
335 info->flags & NFQ_FLAG_BYPASS ? "," : "");
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530336
337 return 1;
338}
339
Florian Westphal6924b492011-01-20 11:27:42 +0100340static struct xtables_target nfqueue_targets[] = {
341{
Jan Engelhardtc5e85732009-06-12 20:55:44 +0200342 .family = NFPROTO_UNSPEC,
Harald Weltedaa1ef32005-07-19 21:44:58 +0000343 .name = "NFQUEUE",
Jan Engelhardt8b7c64d2008-04-15 11:48:25 +0200344 .version = XTABLES_VERSION,
Yasuyuki KOZAKAIa2e89cc2007-07-24 07:29:36 +0000345 .size = XT_ALIGN(sizeof(struct xt_NFQ_info)),
346 .userspacesize = XT_ALIGN(sizeof(struct xt_NFQ_info)),
Jan Engelhardt932e6482007-10-04 16:27:30 +0000347 .help = NFQUEUE_help,
Jan Engelhardt932e6482007-10-04 16:27:30 +0000348 .print = NFQUEUE_print,
349 .save = NFQUEUE_save,
Jan Engelhardt478be252011-03-06 17:54:50 +0100350 .x6_parse = NFQUEUE_parse,
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530351 .x6_options = NFQUEUE_opts,
352 .xlate = NFQUEUE_xlate,
Florian Westphal6924b492011-01-20 11:27:42 +0100353},{
Florian Westphal4282d892009-08-20 16:39:05 +0200354 .family = NFPROTO_UNSPEC,
355 .revision = 1,
356 .name = "NFQUEUE",
357 .version = XTABLES_VERSION,
358 .size = XT_ALIGN(sizeof(struct xt_NFQ_info_v1)),
359 .userspacesize = XT_ALIGN(sizeof(struct xt_NFQ_info_v1)),
360 .help = NFQUEUE_help_v1,
361 .init = NFQUEUE_init_v1,
Florian Westphal4282d892009-08-20 16:39:05 +0200362 .print = NFQUEUE_print_v1,
363 .save = NFQUEUE_save_v1,
Jan Engelhardt478be252011-03-06 17:54:50 +0100364 .x6_parse = NFQUEUE_parse_v1,
365 .x6_options = NFQUEUE_opts,
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530366 .xlate = NFQUEUE_xlate_v1,
Florian Westphal6924b492011-01-20 11:27:42 +0100367},{
368 .family = NFPROTO_UNSPEC,
369 .revision = 2,
370 .name = "NFQUEUE",
371 .version = XTABLES_VERSION,
372 .size = XT_ALIGN(sizeof(struct xt_NFQ_info_v2)),
373 .userspacesize = XT_ALIGN(sizeof(struct xt_NFQ_info_v2)),
374 .help = NFQUEUE_help_v2,
375 .init = NFQUEUE_init_v1,
Florian Westphal6924b492011-01-20 11:27:42 +0100376 .print = NFQUEUE_print_v2,
377 .save = NFQUEUE_save_v2,
Jan Engelhardt478be252011-03-06 17:54:50 +0100378 .x6_parse = NFQUEUE_parse_v2,
379 .x6_options = NFQUEUE_opts,
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530380 .xlate = NFQUEUE_xlate_v2,
holger@eitzenberger.orgce7d0612013-04-02 00:35:39 +0000381},{
382 .family = NFPROTO_UNSPEC,
383 .revision = 3,
384 .name = "NFQUEUE",
385 .version = XTABLES_VERSION,
386 .size = XT_ALIGN(sizeof(struct xt_NFQ_info_v3)),
387 .userspacesize = XT_ALIGN(sizeof(struct xt_NFQ_info_v3)),
388 .help = NFQUEUE_help_v3,
389 .init = NFQUEUE_init_v1,
390 .print = NFQUEUE_print_v3,
391 .save = NFQUEUE_save_v3,
392 .x6_parse = NFQUEUE_parse_v3,
393 .x6_options = NFQUEUE_opts,
Shivani Bhardwaj3bc09512016-02-09 14:23:10 +0530394 .xlate = NFQUEUE_xlate_v3,
Florian Westphal6924b492011-01-20 11:27:42 +0100395}
Florian Westphal4282d892009-08-20 16:39:05 +0200396};
397
Harald Weltedaa1ef32005-07-19 21:44:58 +0000398void _init(void)
399{
Florian Westphal6924b492011-01-20 11:27:42 +0100400 xtables_register_targets(nfqueue_targets, ARRAY_SIZE(nfqueue_targets));
Harald Weltedaa1ef32005-07-19 21:44:58 +0000401}