summaryrefslogtreecommitdiffstats
path: root/ip6tables.c
diff options
context:
space:
mode:
Diffstat (limited to 'ip6tables.c')
-rw-r--r--ip6tables.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 82e95950..6dc7aa2d 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -245,6 +245,17 @@ proto_to_name(u_int8_t proto, int nolookup)
return NULL;
}
+int
+service_to_port(const char *name, const char *proto)
+{
+ struct servent *service;
+
+ if ((service = getservbyname(name, proto)) != NULL)
+ return ntohs((unsigned short) service->s_port);
+
+ return -1;
+}
+
static void
in6addrcpy(struct in6_addr *dst, struct in6_addr *src)
{