1 Index: iptables-1.4.0/extensions/libxt_multiport.c
2 ===================================================================
3 --- iptables-1.4.0.orig/extensions/libxt_multiport.c
4 +++ iptables-1.4.0/extensions/libxt_multiport.c
6 #include "../include/linux/netfilter/xt_multiport.h"
8 /* Function which prints out usage message. */
9 -static void multiport_help(void)
12 -"multiport v%s options:\n"
13 -" --source-ports port[,port,port...]\n"
15 -" match source port(s)\n"
16 -" --destination-ports port[,port,port...]\n"
18 -" match destination port(s)\n"
19 -" --ports port[,port,port]\n"
20 -" match both source and destination port(s)\n"
21 -" NOTE: this kernel does not support port ranges in multiport.\n",
25 static void multiport_help_v1(void)
28 @@ -71,26 +55,6 @@ proto_to_name(u_int8_t proto)
33 -parse_multi_ports(const char *portstring, u_int16_t *ports, const char *proto)
35 - char *buffer, *cp, *next;
38 - buffer = strdup(portstring);
39 - if (!buffer) exit_error(OTHER_PROBLEM, "strdup failed");
41 - for (cp=buffer, i=0; cp && i<XT_MULTI_PORTS; cp=next,i++)
43 - next=strchr(cp, ',');
44 - if (next) *next++='\0';
45 - ports[i] = parse_port(cp, proto);
47 - if (cp) exit_error(PARAMETER_PROBLEM, "too many ports specified");
53 parse_multi_ports_v1(const char *portstring,
54 struct xt_multiport_v1 *multiinfo,
55 @@ -154,73 +118,6 @@ check_proto(u_int16_t pnum, u_int8_t inv
56 /* Function which parses command options; returns true if it
59 -__multiport_parse(int c, char **argv, int invert, unsigned int *flags,
60 - struct xt_entry_match **match, u_int16_t pnum,
64 - struct xt_multiport *multiinfo
65 - = (struct xt_multiport *)(*match)->data;
69 - check_inverse(argv[optind-1], &invert, &optind, 0);
70 - proto = check_proto(pnum, invflags);
71 - multiinfo->count = parse_multi_ports(argv[optind-1],
72 - multiinfo->ports, proto);
73 - multiinfo->flags = XT_MULTIPORT_SOURCE;
77 - check_inverse(argv[optind-1], &invert, &optind, 0);
78 - proto = check_proto(pnum, invflags);
79 - multiinfo->count = parse_multi_ports(argv[optind-1],
80 - multiinfo->ports, proto);
81 - multiinfo->flags = XT_MULTIPORT_DESTINATION;
85 - check_inverse(argv[optind-1], &invert, &optind, 0);
86 - proto = check_proto(pnum, invflags);
87 - multiinfo->count = parse_multi_ports(argv[optind-1],
88 - multiinfo->ports, proto);
89 - multiinfo->flags = XT_MULTIPORT_EITHER;
97 - exit_error(PARAMETER_PROBLEM,
98 - "multiport does not support invert");
101 - exit_error(PARAMETER_PROBLEM,
102 - "multiport can only have one option");
108 -multiport_parse(int c, char **argv, int invert, unsigned int *flags,
109 - const void *e, struct xt_entry_match **match)
111 - const struct ipt_entry *entry = e;
112 - return __multiport_parse(c, argv, invert, flags, match,
113 - entry->ip.proto, entry->ip.invflags);
117 -multiport_parse6(int c, char **argv, int invert, unsigned int *flags,
118 - const void *e, struct xt_entry_match **match)
120 - const struct ip6t_entry *entry = (const struct ip6t_entry *)e;
121 - return __multiport_parse(c, argv, invert, flags, match,
122 - entry->ipv6.proto, entry->ipv6.invflags);
126 __multiport_parse_v1(int c, char **argv, int invert, unsigned int *flags,
127 struct xt_entry_match **match, u_int16_t pnum,
129 @@ -313,55 +210,6 @@ print_port(u_int16_t port, u_int8_t prot
132 /* Prints out the matchinfo. */
134 -__multiport_print(const struct xt_entry_match *match, int numeric,
137 - const struct xt_multiport *multiinfo
138 - = (const struct xt_multiport *)match->data;
141 - printf("multiport ");
143 - switch (multiinfo->flags) {
144 - case XT_MULTIPORT_SOURCE:
148 - case XT_MULTIPORT_DESTINATION:
152 - case XT_MULTIPORT_EITHER:
161 - for (i=0; i < multiinfo->count; i++) {
162 - printf("%s", i ? "," : "");
163 - print_port(multiinfo->ports[i], proto, numeric);
168 -static void multiport_print(const void *ip_void,
169 - const struct xt_entry_match *match, int numeric)
171 - const struct ipt_ip *ip = ip_void;
172 - __multiport_print(match, numeric, ip->proto);
175 -static void multiport_print6(const void *ip_void,
176 - const struct xt_entry_match *match, int numeric)
178 - const struct ip6t_ip6 *ip = (const struct ip6t_ip6 *)ip_void;
179 - __multiport_print(match, numeric, ip->proto);
182 static void __multiport_print_v1(const struct xt_entry_match *match,
183 int numeric, u_int16_t proto)
185 @@ -418,48 +266,6 @@ static void multiport_print6_v1(const vo
188 /* Saves the union ipt_matchinfo in parsable form to stdout. */
189 -static void __multiport_save(const struct xt_entry_match *match,
192 - const struct xt_multiport *multiinfo
193 - = (const struct xt_multiport *)match->data;
196 - switch (multiinfo->flags) {
197 - case XT_MULTIPORT_SOURCE:
198 - printf("--sports ");
201 - case XT_MULTIPORT_DESTINATION:
202 - printf("--dports ");
205 - case XT_MULTIPORT_EITHER:
206 - printf("--ports ");
210 - for (i=0; i < multiinfo->count; i++) {
211 - printf("%s", i ? "," : "");
212 - print_port(multiinfo->ports[i], proto, 1);
217 -static void multiport_save(const void *ip_void,
218 - const struct xt_entry_match *match)
220 - const struct ipt_ip *ip = ip_void;
221 - __multiport_save(match, ip->proto);
224 -static void multiport_save6(const void *ip_void,
225 - const struct xt_entry_match *match)
227 - const struct ip6t_ip6 *ip = (const struct ip6t_ip6 *)ip_void;
228 - __multiport_save(match, ip->proto);
231 static void __multiport_save_v1(const struct xt_entry_match *match,
234 @@ -509,36 +315,6 @@ static void multiport_save6_v1(const voi
235 __multiport_save_v1(match, ip->proto);
238 -static struct xtables_match multiport_match = {
240 - .name = "multiport",
242 - .version = IPTABLES_VERSION,
243 - .size = XT_ALIGN(sizeof(struct xt_multiport)),
244 - .userspacesize = XT_ALIGN(sizeof(struct xt_multiport)),
245 - .help = multiport_help,
246 - .parse = multiport_parse,
247 - .final_check = multiport_check,
248 - .print = multiport_print,
249 - .save = multiport_save,
250 - .extra_opts = multiport_opts,
253 -static struct xtables_match multiport_match6 = {
254 - .family = AF_INET6,
255 - .name = "multiport",
257 - .version = IPTABLES_VERSION,
258 - .size = XT_ALIGN(sizeof(struct xt_multiport)),
259 - .userspacesize = XT_ALIGN(sizeof(struct xt_multiport)),
260 - .help = multiport_help,
261 - .parse = multiport_parse6,
262 - .final_check = multiport_check,
263 - .print = multiport_print6,
264 - .save = multiport_save6,
265 - .extra_opts = multiport_opts,
268 static struct xtables_match multiport_match_v1 = {
271 @@ -572,8 +348,6 @@ static struct xtables_match multiport_ma
275 - xtables_register_match(&multiport_match);
276 - xtables_register_match(&multiport_match6);
277 xtables_register_match(&multiport_match_v1);
278 xtables_register_match(&multiport_match6_v1);