"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
gotwebd: drop `prefixlen' from struct address
To:
gameoftrees@openbsd.org
Date:
Mon, 29 May 2023 17:08:45 +0200

Download raw body.

Thread
it's completely unused.  first step of a few semplifications I'd like
to do around how host() and friends works.

ok?

diff 6c685612338950f89dc47cd0ef36bcd65fe6404f 5da00dc516b55c77c13e148efd5356b509ac4fdb
commit - 6c685612338950f89dc47cd0ef36bcd65fe6404f
commit + 5da00dc516b55c77c13e148efd5356b509ac4fdb
blob - 806012ae38445e49fc3162cd5d209756e7d1e9e4
blob + fae082679ec712db36cb01d56e5edb5857535ab7
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
@@ -267,7 +267,6 @@ struct address {
 	TAILQ_ENTRY(address)	 entry;
 	struct sockaddr_storage	 ss;
 	int			 ipproto;
-	int			 prefixlen;
 	in_port_t		 port;
 	char			 ifname[IFNAMSIZ];
 };
blob - d5a7dbbee8448313fbb103ee1f02db4a45a1bb10
blob + 3b73a07923fb6fec5efd9fea7f055fc7f917cfae
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -1016,10 +1016,6 @@ host_v4(const char *s)
 		fatal(__func__);
 	sain = (struct sockaddr_in *)&h->ss;
 	got_sockaddr_inet_init(sain, &ina);
-	if (sain->sin_addr.s_addr == INADDR_ANY)
-		h->prefixlen = 0; /* 0.0.0.0 address */
-	else
-		h->prefixlen = -1; /* host address */
 	return (h);
 }
 
@@ -1041,11 +1037,6 @@ host_v6(const char *s)
 		ra = (struct sockaddr_in6 *)res->ai_addr;
 		got_sockaddr_inet6_init(sa_in6, &ra->sin6_addr,
 		    ra->sin6_scope_id);
-		if (memcmp(&sa_in6->sin6_addr, &in6addr_any,
-		    sizeof(sa_in6->sin6_addr)) == 0)
-			h->prefixlen = 0; /* any address */
-		else
-			h->prefixlen = -1; /* host address */
 		freeaddrinfo(res);
 	}
 
@@ -1100,7 +1091,6 @@ host_dns(const char *s, struct server *new_srv, int ma
 		if (ipproto != -1)
 			h->ipproto = ipproto;
 		h->ss.ss_family = res->ai_family;
-		h->prefixlen = -1; /* host address */
 
 		if (res->ai_family == AF_INET) {
 			struct sockaddr_in *ra;
@@ -1167,7 +1157,6 @@ host_if(const char *s, struct server *new_srv, int max
 		if (ipproto != -1)
 			h->ipproto = ipproto;
 		h->ss.ss_family = af;
-		h->prefixlen = -1; /* host address */
 
 		if (af == AF_INET) {
 			struct sockaddr_in *ra;
blob - 2e65dd1a33285ce42d25e3660426529b8adb5416
blob + bf53d6f9bff50c34f85de2733fe7ae29ff2401d7
--- gotwebd/sockets.c
+++ gotwebd/sockets.c
@@ -230,7 +230,6 @@ sockets_conf_new_socket_fcgi(struct gotwebd *env, stru
 
 	memcpy(&acp->ss, &a->ss, sizeof(acp->ss));
 	acp->ipproto = a->ipproto;
-	acp->prefixlen = a->prefixlen;
 	acp->port = a->port;
 	if (strlen(a->ifname) != 0) {
 		if (strlcpy(acp->ifname, a->ifname,