1 diff -Naurw /dev/null extensions/libxt_IMQ.c
2 --- /dev/null 1969-12-31 21:00:00.000000000 -0300
3 +++ extensions/libxt_IMQ.c 2008-06-24 22:31:02.000000000 -0300
5 +/* Shared library add-on to iptables to add IMQ target support. */
12 +#include <linux/netfilter/x_tables.h>
13 +#include <linux/netfilter/xt_IMQ.h>
15 +/* Function which prints out usage message. */
16 +static void IMQ_help(void)
19 +"IMQ target options:\n"
20 +" --todev <N> enqueue to imq<N>, defaults to 0\n");
24 +static struct option IMQ_opts[] = {
25 + { "todev", 1, 0, '1' },
29 +/* Initialize the target. */
30 +static void IMQ_init(struct xt_entry_target *t)
32 + struct xt_imq_info *mr = (struct xt_imq_info*)t->data;
37 +/* Function which parses command options; returns true if it
39 +static int IMQ_parse(int c, char **argv, int invert, unsigned int *flags,
40 + const void *entry, struct xt_entry_target **target)
42 + struct xt_imq_info *mr = (struct xt_imq_info*)(*target)->data;
46 + if (xtables_check_inverse(optarg, &invert, NULL, 0, argv))
47 + xtables_error(PARAMETER_PROBLEM,
48 + "Unexpected `!' after --todev");
49 + mr->todev=atoi(optarg);
57 +/* Prints out the targinfo. */
58 +static void IMQ_print(const void *ip,
59 + const struct xt_entry_target *target,
62 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
64 + printf("IMQ: todev %u ", mr->todev);
67 +/* Saves the union ipt_targinfo in parsable form to stdout. */
68 +static void IMQ_save(const void *ip, const struct xt_entry_target *target)
70 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
72 + printf("--todev %u", mr->todev);
75 +static struct xtables_target imq_target = {
77 + .version = XTABLES_VERSION,
78 + .family = NFPROTO_IPV4,
79 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
80 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
86 + .extra_opts = IMQ_opts,
89 +static struct xtables_target imq_target6 = {
91 + .version = XTABLES_VERSION,
92 + .family = NFPROTO_IPV6,
93 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
94 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
100 + .extra_opts = IMQ_opts,
103 +// void __attribute((constructor)) nf_ext_init(void){
105 + xtables_register_target(&imq_target);
106 + xtables_register_target(&imq_target6);
108 diff -Naurw /dev/null extensions/libxt_IMQ.c
109 --- /dev/null 1970-01-01 02:00:00.000000000 +0200
110 +++ include/linux/netfilter/xt_IMQ.h 2008-08-05 00:41:28.000000000 +0300
115 +struct xt_imq_info {
116 + unsigned int todev; /* target imq device */
119 +#endif /* _XT_IMQ_H */