package/ipset: move out to packages/net/
[openwrt.git] / package / iptables / patches / 010-multiport-linux-2.4-compat.patch
1 --- a/extensions/libxt_multiport.c
2 +++ b/extensions/libxt_multiport.c
3 @@ -15,21 +15,6 @@
4 #include <linux/netfilter/xt_multiport.h>
5
6 /* Function which prints out usage message. */
7 -static void multiport_help(void)
8 -{
9 - printf(
10 -"multiport match options:\n"
11 -" --source-ports port[,port,port...]\n"
12 -" --sports ...\n"
13 -" match source port(s)\n"
14 -" --destination-ports port[,port,port...]\n"
15 -" --dports ...\n"
16 -" match destination port(s)\n"
17 -" --ports port[,port,port]\n"
18 -" match both source and destination port(s)\n"
19 -" NOTE: this kernel does not support port ranges in multiport.\n");
20 -}
21 -
22 static void multiport_help_v1(void)
23 {
24 printf(
25 @@ -72,26 +57,6 @@ proto_to_name(u_int8_t proto)
26 }
27 }
28
29 -static unsigned int
30 -parse_multi_ports(const char *portstring, u_int16_t *ports, const char *proto)
31 -{
32 - char *buffer, *cp, *next;
33 - unsigned int i;
34 -
35 - buffer = strdup(portstring);
36 - if (!buffer) xtables_error(OTHER_PROBLEM, "strdup failed");
37 -
38 - for (cp=buffer, i=0; cp && i<XT_MULTI_PORTS; cp=next,i++)
39 - {
40 - next=strchr(cp, ',');
41 - if (next) *next++='\0';
42 - ports[i] = xtables_parse_port(cp, proto);
43 - }
44 - if (cp) xtables_error(PARAMETER_PROBLEM, "too many ports specified");
45 - free(buffer);
46 - return i;
47 -}
48 -
49 static void
50 parse_multi_ports_v1(const char *portstring,
51 struct xt_multiport_v1 *multiinfo,
52 @@ -155,73 +120,6 @@ check_proto(u_int16_t pnum, u_int8_t inv
53 /* Function which parses command options; returns true if it
54 ate an option */
55 static int
56 -__multiport_parse(int c, char **argv, int invert, unsigned int *flags,
57 - struct xt_entry_match **match, u_int16_t pnum,
58 - u_int8_t invflags)
59 -{
60 - const char *proto;
61 - struct xt_multiport *multiinfo
62 - = (struct xt_multiport *)(*match)->data;
63 -
64 - switch (c) {
65 - case '1':
66 - xtables_check_inverse(optarg, &invert, &optind, 0, argv);
67 - proto = check_proto(pnum, invflags);
68 - multiinfo->count = parse_multi_ports(optarg,
69 - multiinfo->ports, proto);
70 - multiinfo->flags = XT_MULTIPORT_SOURCE;
71 - break;
72 -
73 - case '2':
74 - xtables_check_inverse(optarg, &invert, &optind, 0, argv);
75 - proto = check_proto(pnum, invflags);
76 - multiinfo->count = parse_multi_ports(optarg,
77 - multiinfo->ports, proto);
78 - multiinfo->flags = XT_MULTIPORT_DESTINATION;
79 - break;
80 -
81 - case '3':
82 - xtables_check_inverse(optarg, &invert, &optind, 0, argv);
83 - proto = check_proto(pnum, invflags);
84 - multiinfo->count = parse_multi_ports(optarg,
85 - multiinfo->ports, proto);
86 - multiinfo->flags = XT_MULTIPORT_EITHER;
87 - break;
88 -
89 - default:
90 - return 0;
91 - }
92 -
93 - if (invert)
94 - xtables_error(PARAMETER_PROBLEM,
95 - "multiport does not support invert");
96 -
97 - if (*flags)
98 - xtables_error(PARAMETER_PROBLEM,
99 - "multiport can only have one option");
100 - *flags = 1;
101 - return 1;
102 -}
103 -
104 -static int
105 -multiport_parse(int c, char **argv, int invert, unsigned int *flags,
106 - const void *e, struct xt_entry_match **match)
107 -{
108 - const struct ipt_entry *entry = e;
109 - return __multiport_parse(c, argv, invert, flags, match,
110 - entry->ip.proto, entry->ip.invflags);
111 -}
112 -
113 -static int
114 -multiport_parse6(int c, char **argv, int invert, unsigned int *flags,
115 - const void *e, struct xt_entry_match **match)
116 -{
117 - const struct ip6t_entry *entry = e;
118 - return __multiport_parse(c, argv, invert, flags, match,
119 - entry->ipv6.proto, entry->ipv6.invflags);
120 -}
121 -
122 -static int
123 __multiport_parse_v1(int c, char **argv, int invert, unsigned int *flags,
124 struct xt_entry_match **match, u_int16_t pnum,
125 u_int8_t invflags)
126 @@ -314,55 +212,6 @@ print_port(u_int16_t port, u_int8_t prot
127 }
128
129 /* Prints out the matchinfo. */
130 -static void
131 -__multiport_print(const struct xt_entry_match *match, int numeric,
132 - u_int16_t proto)
133 -{
134 - const struct xt_multiport *multiinfo
135 - = (const struct xt_multiport *)match->data;
136 - unsigned int i;
137 -
138 - printf("multiport ");
139 -
140 - switch (multiinfo->flags) {
141 - case XT_MULTIPORT_SOURCE:
142 - printf("sports ");
143 - break;
144 -
145 - case XT_MULTIPORT_DESTINATION:
146 - printf("dports ");
147 - break;
148 -
149 - case XT_MULTIPORT_EITHER:
150 - printf("ports ");
151 - break;
152 -
153 - default:
154 - printf("ERROR ");
155 - break;
156 - }
157 -
158 - for (i=0; i < multiinfo->count; i++) {
159 - printf("%s", i ? "," : "");
160 - print_port(multiinfo->ports[i], proto, numeric);
161 - }
162 - printf(" ");
163 -}
164 -
165 -static void multiport_print(const void *ip_void,
166 - const struct xt_entry_match *match, int numeric)
167 -{
168 - const struct ipt_ip *ip = ip_void;
169 - __multiport_print(match, numeric, ip->proto);
170 -}
171 -
172 -static void multiport_print6(const void *ip_void,
173 - const struct xt_entry_match *match, int numeric)
174 -{
175 - const struct ip6t_ip6 *ip = ip_void;
176 - __multiport_print(match, numeric, ip->proto);
177 -}
178 -
179 static void __multiport_print_v1(const struct xt_entry_match *match,
180 int numeric, u_int16_t proto)
181 {
182 @@ -419,48 +268,6 @@ static void multiport_print6_v1(const vo
183 }
184
185 /* Saves the union ipt_matchinfo in parsable form to stdout. */
186 -static void __multiport_save(const struct xt_entry_match *match,
187 - u_int16_t proto)
188 -{
189 - const struct xt_multiport *multiinfo
190 - = (const struct xt_multiport *)match->data;
191 - unsigned int i;
192 -
193 - switch (multiinfo->flags) {
194 - case XT_MULTIPORT_SOURCE:
195 - printf("--sports ");
196 - break;
197 -
198 - case XT_MULTIPORT_DESTINATION:
199 - printf("--dports ");
200 - break;
201 -
202 - case XT_MULTIPORT_EITHER:
203 - printf("--ports ");
204 - break;
205 - }
206 -
207 - for (i=0; i < multiinfo->count; i++) {
208 - printf("%s", i ? "," : "");
209 - print_port(multiinfo->ports[i], proto, 1);
210 - }
211 - printf(" ");
212 -}
213 -
214 -static void multiport_save(const void *ip_void,
215 - const struct xt_entry_match *match)
216 -{
217 - const struct ipt_ip *ip = ip_void;
218 - __multiport_save(match, ip->proto);
219 -}
220 -
221 -static void multiport_save6(const void *ip_void,
222 - const struct xt_entry_match *match)
223 -{
224 - const struct ip6t_ip6 *ip = ip_void;
225 - __multiport_save(match, ip->proto);
226 -}
227 -
228 static void __multiport_save_v1(const struct xt_entry_match *match,
229 u_int16_t proto)
230 {
231 @@ -514,34 +321,6 @@ static struct xtables_match multiport_mt
232 {
233 .family = NFPROTO_IPV4,
234 .name = "multiport",
235 - .revision = 0,
236 - .version = XTABLES_VERSION,
237 - .size = XT_ALIGN(sizeof(struct xt_multiport)),
238 - .userspacesize = XT_ALIGN(sizeof(struct xt_multiport)),
239 - .help = multiport_help,
240 - .parse = multiport_parse,
241 - .final_check = multiport_check,
242 - .print = multiport_print,
243 - .save = multiport_save,
244 - .extra_opts = multiport_opts,
245 - },
246 - {
247 - .family = NFPROTO_IPV6,
248 - .name = "multiport",
249 - .revision = 0,
250 - .version = XTABLES_VERSION,
251 - .size = XT_ALIGN(sizeof(struct xt_multiport)),
252 - .userspacesize = XT_ALIGN(sizeof(struct xt_multiport)),
253 - .help = multiport_help,
254 - .parse = multiport_parse6,
255 - .final_check = multiport_check,
256 - .print = multiport_print6,
257 - .save = multiport_save6,
258 - .extra_opts = multiport_opts,
259 - },
260 - {
261 - .family = NFPROTO_IPV4,
262 - .name = "multiport",
263 .version = XTABLES_VERSION,
264 .revision = 1,
265 .size = XT_ALIGN(sizeof(struct xt_multiport_v1)),
This page took 0.067602 seconds and 5 git commands to generate.