commit 13b527d9f7a404e302b54452dd2eb9fc65ed9bab from: Omar Polo via: Thomas Adam date: Fri Nov 03 17:08:16 2023 UTC gotwebd: remove dead ipproto handling in host() and host_if() ipproto is always -1, so delete the dead code. ok stsp@ commit - 2c29eec0530d2a05c4729d8414aa3f3a6540971e commit + 13b527d9f7a404e302b54452dd2eb9fc65ed9bab blob - 3141033d45e0ffee23a98bd4f3343dc3b12af2d1 blob + 738b9f16b53bd9108407056a22218f143179fea7 --- gotwebd/parse.y +++ gotwebd/parse.y @@ -101,9 +101,9 @@ int addr_dup_check(struct addresslist *, struct addr const char *, const char *); int add_addr(struct server *, struct address *); int host(const char *, struct server *, - int, in_port_t, const char *, int); + int, in_port_t, const char *); int host_if(const char *, struct server *, - int, in_port_t, const char *, int); + int, in_port_t, const char *); int is_if_in_group(const char *, const char *); typedef struct { @@ -1025,7 +1025,7 @@ getservice(const char *n) int host(const char *s, struct server *new_srv, int max, - in_port_t port, const char *ifname, int ipproto) + in_port_t port, const char *ifname) { struct addrinfo hints, *res0, *res; int error, cnt = 0; @@ -1033,7 +1033,7 @@ host(const char *s, struct server *new_srv, int max, struct sockaddr_in6 *sin6; struct address *h; - if ((cnt = host_if(s, new_srv, max, port, ifname, ipproto)) != 0) + if ((cnt = host_if(s, new_srv, max, port, ifname)) != 0) return (cnt); memset(&hints, 0, sizeof(hints)); @@ -1068,8 +1068,6 @@ host(const char *s, struct server *new_srv, int max, return (-1); } } - if (ipproto != -1) - h->ipproto = ipproto; h->ss.ss_family = res->ai_family; if (res->ai_family == AF_INET) { @@ -1098,7 +1096,7 @@ host(const char *s, struct server *new_srv, int max, int host_if(const char *s, struct server *new_srv, int max, - in_port_t port, const char *ifname, int ipproto) + in_port_t port, const char *ifname) { struct ifaddrs *ifap, *p; struct sockaddr_in *sain; @@ -1134,8 +1132,6 @@ host_if(const char *s, struct server *new_srv, int max return (-1); } } - if (ipproto != -1) - h->ipproto = ipproto; h->ss.ss_family = af; if (af == AF_INET) { @@ -1222,19 +1218,17 @@ int get_addrs(const char *addr, struct server *new_srv, in_port_t port) { if (strcmp("", addr) == 0) { - if (host("127.0.0.1", new_srv, 1, port, "127.0.0.1", - -1) <= 0) { + if (host("127.0.0.1", new_srv, 1, port, "127.0.0.1") <= 0) { yyerror("invalid listen ip: %s", "127.0.0.1"); return (-1); } - if (host("::1", new_srv, 1, port, "::1", -1) <= 0) { + if (host("::1", new_srv, 1, port, "::1") <= 0) { yyerror("invalid listen ip: %s", "::1"); return (-1); } } else { - if (host(addr, new_srv, GOTWEBD_MAXIFACE, port, addr, - -1) <= 0) { + if (host(addr, new_srv, GOTWEBD_MAXIFACE, port, addr) <= 0) { yyerror("invalid listen ip: %s", addr); return (-1); }