1 --- a/extensions/libxt_multiport.c
2 +++ b/extensions/libxt_multiport.c
4 #include <linux/netfilter/xt_multiport.h>
6 /* Function which prints out usage message. */
7 -static void multiport_help(void)
10 -"multiport match options:\n"
11 -" --source-ports port[,port,port...]\n"
13 -" match source port(s)\n"
14 -" --destination-ports port[,port,port...]\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");
22 static void multiport_help_v1(void)
25 @@ -71,26 +56,6 @@ proto_to_name(u_int8_t proto)
30 -parse_multi_ports(const char *portstring, u_int16_t *ports, const char *proto)
32 - char *buffer, *cp, *next;
35 - buffer = strdup(portstring);
36 - if (!buffer) xtables_error(OTHER_PROBLEM, "strdup failed");
38 - for (cp=buffer, i=0; cp && i<XT_MULTI_PORTS; cp=next,i++)
40 - next=strchr(cp, ',');
41 - if (next) *next++='\0';
42 - ports[i] = xtables_parse_port(cp, proto);
44 - if (cp) xtables_error(PARAMETER_PROBLEM, "too many ports specified");
50 parse_multi_ports_v1(const char *portstring,
51 struct xt_multiport_v1 *multiinfo,
52 @@ -154,73 +119,6 @@ check_proto(u_int16_t pnum, u_int8_t inv
53 /* Function which parses command options; returns true if it
56 -__multiport_parse(int c, char **argv, int invert, unsigned int *flags,
57 - struct xt_entry_match **match, u_int16_t pnum,
61 - struct xt_multiport *multiinfo
62 - = (struct xt_multiport *)(*match)->data;
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;
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;
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;
94 - xtables_error(PARAMETER_PROBLEM,
95 - "multiport does not support invert");
98 - xtables_error(PARAMETER_PROBLEM,
99 - "multiport can only have one option");
105 -multiport_parse(int c, char **argv, int invert, unsigned int *flags,
106 - const void *e, struct xt_entry_match **match)
108 - const struct ipt_entry *entry = e;
109 - return __multiport_parse(c, argv, invert, flags, match,
110 - entry->ip.proto, entry->ip.invflags);
114 -multiport_parse6(int c, char **argv, int invert, unsigned int *flags,
115 - const void *e, struct xt_entry_match **match)
117 - const struct ip6t_entry *entry = e;
118 - return __multiport_parse(c, argv, invert, flags, match,
119 - entry->ipv6.proto, entry->ipv6.invflags);
123 __multiport_parse_v1(int c, char **argv, int invert, unsigned int *flags,
124 struct xt_entry_match **match, u_int16_t pnum,
126 @@ -313,55 +211,6 @@ print_port(u_int16_t port, u_int8_t prot
129 /* Prints out the matchinfo. */
131 -__multiport_print(const struct xt_entry_match *match, int numeric,
134 - const struct xt_multiport *multiinfo
135 - = (const struct xt_multiport *)match->data;
138 - printf("multiport ");
140 - switch (multiinfo->flags) {
141 - case XT_MULTIPORT_SOURCE:
145 - case XT_MULTIPORT_DESTINATION:
149 - case XT_MULTIPORT_EITHER:
158 - for (i=0; i < multiinfo->count; i++) {
159 - printf("%s", i ? "," : "");
160 - print_port(multiinfo->ports[i], proto, numeric);
165 -static void multiport_print(const void *ip_void,
166 - const struct xt_entry_match *match, int numeric)
168 - const struct ipt_ip *ip = ip_void;
169 - __multiport_print(match, numeric, ip->proto);
172 -static void multiport_print6(const void *ip_void,
173 - const struct xt_entry_match *match, int numeric)
175 - const struct ip6t_ip6 *ip = ip_void;
176 - __multiport_print(match, numeric, ip->proto);
179 static void __multiport_print_v1(const struct xt_entry_match *match,
180 int numeric, u_int16_t proto)
182 @@ -418,48 +267,6 @@ static void multiport_print6_v1(const vo
185 /* Saves the union ipt_matchinfo in parsable form to stdout. */
186 -static void __multiport_save(const struct xt_entry_match *match,
189 - const struct xt_multiport *multiinfo
190 - = (const struct xt_multiport *)match->data;
193 - switch (multiinfo->flags) {
194 - case XT_MULTIPORT_SOURCE:
195 - printf("--sports ");
198 - case XT_MULTIPORT_DESTINATION:
199 - printf("--dports ");
202 - case XT_MULTIPORT_EITHER:
203 - printf("--ports ");
207 - for (i=0; i < multiinfo->count; i++) {
208 - printf("%s", i ? "," : "");
209 - print_port(multiinfo->ports[i], proto, 1);
214 -static void multiport_save(const void *ip_void,
215 - const struct xt_entry_match *match)
217 - const struct ipt_ip *ip = ip_void;
218 - __multiport_save(match, ip->proto);
221 -static void multiport_save6(const void *ip_void,
222 - const struct xt_entry_match *match)
224 - const struct ip6t_ip6 *ip = ip_void;
225 - __multiport_save(match, ip->proto);
228 static void __multiport_save_v1(const struct xt_entry_match *match,
231 @@ -513,34 +320,6 @@ static struct xtables_match multiport_mt
233 .family = NFPROTO_IPV4,
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,
247 - .family = NFPROTO_IPV6,
248 - .name = "multiport",
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,
261 - .family = NFPROTO_IPV4,
262 - .name = "multiport",
263 .version = XTABLES_VERSION,
265 .size = XT_ALIGN(sizeof(struct xt_multiport_v1)),