diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-02-21 07:02:02 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-02-21 07:02:02 +0000 |
commit | a35eaccdec4788e8fb9a883b26fc7c4dcfe1d8f8 (patch) | |
tree | b42648c4cb4eb2cb4a1e585ed7870ede0f551600 /src/http/modules/ngx_http_upstream_ip_hash_module.c | |
parent | a883361c47c4fa1abf35fe2497e2bb74d9299e3e (diff) | |
download | nginx-a35eaccdec4788e8fb9a883b26fc7c4dcfe1d8f8.tar.gz nginx-a35eaccdec4788e8fb9a883b26fc7c4dcfe1d8f8.zip |
a prelimiary IPv6 support, HTTP listen
Diffstat (limited to 'src/http/modules/ngx_http_upstream_ip_hash_module.c')
-rw-r--r-- | src/http/modules/ngx_http_upstream_ip_hash_module.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c index 1d13481a9..dffbf22b2 100644 --- a/src/http/modules/ngx_http_upstream_ip_hash_module.c +++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c @@ -15,7 +15,6 @@ typedef struct { ngx_uint_t hash; - /* AF_INET only */ u_char addr[3]; u_char tries; @@ -111,11 +110,20 @@ ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r, r->upstream->peer.get = ngx_http_upstream_get_ip_hash_peer; /* AF_INET only */ - sin = (struct sockaddr_in *) r->connection->sockaddr; - p = (u_char *) &sin->sin_addr.s_addr; - iphp->addr[0] = p[0]; - iphp->addr[1] = p[1]; - iphp->addr[2] = p[2]; + + if (r->connection->sockaddr->sa_family == AF_INET) { + + sin = (struct sockaddr_in *) r->connection->sockaddr; + p = (u_char *) &sin->sin_addr.s_addr; + iphp->addr[0] = p[0]; + iphp->addr[1] = p[1]; + iphp->addr[2] = p[2]; + + } else { + iphp->addr[0] = 0; + iphp->addr[1] = 0; + iphp->addr[2] = 0; + } iphp->hash = 89; iphp->tries = 0; |