]> git.pld-linux.org Git - packages/iptables.git/blob - iptables-1.2.9-ipt_imq.patch
- require llh 2.6.7.0-3 (previous versions had broken ip{,6}t API)
[packages/iptables.git] / iptables-1.2.9-ipt_imq.patch
1 diff -uNr iptables-1.2.9_20040308.orig/extensions/.IMQ-test iptables-1.2.9_20040308/extensions/.IMQ-test
2 --- iptables-1.2.9_20040308.orig/extensions/.IMQ-test   1970-01-01 01:00:00.000000000 +0100
3 +++ iptables-1.2.9_20040308/extensions/.IMQ-test        2004-03-14 14:55:14.623395152 +0100
4 @@ -0,0 +1,3 @@
5 +#!/bin/sh
6 +# True if IMQ target patch is applied.
7 +[ -f $KERNEL_DIR/net/ipv4/netfilter/ipt_IMQ.c ] && echo IMQ
8 diff -uNr iptables-1.2.9_20040308.orig/extensions/libipt_IMQ.c iptables-1.2.9_20040308/extensions/libipt_IMQ.c
9 --- iptables-1.2.9_20040308.orig/extensions/libipt_IMQ.c        1970-01-01 01:00:00.000000000 +0100
10 +++ iptables-1.2.9_20040308/extensions/libipt_IMQ.c     2004-03-14 14:56:05.363681456 +0100
11 @@ -0,0 +1,102 @@
12 +/* Shared library add-on to iptables to add IMQ target support. */
13 +#include <stdio.h>
14 +#include <string.h>
15 +#include <stdlib.h>
16 +#include <getopt.h>
17 +
18 +#include <iptables.h>
19 +#include <linux/netfilter_ipv4/ip_tables.h>
20 +#include <linux/netfilter_ipv4/ipt_IMQ.h>
21 +
22 +/* Function which prints out usage message. */
23 +static void
24 +help(void)
25 +{
26 +       printf(
27 +"IMQ target v%s options:\n"
28 +"  --todev <N>         enqueue to imq<N>, defaults to 0\n", 
29 +IPTABLES_VERSION);
30 +}
31 +
32 +static struct option opts[] = {
33 +       { "todev", 1, 0, '1' },
34 +       { 0 }
35 +};
36 +
37 +/* Initialize the target. */
38 +static void
39 +init(struct ipt_entry_target *t, unsigned int *nfcache)
40 +{
41 +       struct ipt_imq_info *mr = (struct ipt_imq_info*)t->data;
42 +
43 +       mr->todev = 0;
44 +       *nfcache |= NFC_UNKNOWN;
45 +}
46 +
47 +/* Function which parses command options; returns true if it
48 +   ate an option */
49 +static int
50 +parse(int c, char **argv, int invert, unsigned int *flags,
51 +      const struct ipt_entry *entry,
52 +      struct ipt_entry_target **target)
53 +{
54 +       struct ipt_imq_info *mr = (struct ipt_imq_info*)(*target)->data;
55 +       
56 +       switch(c) {
57 +       case '1':
58 +               if (check_inverse(optarg, &invert, NULL, 0))
59 +                       exit_error(PARAMETER_PROBLEM,
60 +                                  "Unexpected `!' after --todev");
61 +               mr->todev=atoi(optarg);
62 +               break;
63 +       default:
64 +               return 0;
65 +       }
66 +       return 1;
67 +}
68 +
69 +static void
70 +final_check(unsigned int flags)
71 +{
72 +}
73 +
74 +/* Prints out the targinfo. */
75 +static void
76 +print(const struct ipt_ip *ip,
77 +      const struct ipt_entry_target *target,
78 +      int numeric)
79 +{
80 +       struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
81 +
82 +       printf("IMQ: todev %u ", mr->todev);
83 +}
84 +
85 +/* Saves the union ipt_targinfo in parsable form to stdout. */
86 +static void
87 +save(const struct ipt_ip *ip, const struct ipt_entry_target *target)
88 +{
89 +       struct ipt_imq_info *mr = (struct ipt_imq_info*)target->data;
90 +
91 +       printf("--todev %u", mr->todev);
92 +}
93 +
94 +static
95 +struct iptables_target imq
96 += { NULL,
97 +    "IMQ",
98 +    IPTABLES_VERSION,
99 +    IPT_ALIGN(sizeof(struct ipt_imq_info)),
100 +    IPT_ALIGN(sizeof(struct ipt_imq_info)),
101 +    &help,
102 +    &init,
103 +    &parse,
104 +    &final_check,
105 +    &print,
106 +    &save,
107 +    opts
108 +};
109 +
110 +void _init(void)
111 +{
112 +       register_target(&imq);
113 +}
This page took 0.069926 seconds and 3 git commands to generate.