diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-03-23 12:52:33 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-03-23 12:52:33 +0000 |
| commit | 7755b904ce340eed688e98bee962c1101ce203b5 (patch) | |
| tree | 1e8655f5f2670819befbc82e017eb0fa415904cb /src/http/modules/ngx_http_upstream_ip_hash_module.c | |
| parent | 77d7f80285c93510b54df15267155d3a778e7071 (diff) | |
| download | nginx-7755b904ce340eed688e98bee962c1101ce203b5.tar.gz nginx-7755b904ce340eed688e98bee962c1101ce203b5.tar.bz2 | |
ip_hash used wrong byte order
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 | 8 |
1 files changed, 5 insertions, 3 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 87e5ac4d2..ba1cd53ff 100644 --- a/src/http/modules/ngx_http_upstream_ip_hash_module.c +++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c @@ -93,6 +93,7 @@ static ngx_int_t ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r, ngx_http_upstream_srv_conf_t *us) { + u_char *p; struct sockaddr_in *sin; ngx_http_upstream_ip_hash_peer_data_t *iphp; @@ -111,9 +112,10 @@ ngx_http_upstream_init_ip_hash_peer(ngx_http_request_t *r, /* AF_INET only */ sin = (struct sockaddr_in *) r->connection->sockaddr; - iphp->addr[0] = (u_char) ((sin->sin_addr.s_addr >> 24) & 0xff); - iphp->addr[1] = (u_char) ((sin->sin_addr.s_addr >> 16) & 0xff); - iphp->addr[2] = (u_char) ((sin->sin_addr.s_addr >> 8) & 0xff); + p = (u_char *) &sin->sin_addr.s_addr; + iphp->addr[0] = p[0]; + iphp->addr[1] = p[1]; + iphp->addr[2] = p[2]; iphp->hash = 89; iphp->tries = 0; |
