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