diff src/lib/net.c @ 19041:c53ccafc4a8e

Earlier in_port_t fix created problems with service listener configuration. Listeners are disabled with port=0, which was not allowed anymore.
author Stephan Bosch <stephan@rename-it.nl>
date Sun, 30 Aug 2015 00:46:32 +0300
parents aabfe48db1cf
children fefaa6d09a81
line wrap: on
line diff
--- a/src/lib/net.c	Sun Aug 30 00:42:16 2015 +0300
+++ b/src/lib/net.c	Sun Aug 30 00:46:32 2015 +0300
@@ -957,6 +957,19 @@
 	return 0;
 }
 
+int net_str2port_zero(const char *str, in_port_t *port_r)
+{
+	uintmax_t l;
+
+	if (str_to_uintmax(str, &l) < 0)
+		return -1;
+
+	if (l > (in_port_t)-1)
+		return -1;
+	*port_r = (in_port_t)l;
+	return 0;
+}
+
 int net_ipv6_mapped_ipv4_convert(const struct ip_addr *src,
 				 struct ip_addr *dest)
 {