libipfix: specify the number of the wprobe ie append script on the command line
[openwrt.git] / package / iptables / patches / 1.4.4 / 005-imq.patch
1 --- /dev/null
2 +++ b/extensions/.IMQ-testx
3 @@ -0,0 +1,3 @@
4 +#!/bin/sh
5 +# True if IMQ target patch is applied.
6 +[ -f $KERNEL_DIR/include/linux/netfilter/xt_IMQ.h ] && echo IMQ
7 --- /dev/null
8 +++ b/extensions/libxt_IMQ.c
9 @@ -0,0 +1,103 @@
10 +/* Shared library add-on to iptables to add IMQ target support. */
11 +#include <stdio.h>
12 +#include <string.h>
13 +#include <stdlib.h>
14 +#include <getopt.h>
15 +
16 +#include <xtables.h>
17 +#include <linux/netfilter/x_tables.h>
18 +#include <linux/netfilter/xt_IMQ.h>
19 +
20 +/* Function which prints out usage message. */
21 +static void IMQ_help(void)
22 +{
23 + printf(
24 +"IMQ target v%s options:\n"
25 +" --todev <N> enqueue to imq<N>, defaults to 0\n",
26 +XTABLES_VERSION);
27 +}
28 +
29 +static struct option IMQ_opts[] = {
30 + { "todev", 1, 0, '1' },
31 + { 0 }
32 +};
33 +
34 +/* Initialize the target. */
35 +static void IMQ_init(struct xt_entry_target *t)
36 +{
37 + struct xt_imq_info *mr = (struct xt_imq_info*)t->data;
38 +
39 + mr->todev = 0;
40 +}
41 +
42 +/* Function which parses command options; returns true if it
43 + ate an option */
44 +static int IMQ_parse(int c, char **argv, int invert, unsigned int *flags,
45 + const void *entry, struct xt_entry_target **target)
46 +{
47 + struct xt_imq_info *mr = (struct xt_imq_info*)(*target)->data;
48 +
49 + switch(c) {
50 + case '1':
51 + if (xtables_check_inverse(optarg, &invert, NULL, 0))
52 + xtables_error(PARAMETER_PROBLEM,
53 + "Unexpected `!' after --todev");
54 + mr->todev=atoi(optarg);
55 + break;
56 + default:
57 + return 0;
58 + }
59 + return 1;
60 +}
61 +
62 +/* Prints out the targinfo. */
63 +static void IMQ_print(const void *ip,
64 + const struct xt_entry_target *target,
65 + int numeric)
66 +{
67 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
68 +
69 + printf("IMQ: todev %u ", mr->todev);
70 +}
71 +
72 +/* Saves the union ipt_targinfo in parsable form to stdout. */
73 +static void IMQ_save(const void *ip, const struct xt_entry_target *target)
74 +{
75 + struct xt_imq_info *mr = (struct xt_imq_info*)target->data;
76 +
77 + printf("--todev %u", mr->todev);
78 +}
79 +
80 +static struct xtables_target imq_target = {
81 + .name = "IMQ",
82 + .version = XTABLES_VERSION,
83 + .family = AF_INET,
84 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
85 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
86 + .help = IMQ_help,
87 + .init = IMQ_init,
88 + .parse = IMQ_parse,
89 + .print = IMQ_print,
90 + .save = IMQ_save,
91 + .extra_opts = IMQ_opts,
92 +};
93 +
94 +static struct xtables_target imq_target6 = {
95 + .name = "IMQ",
96 + .version = XTABLES_VERSION,
97 + .family = AF_INET6,
98 + .size = XT_ALIGN(sizeof(struct xt_imq_info)),
99 + .userspacesize = XT_ALIGN(sizeof(struct xt_imq_info)),
100 + .help = IMQ_help,
101 + .init = IMQ_init,
102 + .parse = IMQ_parse,
103 + .print = IMQ_print,
104 + .save = IMQ_save,
105 + .extra_opts = IMQ_opts,
106 +};
107 +
108 +void _init(void)
109 +{
110 + xtables_register_target(&imq_target);
111 + xtables_register_target(&imq_target6);
112 +}
113 --- /dev/null
114 +++ b/include/linux/netfilter/xt_IMQ.h
115 @@ -0,0 +1,9 @@
116 +#ifndef _XT_IMQ_H
117 +#define _XT_IMQ_H
118 +
119 +struct xt_imq_info {
120 + unsigned int todev; /* target imq device */
121 +};
122 +
123 +#endif /* _XT_IMQ_H */
124 +
This page took 0.043183 seconds and 5 git commands to generate.