| 1 | Index: src/http/ngx_http_core_module.c
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- src/http/ngx_http_core_module.c (revision 4824)
|
|---|
| 4 | +++ src/http/ngx_http_core_module.c (working copy)
|
|---|
| 5 | @@ -2776,7 +2776,13 @@ ngx_http_get_forwarded_addr(ngx_http_req
|
|---|
| 6 |
|
|---|
| 7 | if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
|
|---|
| 8 | family = AF_INET;
|
|---|
| 9 | - inaddr = *(in_addr_t *) &inaddr6->s6_addr[12];
|
|---|
| 10 | +
|
|---|
| 11 | + p = inaddr6->s6_addr;
|
|---|
| 12 | +
|
|---|
| 13 | + inaddr = p[12] << 24;
|
|---|
| 14 | + inaddr += p[13] << 16;
|
|---|
| 15 | + inaddr += p[14] << 8;
|
|---|
| 16 | + inaddr += p[15];
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 | #endif
|
|---|
| 20 | Index: src/http/modules/ngx_http_geo_module.c
|
|---|
| 21 | ===================================================================
|
|---|
| 22 | --- src/http/modules/ngx_http_geo_module.c (revision 4824)
|
|---|
| 23 | +++ src/http/modules/ngx_http_geo_module.c (working copy)
|
|---|
| 24 | @@ -233,12 +233,20 @@ ngx_http_geo_addr(ngx_http_request_t *r,
|
|---|
| 25 | #if (NGX_HAVE_INET6)
|
|---|
| 26 |
|
|---|
| 27 | if (addr.sockaddr->sa_family == AF_INET6) {
|
|---|
| 28 | + u_char *p;
|
|---|
| 29 | + in_addr_t inaddr;
|
|---|
| 30 | struct in6_addr *inaddr6;
|
|---|
| 31 |
|
|---|
| 32 | inaddr6 = &((struct sockaddr_in6 *) addr.sockaddr)->sin6_addr;
|
|---|
| 33 |
|
|---|
| 34 | if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
|
|---|
| 35 | - return ntohl(*(in_addr_t *) &inaddr6->s6_addr[12]);
|
|---|
| 36 | + p = inaddr6->s6_addr;
|
|---|
| 37 | +
|
|---|
| 38 | + inaddr = p[12] << 24;
|
|---|
| 39 | + inaddr += p[13] << 16;
|
|---|
| 40 | + inaddr += p[14] << 8;
|
|---|
| 41 | + inaddr += p[15];
|
|---|
| 42 | + return inaddr;
|
|---|
| 43 | }
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | Index: src/http/modules/ngx_http_geoip_module.c
|
|---|
| 47 | ===================================================================
|
|---|
| 48 | --- src/http/modules/ngx_http_geoip_module.c (revision 4824)
|
|---|
| 49 | +++ src/http/modules/ngx_http_geoip_module.c (working copy)
|
|---|
| 50 | @@ -226,12 +226,20 @@ ngx_http_geoip_addr(ngx_http_request_t *
|
|---|
| 51 | #if (NGX_HAVE_INET6)
|
|---|
| 52 |
|
|---|
| 53 | if (addr.sockaddr->sa_family == AF_INET6) {
|
|---|
| 54 | + u_char *p;
|
|---|
| 55 | + in_addr_t inaddr;
|
|---|
| 56 | struct in6_addr *inaddr6;
|
|---|
| 57 |
|
|---|
| 58 | inaddr6 = &((struct sockaddr_in6 *) addr.sockaddr)->sin6_addr;
|
|---|
| 59 |
|
|---|
| 60 | if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
|
|---|
| 61 | - return ntohl(*(in_addr_t *) &inaddr6->s6_addr[12]);
|
|---|
| 62 | + p = inaddr6->s6_addr;
|
|---|
| 63 | +
|
|---|
| 64 | + inaddr = p[12] << 24;
|
|---|
| 65 | + inaddr += p[13] << 16;
|
|---|
| 66 | + inaddr += p[14] << 8;
|
|---|
| 67 | + inaddr += p[15];
|
|---|
| 68 | + return inaddr;
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|