summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_dccp.c
diff options
context:
space:
mode:
authorPhil Oester <kernel@linuxace.com>2006-07-20 17:01:54 +0000
committerPatrick McHardy <kaber@trash.net>2006-07-20 17:01:54 +0000
commitdbac8ad71c3c418fd8a62c08211885a38177b725 (patch)
treef12056e44275c023cef77e131ef9038e9efc3915 /extensions/libipt_dccp.c
parent58179b1d0d1722ea16028aa2ea9d74afc86dd5dc (diff)
reduce parse_*_port duplication (Phil Oester <kernel@linuxace.com>)
The below patch (dependent upon my 'reduce service_to_port duplication' patch) centralizes the parse_*_port functions into parse_port.
Diffstat (limited to 'extensions/libipt_dccp.c')
-rw-r--r--extensions/libipt_dccp.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/extensions/libipt_dccp.c b/extensions/libipt_dccp.c
index 603be1de..e5782a85 100644
--- a/extensions/libipt_dccp.c
+++ b/extensions/libipt_dccp.c
@@ -56,20 +56,6 @@ static struct option opts[] = {
{ .name = 0 }
};
-static u_int16_t
-parse_dccp_port(const char *port)
-{
- unsigned int portnum;
-
- DEBUGP("%s\n", port);
- if (string_to_number(port, 0, 65535, &portnum) != -1 ||
- (portnum = service_to_port(port, "dccp")) != -1)
- return (u_int16_t)portnum;
-
- exit_error(PARAMETER_PROBLEM,
- "invalid DCCP port/service `%s' specified", port);
-}
-
static void
parse_dccp_ports(const char *portstring,
u_int16_t *ports)
@@ -80,14 +66,14 @@ parse_dccp_ports(const char *portstring,
buffer = strdup(portstring);
DEBUGP("%s\n", portstring);
if ((cp = strchr(buffer, ':')) == NULL) {
- ports[0] = ports[1] = parse_dccp_port(buffer);
+ ports[0] = ports[1] = parse_port(buffer, "dccp");
}
else {
*cp = '\0';
cp++;
- ports[0] = buffer[0] ? parse_dccp_port(buffer) : 0;
- ports[1] = cp[0] ? parse_dccp_port(cp) : 0xFFFF;
+ ports[0] = buffer[0] ? parse_port(buffer, "dccp") : 0;
+ ports[1] = cp[0] ? parse_port(cp, "dccp") : 0xFFFF;
if (ports[0] > ports[1])
exit_error(PARAMETER_PROBLEM,