1 diff -Naurw iptables-1.4.1/extensions/.IMQ-testx iptables-1.4.1.imq/extensions/.IMQ-testx
2 --- iptables-1.4.1/extensions/.IMQ-testx 1969-12-31 21:00:00.000000000 -0300
3 +++ iptables-1.4.1.imq/extensions/.IMQ-testx 2008-06-24 22:20:06.000000000 -0300
6 +# True if IMQ target patch is applied.
7 +[ -f $KERNEL_DIR/include/linux/netfilter/xt_IMQ.h ] && echo IMQ
8 diff -Naurw iptables-1.4.1/extensions/libxt_IMQ.c iptables-1.4.1.imq/extensions/libxt_IMQ.c
9 --- iptables-1.4.1/extensions/libxt_IMQ.c 1969-12-31 21:00:00.000000000 -0300
10 +++ iptables-1.4.1.imq/extensions/libxt_IMQ.c 2008-06-24 22:31:02.000000000 -0300
12 +/* Shared library add-on to iptables to add IMQ target support. */
19 +#include <linux/netfilter/x_tables.h>
20 +#include <linux/netfilter/xt_IMQ.h>
22 +/* Function which prints out usage message. */
23 +static void IMQ_help(void)
26 +"IMQ target options:\n"
27 +" --todev <N> enqueue to imq<N>, defaults to 0\n");
31 +static struct option IMQ_opts[] = {
32 + { "todev", 1, 0, '1' },
36 +/* Initialize the target. */
37 +static void IMQ_init(struct xt_entry_target *t)
39 + struct xt_imq_info *mr = (struct xt_imq_info*)t->data;
44 +/* Function which parses command options; returns true if it
46 +static int IMQ_parse(int c, char **argv, int invert, unsigned int *flags,
47 + const void *entry, struct xt_entry_target **target)
49 + struct xt_imq_info *mr = (struct xt_imq_info*)(*target)->data;
53 + if (xtables_check_inverse(optarg, &invert, NULL, 0, argv))
54 + xtables_error(PARAMETER_PROBLEM,
55 + "Unexpected `!' for --todev");
56 + mr->todev=atoi(optarg);
64 +/* Prints out the targinfo. */
65 +static void IMQ_print(const void *ip,
66 + const struct xt_entry_target *target,
69 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
71 + printf("IMQ: todev %u ", mr->todev);
74 +/* Saves the union ipt_targinfo in parsable form to stdout. */
75 +static void IMQ_save(const void *ip, const struct xt_entry_target *target)
77 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
79 + printf("--todev %u", mr->todev);
82 +static struct xtables_target imq_target = {
84 + .version = XTABLES_VERSION,
85 + .family = NFPROTO_IPV4,
86 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
87 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
93 + .extra_opts = IMQ_opts,
96 +static struct xtables_target imq_target6 = {
98 + .version = XTABLES_VERSION,
99 + .family = NFPROTO_IPV6,
100 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
101 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
104 + .parse = IMQ_parse,
105 + .print = IMQ_print,
107 + .extra_opts = IMQ_opts,
110 +// void __attribute((constructor)) nf_ext_init(void){
112 + xtables_register_target(&imq_target);
113 + xtables_register_target(&imq_target6);
115 --- iptables-1.4.1.1/include/linux/netfilter/xt_IMQ.h 1970-01-01 02:00:00.000000000 +0200
116 +++ iptables-1.4.1.1.new/include/linux/netfilter/xt_IMQ.h 2008-08-05 00:41:28.000000000 +0300
121 +struct xt_imq_info {
122 + unsigned int todev; /* target imq device */
125 +#endif /* _XT_IMQ_H */