Commit Diff


commit - d72940a3a166aaa6620b4b444af1fa16b5e216f5
commit + 859aa9f48371a84128b60e2c2ba9f873a4ea70cf
blob - b23d9fe465844dc654c2dce903331128cc7ae3f1
blob + 601286fd54eb92e666ed42a52b7d7a851eb91940
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -1037,10 +1037,10 @@ getservice(const char *n)
 			s = getservbyname(n, "udp");
 		if (s == NULL)
 			return (-1);
-		return htons(s->s_port);
+		return ntohs(s->s_port);
 	}
 
-	return (htons((unsigned short)llval));
+	return (unsigned short)llval;
 }
 
 struct address *
blob - 836377578903d72f44f5cc1ae1fecf1e440af00c
blob + 25fab90e6eb901da603fae558a1308fabac74bf1
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
@@ -486,10 +486,10 @@ sockets_create_socket(struct address *a, in_port_t por
 
 	switch (a->ss.ss_family) {
 	case AF_INET:
-		((struct sockaddr_in *)(&a->ss))->sin_port = port;
+		((struct sockaddr_in *)(&a->ss))->sin_port = htons(port);
 		break;
 	case AF_INET6:
-		((struct sockaddr_in6 *)(&a->ss))->sin6_port = port;
+		((struct sockaddr_in6 *)(&a->ss))->sin6_port = htons(port);
 		break;
 	default:
 		log_warnx("%s: unknown address family", __func__);