1 Index: iptables-1.3.8/extensions/.IMQ-test6
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ iptables-1.3.8/extensions/.IMQ-test6 2007-07-31 15:27:56.000000000 -0500
7 +# True if IMQ target patch is applied.
8 +[ -f $KERNEL_DIR/net/ipv6/netfilter/ip6t_IMQ.c ] && echo IMQ
9 Index: iptables-1.3.8/extensions/libip6t_IMQ.c
10 ===================================================================
11 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
12 +++ iptables-1.3.8/extensions/libip6t_IMQ.c 2007-07-31 15:27:56.000000000 -0500
14 +/* Shared library add-on to iptables to add IMQ target support. */
20 +#include <ip6tables.h>
21 +#include <linux/netfilter_ipv6/ip6_tables.h>
22 +#include <linux/netfilter_ipv6/ip6t_IMQ.h>
24 +/* Function which prints out usage message. */
29 +"IMQ target v%s options:\n"
30 +" --todev <N> enqueue to imq<N>, defaults to 0\n",
34 +static struct option opts[] = {
35 + { "todev", 1, 0, '1' },
39 +/* Initialize the target. */
41 +init(struct ip6t_entry_target *t, unsigned int *nfcache)
43 + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)t->data;
46 + *nfcache |= NFC_UNKNOWN;
49 +/* Function which parses command options; returns true if it
52 +parse(int c, char **argv, int invert, unsigned int *flags,
53 + const struct ip6t_entry *entry,
54 + struct ip6t_entry_target **target)
56 + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)(*target)->data;
60 + if (check_inverse(optarg, &invert, NULL, 0))
61 + exit_error(PARAMETER_PROBLEM,
62 + "Unexpected `!' after --todev");
63 + mr->todev=atoi(optarg);
72 +final_check(unsigned int flags)
76 +/* Prints out the targinfo. */
78 +print(const struct ip6t_ip6 *ip,
79 + const struct ip6t_entry_target *target,
82 + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
84 + printf("IMQ: todev %u ", mr->todev);
87 +/* Saves the union ipt_targinfo in parsable form to stdout. */
89 +save(const struct ip6t_ip6 *ip, const struct ip6t_entry_target *target)
91 + struct ip6t_imq_info *mr = (struct ip6t_imq_info*)target->data;
93 + printf("--todev %u", mr->todev);
96 +static struct ip6tables_target imq = {
99 + .version = IPTABLES_VERSION,
100 + .size = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
101 + .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_imq_info)),
105 + .final_check = &final_check,
111 +static __attribute__((constructor)) void _init(void)
113 + register_target6(&imq);
115 Index: iptables-1.3.8/extensions/.IMQ-test
116 ===================================================================
117 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
118 +++ iptables-1.3.8/extensions/.IMQ-test 2007-07-31 15:27:56.000000000 -0500
121 +# True if IMQ target patch is applied.
122 +[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ
123 Index: iptables-1.3.8/extensions/libipt_IMQ.c
124 ===================================================================
125 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
126 +++ iptables-1.3.8/extensions/libipt_IMQ.c 2007-07-31 15:27:56.000000000 -0500
128 +/* Shared library add-on to iptables to add IMQ target support. */
134 +#include <iptables.h>
135 +#include <linux/netfilter_ipv4/ip_tables.h>
136 +#include <linux/netfilter_ipv4/ipt_IMQ.h>
138 +/* Function which prints out usage message. */
143 +"IMQ target v%s options:\n"
144 +" --todev <N> enqueue to imq<N>, defaults to 0\n",
148 +static struct option opts[] = {
149 + { "todev", 1, 0, '1' },
153 +/* Initialize the target. */
155 +init(struct ipt_entry_target *t, unsigned int *nfcache)
157 + struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
160 + *nfcache |= NFC_UNKNOWN;
163 +/* Function which parses command options; returns true if it
166 +parse(int c, char **argv, int invert, unsigned int *flags,
167 + const struct ipt_entry *entry,
168 + struct ipt_entry_target **target)
170 + struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
174 + if (check_inverse(optarg, &invert, NULL, 0))
175 + exit_error(PARAMETER_PROBLEM,
176 + "Unexpected `!' after --todev");
177 + mr->todev=atoi(optarg);
186 +final_check(unsigned int flags)
190 +/* Prints out the targinfo. */
192 +print(const struct ipt_ip *ip,
193 + const struct ipt_entry_target *target,
196 + struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
198 + printf("IMQ: todev %u ", mr->todev);
201 +/* Saves the union ipt_targinfo in parsable form to stdout. */
203 +save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
205 + struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
207 + printf("--todev %u", mr->todev);
210 +static struct iptables_target imq = {
213 + .version = IPTABLES_VERSION,
214 + .size = IPT_ALIGN(sizeof(struct ipt_imq_info)),
215 + .userspacesize = IPT_ALIGN(sizeof(struct ipt_imq_info)),
219 + .final_check = &final_check,
225 +static __attribute__((constructor)) void _init(void)
227 + register_target(&imq);