From b8dd96f0a4171fafd70b96393f2b5d828177db7d Mon Sep 17 00:00:00 2001 From: Marc Balmer Date: Wed, 21 May 2008 11:28:49 +0000 Subject: Remove #ifndef SIN6_LEN/#else/#endif constructs. Suggested by djm a while ago. No binary changes. --- usr.sbin/httpd/src/main/http_core.c | 10 +--------- usr.sbin/httpd/src/main/http_main.c | 26 ++++---------------------- usr.sbin/httpd/src/main/http_vhost.c | 15 +-------------- usr.sbin/httpd/src/main/rfc1413.c | 21 +++------------------ 4 files changed, 9 insertions(+), 63 deletions(-) diff --git a/usr.sbin/httpd/src/main/http_core.c b/usr.sbin/httpd/src/main/http_core.c index c5043c0286e..229c213215a 100644 --- a/usr.sbin/httpd/src/main/http_core.c +++ b/usr.sbin/httpd/src/main/http_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_core.c,v 1.24 2008/05/15 06:05:43 mbalmer Exp $ */ +/* $OpenBSD: http_core.c,v 1.25 2008/05/21 11:28:48 mbalmer Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -678,11 +678,7 @@ ap_get_remote_host(conn_rec *conn, void *dir_config, int type) old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, (request_rec*)NULL); if (!getnameinfo((struct sockaddr *)&conn->remote_addr, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *)&conn->remote_addr), -#else conn->remote_addr.ss_len, -#endif hostnamebuf, sizeof(hostnamebuf), NULL, 0, 0)) { conn->remote_host = ap_pstrdup(conn->pool, (void *)hostnamebuf); @@ -769,11 +765,7 @@ ap_get_server_name(request_rec *r) old_stat = ap_update_child_status(conn->child_num, SERVER_BUSY_DNS, r); if (getnameinfo((struct sockaddr *)&conn->local_addr, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *)&conn->local_addr), -#else conn->local_addr.ss_len, -#endif hbuf, sizeof(hbuf), NULL, 0, 0) == 0) conn->local_host = ap_pstrdup(conn->pool, hbuf); else diff --git a/usr.sbin/httpd/src/main/http_main.c b/usr.sbin/httpd/src/main/http_main.c index 28db0863353..5af9803f4a1 100644 --- a/usr.sbin/httpd/src/main/http_main.c +++ b/usr.sbin/httpd/src/main/http_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_main.c,v 1.51 2008/05/21 08:57:38 mbalmer Exp $ */ +/* $OpenBSD: http_main.c,v 1.52 2008/05/21 11:28:48 mbalmer Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -1826,11 +1826,7 @@ static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, conn->child_num = child_num; conn->pool = p; -#ifndef SIN6_LEN - addr_len = SA_LEN(saddr); -#else addr_len = saddr->sa_len; -#endif memcpy(&conn->local_addr, saddr, addr_len); getnameinfo((struct sockaddr *)&conn->local_addr, addr_len, hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); @@ -1840,11 +1836,7 @@ static conn_rec *new_connection(pool *p, server_rec *server, BUFF *inout, conn->base_server = conn->server; conn->client = inout; -#ifndef SIN6_LEN - addr_len = SA_LEN(remaddr); -#else addr_len = remaddr->sa_len; -#endif memcpy(&conn->remote_addr, remaddr, addr_len); getnameinfo((struct sockaddr *)&conn->remote_addr, addr_len, hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); @@ -1914,13 +1906,8 @@ static int make_sock(pool *p, const struct sockaddr *server) exit(1); } - getnameinfo(server, -#ifndef SIN6_LEN - SA_LEN(server), -#else - server->sa_len, -#endif - a0, sizeof(a0), p0, sizeof(p0), NI_NUMERICHOST | NI_NUMERICSERV); + getnameinfo(server, server->sa_len, a0, sizeof(a0), p0, sizeof(p0), + NI_NUMERICHOST | NI_NUMERICSERV); ap_snprintf(addr, sizeof(addr), "address %s port %s", a0, p0); #ifdef MPE if (atoi(p0) < 1024) @@ -1990,12 +1977,7 @@ static int make_sock(pool *p, const struct sockaddr *server) } } -#ifndef SIN6_LEN - if (bind(s, server, SA_LEN(server)) == -1) -#else - if (bind(s, server, server->sa_len) == -1) -#endif - { + if (bind(s, server, server->sa_len) == -1) { ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf, "make_sock: could not bind to %s", addr); diff --git a/usr.sbin/httpd/src/main/http_vhost.c b/usr.sbin/httpd/src/main/http_vhost.c index b54a6e0dc18..c0434c496ef 100644 --- a/usr.sbin/httpd/src/main/http_vhost.c +++ b/usr.sbin/httpd/src/main/http_vhost.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_vhost.c,v 1.10 2008/05/21 08:44:19 mbalmer Exp $ */ +/* $OpenBSD: http_vhost.c,v 1.11 2008/05/21 11:28:48 mbalmer Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -813,11 +813,7 @@ ap_fini_vhost_config(pool *p, server_rec *main_s) if (!getnameinfo( (struct sockaddr *)&s->addrs->host_addr, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *)&s->addrs->host_addr), -#else s->addrs->host_addr.ss_len, -#endif hostnamebuf, sizeof(hostnamebuf), NULL, 0, 0)) s->server_hostname = @@ -828,12 +824,7 @@ ap_fini_vhost_config(pool *p, server_rec *main_s) * isn't working. -djg */ getnameinfo((struct sockaddr *) &s->addrs->host_addr, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *) - &s->addrs->host_addr), -#else s->addrs->host_addr.ss_len, -#endif hostnamebuf, sizeof(hostnamebuf), NULL, 0, NI_NUMERICHOST); @@ -1204,11 +1195,7 @@ ap_update_vhost_given_ip(conn_rec *conn) unsigned port; if (getnameinfo((struct sockaddr *)&conn->local_addr, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *)&conn->local_addr), -#else conn->local_addr.ss_len, -#endif NULL, 0, portbuf, sizeof(portbuf), NI_NUMERICSERV) != 0) goto fail; diff --git a/usr.sbin/httpd/src/main/rfc1413.c b/usr.sbin/httpd/src/main/rfc1413.c index e6717d7444d..39c9fe38b6e 100644 --- a/usr.sbin/httpd/src/main/rfc1413.c +++ b/usr.sbin/httpd/src/main/rfc1413.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rfc1413.c,v 1.13 2008/05/15 06:05:43 mbalmer Exp $ */ +/* $OpenBSD: rfc1413.c,v 1.14 2008/05/21 11:28:48 mbalmer Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -135,13 +135,8 @@ get_rfc1413(int sock, const struct sockaddr *our_sin, * addresses from the query socket. */ -#ifndef SIN6_LEN - memcpy(&our_query_sin, our_sin, SA_LEN(our_sin)); - memcpy(&rmt_query_sin, rmt_sin, SA_LEN(rmt_sin)); -#else memcpy(&our_query_sin, our_sin, our_sin->sa_len); memcpy(&rmt_query_sin, rmt_sin, rmt_sin->sa_len); -#endif switch (our_sin->sa_family) { case AF_INET: ((struct sockaddr_in *)&our_query_sin)->sin_port = @@ -167,12 +162,7 @@ get_rfc1413(int sock, const struct sockaddr *our_sin, } if (bind(sock, (struct sockaddr *) &our_query_sin, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *) &our_query_sin) -#else - our_query_sin.ss_len -#endif - ) < 0) { + our_query_sin.ss_len) < 0) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, "bind: rfc1413: Error binding to local port"); return -1; @@ -183,12 +173,7 @@ get_rfc1413(int sock, const struct sockaddr *our_sin, * support the service */ if (connect(sock, (struct sockaddr *) &rmt_query_sin, -#ifndef SIN6_LEN - SA_LEN((struct sockaddr *) &rmt_query_sin) -#else - rmt_query_sin.ss_len -#endif - ) < 0) + rmt_query_sin.ss_len) < 0) return -1; /* send the data */ -- cgit v1.2.3