diff options
author | Phil Oester <kernel@linuxace.com> | 2006-07-20 17:00:19 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2006-07-20 17:00:19 +0000 |
commit | 58179b1d0d1722ea16028aa2ea9d74afc86dd5dc (patch) | |
tree | c7345c2720ad5cf6ffb5ebe4bf5bc985b609ec51 /extensions/libipt_udp.c | |
parent | 7f5be628f66ec7b8b22e87ace39ee61213c6313b (diff) |
reduce service_to_port duplication (Phil Oester <kernel@linuxace.com>)
The service_to_port function is used in a number of places, and could
benefit from some centralization instead of being duplicated everywhere.
Diffstat (limited to 'extensions/libipt_udp.c')
-rw-r--r-- | extensions/libipt_udp.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/extensions/libipt_udp.c b/extensions/libipt_udp.c index f45f364c..a49e8f79 100644 --- a/extensions/libipt_udp.c +++ b/extensions/libipt_udp.c @@ -30,24 +30,13 @@ static struct option opts[] = { {0} }; -static int -service_to_port(const char *name) -{ - struct servent *service; - - if ((service = getservbyname(name, "udp")) != NULL) - return ntohs((unsigned short) service->s_port); - - return -1; -} - 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)) != -1) + (portnum = service_to_port(port, "udp")) != -1) return (u_int16_t)portnum; exit_error(PARAMETER_PROBLEM, |