summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/libipt_udp.c')
-rw-r--r--extensions/libipt_udp.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/extensions/libipt_udp.c b/extensions/libipt_udp.c
index a49e8f7..7f461d8 100644
--- a/extensions/libipt_udp.c
+++ b/extensions/libipt_udp.c
@@ -30,19 +30,6 @@ static struct option opts[] = {
{0}
};
-static u_int16_t
-parse_udp_port(const char *port)
-{
- unsigned int portnum;
-
- if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port, "udp")) != -1)
- return (u_int16_t)portnum;
-
- exit_error(PARAMETER_PROBLEM,
- "invalid UDP port/service `%s' specified", port);
- }
-
static void
parse_udp_ports(const char *portstring, u_int16_t *ports)
{
@@ -51,13 +38,13 @@ parse_udp_ports(const char *portstring, u_int16_t *ports)
buffer = strdup(portstring);
if ((cp = strchr(buffer, ':')) == NULL)
- ports[0] = ports[1] = parse_udp_port(buffer);
+ ports[0] = ports[1] = parse_port(buffer, "udp");
else {
*cp = '\0';
cp++;
- ports[0] = buffer[0] ? parse_udp_port(buffer) : 0;
- ports[1] = cp[0] ? parse_udp_port(cp) : 0xFFFF;
+ ports[0] = buffer[0] ? parse_port(buffer, "udp") : 0;
+ ports[1] = cp[0] ? parse_port(cp, "udp") : 0xFFFF;
if (ports[0] > ports[1])
exit_error(PARAMETER_PROBLEM,