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.
diff --git a/extensions/libipt_tcp.c b/extensions/libipt_tcp.c
index f8ed249..7551a0a 100644
--- a/extensions/libipt_tcp.c
+++ b/extensions/libipt_tcp.c
@@ -38,24 +38,13 @@
 	{0}
 };
 
-static int
-service_to_port(const char *name)
-{
-	struct servent *service;
-
-	if ((service = getservbyname(name, "tcp")) != NULL)
-		return ntohs((unsigned short) service->s_port);
-
-	return -1;
-}
-
 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)) != -1)
+	    (portnum = service_to_port(port, "tcp")) != -1)
 		return (u_int16_t)portnum;
 
 	exit_error(PARAMETER_PROBLEM,