Klaus Demo nginx / cadc8ca
Core: fixed build, broken by 63e91f263a49. Both Solaris and Windows define "s_addr" as a macro. Vladimir Homutov 3 years ago
1 changed file(s) with 18 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
2424
2525
2626 typedef struct {
27 u_char s_addr[4];
28 u_char d_addr[4];
29 u_char s_port[2];
30 u_char d_port[2];
27 u_char src_addr[4];
28 u_char dst_addr[4];
29 u_char src_port[2];
30 u_char dst_port[2];
3131 } ngx_proxy_protocol_inet_addrs_t;
3232
3333
3434 typedef struct {
35 u_char s_addr[16];
36 u_char d_addr[16];
37 u_char s_port[2];
38 u_char d_port[2];
35 u_char src_addr[16];
36 u_char dst_addr[16];
37 u_char src_port[2];
38 u_char dst_port[2];
3939 } ngx_proxy_protocol_inet6_addrs_t;
4040
4141
220220 ngx_uint_t version, command, family, transport;
221221 ngx_sockaddr_t sockaddr;
222222 ngx_proxy_protocol_header_t *header;
223 ngx_proxy_protocol_inet_addrs_t *inet;
223 ngx_proxy_protocol_inet_addrs_t *in;
224224 #if (NGX_HAVE_INET6)
225 ngx_proxy_protocol_inet6_addrs_t *inet6;
225 ngx_proxy_protocol_inet6_addrs_t *in6;
226226 #endif
227227
228228 header = (ngx_proxy_protocol_header_t *) buf;
275275 return NULL;
276276 }
277277
278 inet = (ngx_proxy_protocol_inet_addrs_t *) buf;
278 in = (ngx_proxy_protocol_inet_addrs_t *) buf;
279279
280280 sockaddr.sockaddr_in.sin_family = AF_INET;
281281 sockaddr.sockaddr_in.sin_port = 0;
282 memcpy(&sockaddr.sockaddr_in.sin_addr, inet->s_addr, 4);
283
284 c->proxy_protocol_port = ngx_proxy_protocol_parse_uint16(inet->s_port);
282 memcpy(&sockaddr.sockaddr_in.sin_addr, in->src_addr, 4);
283
284 c->proxy_protocol_port = ngx_proxy_protocol_parse_uint16(in->src_port);
285285
286286 socklen = sizeof(struct sockaddr_in);
287287
297297 return NULL;
298298 }
299299
300 inet6 = (ngx_proxy_protocol_inet6_addrs_t *) buf;
300 in6 = (ngx_proxy_protocol_inet6_addrs_t *) buf;
301301
302302 sockaddr.sockaddr_in6.sin6_family = AF_INET6;
303303 sockaddr.sockaddr_in6.sin6_port = 0;
304 memcpy(&sockaddr.sockaddr_in6.sin6_addr, inet6->s_addr, 16);
305
306 c->proxy_protocol_port = ngx_proxy_protocol_parse_uint16(inet6->s_port);
304 memcpy(&sockaddr.sockaddr_in6.sin6_addr, in6->src_addr, 16);
305
306 c->proxy_protocol_port = ngx_proxy_protocol_parse_uint16(in6->src_port);
307307
308308 socklen = sizeof(struct sockaddr_in6);
309309