aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2012-05-14 15:52:37 +0000
committerRuslan Ermilov <ru@nginx.com>2012-05-14 15:52:37 +0000
commit9a79c3431afd57cb8280af41a33d173d53c95394 (patch)
treeb30d48a271629a5e48078439db8f9a617cda999b /src/http/ngx_http_core_module.c
parentd4ba06c31a09fd82a1a2b8046384b6c136df0aae (diff)
downloadnginx-9a79c3431afd57cb8280af41a33d173d53c95394.tar.gz
nginx-9a79c3431afd57cb8280af41a33d173d53c95394.zip
Reverted previous attempt to fix complation warning introduced in
r4624 and actually fixed it.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 1aef755a1..471a53cf8 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -2713,30 +2713,29 @@ ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr,
struct in6_addr *inaddr6;
#endif
+#if (NGX_SUPPRESS_WARN)
+ inaddr = NULL;
+#if (NGX_HAVE_INET6)
+ inaddr6 = NULL;
+#endif
+#endif
+
family = addr->sockaddr->sa_family;
- switch (family) {
+ if (family == AF_INET) {
+ inaddr = &((struct sockaddr_in *) addr->sockaddr)->sin_addr.s_addr;
+ }
#if (NGX_HAVE_INET6)
- case AF_INET6:
+ else if (family == AF_INET6) {
inaddr6 = &((struct sockaddr_in6 *) addr->sockaddr)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
family = AF_INET;
inaddr = (in_addr_t *) &inaddr6->s6_addr[12];
}
-
- break;
-#endif
-
-#if (NGX_HAVE_UNIX_DOMAIN)
- case AF_UNIX:
- break;
-#endif
-
- default: /* AF_INET */
- inaddr = &((struct sockaddr_in *) addr->sockaddr)->sin_addr.s_addr;
}
+#endif
for (cidr = proxies->elts, i = 0; i < proxies->nelts; i++) {
if (cidr[i].family != family) {