mirror of
https://github.com/nginx/nginx.git
synced 2024-12-18 21:23:36 -06:00
Renamed "u" to "sockaddr" in listen options types.
This commit is contained in:
parent
fd064d3b88
commit
5b267a55bc
@ -1161,13 +1161,13 @@ ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
|
||||
}
|
||||
}
|
||||
|
||||
sa = &lsopt->u.sockaddr;
|
||||
sa = &lsopt->sockaddr.sockaddr;
|
||||
|
||||
switch (sa->sa_family) {
|
||||
|
||||
#if (NGX_HAVE_INET6)
|
||||
case AF_INET6:
|
||||
sin6 = &lsopt->u.sockaddr_in6;
|
||||
sin6 = &lsopt->sockaddr.sockaddr_in6;
|
||||
p = sin6->sin6_port;
|
||||
break;
|
||||
#endif
|
||||
@ -1179,7 +1179,7 @@ ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
|
||||
#endif
|
||||
|
||||
default: /* AF_INET */
|
||||
sin = &lsopt->u.sockaddr_in;
|
||||
sin = &lsopt->sockaddr.sockaddr_in;
|
||||
p = sin->sin_port;
|
||||
break;
|
||||
}
|
||||
@ -1233,8 +1233,9 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
|
||||
|
||||
for (i = 0; i < port->addrs.nelts; i++) {
|
||||
|
||||
if (ngx_cmp_sockaddr(&lsopt->u.sockaddr, lsopt->socklen,
|
||||
&addr[i].opt.u.sockaddr, addr[i].opt.socklen, 0)
|
||||
if (ngx_cmp_sockaddr(&lsopt->sockaddr.sockaddr, lsopt->socklen,
|
||||
&addr[i].opt.sockaddr.sockaddr,
|
||||
addr[i].opt.socklen, 0)
|
||||
!= NGX_OK)
|
||||
{
|
||||
continue;
|
||||
@ -1727,7 +1728,8 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
|
||||
ngx_http_core_loc_conf_t *clcf;
|
||||
ngx_http_core_srv_conf_t *cscf;
|
||||
|
||||
ls = ngx_create_listening(cf, &addr->opt.u.sockaddr, addr->opt.socklen);
|
||||
ls = ngx_create_listening(cf, &addr->opt.sockaddr.sockaddr,
|
||||
addr->opt.socklen);
|
||||
if (ls == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1817,7 +1819,7 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_http_port_t *hport,
|
||||
|
||||
for (i = 0; i < hport->naddrs; i++) {
|
||||
|
||||
sin = &addr[i].opt.u.sockaddr_in;
|
||||
sin = &addr[i].opt.sockaddr.sockaddr_in;
|
||||
addrs[i].addr = sin->sin_addr.s_addr;
|
||||
addrs[i].conf.default_server = addr[i].default_server;
|
||||
#if (NGX_HTTP_SSL)
|
||||
@ -1882,7 +1884,7 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_http_port_t *hport,
|
||||
|
||||
for (i = 0; i < hport->naddrs; i++) {
|
||||
|
||||
sin6 = &addr[i].opt.u.sockaddr_in6;
|
||||
sin6 = &addr[i].opt.sockaddr.sockaddr_in6;
|
||||
addrs6[i].addr6 = sin6->sin6_addr;
|
||||
addrs6[i].conf.default_server = addr[i].default_server;
|
||||
#if (NGX_HTTP_SSL)
|
||||
|
@ -3030,7 +3030,7 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
|
||||
if (rv == NGX_CONF_OK && !cscf->listen) {
|
||||
ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
|
||||
|
||||
sin = &lsopt.u.sockaddr_in;
|
||||
sin = &lsopt.sockaddr.sockaddr_in;
|
||||
|
||||
sin->sin_family = AF_INET;
|
||||
#if (NGX_WIN32)
|
||||
@ -3053,8 +3053,8 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
|
||||
#endif
|
||||
lsopt.wildcard = 1;
|
||||
|
||||
(void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.socklen, lsopt.addr,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
(void) ngx_sock_ntop(&lsopt.sockaddr.sockaddr, lsopt.socklen,
|
||||
lsopt.addr, NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
if (ngx_http_add_listen(cf, cscf, &lsopt) != NGX_OK) {
|
||||
return NGX_CONF_ERROR;
|
||||
@ -3998,7 +3998,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t));
|
||||
|
||||
ngx_memcpy(&lsopt.u.sockaddr, &u.sockaddr, u.socklen);
|
||||
ngx_memcpy(&lsopt.sockaddr.sockaddr, &u.sockaddr, u.socklen);
|
||||
|
||||
lsopt.socklen = u.socklen;
|
||||
lsopt.backlog = NGX_LISTEN_BACKLOG;
|
||||
@ -4015,7 +4015,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
lsopt.ipv6only = 1;
|
||||
#endif
|
||||
|
||||
(void) ngx_sock_ntop(&lsopt.u.sockaddr, lsopt.socklen, lsopt.addr,
|
||||
(void) ngx_sock_ntop(&lsopt.sockaddr.sockaddr, lsopt.socklen, lsopt.addr,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
for (n = 2; n < cf->args->nelts; n++) {
|
||||
@ -4144,7 +4144,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = &lsopt.u.sockaddr;
|
||||
sa = &lsopt.sockaddr.sockaddr;
|
||||
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
|
||||
|
@ -58,7 +58,7 @@ typedef struct ngx_http_core_loc_conf_s ngx_http_core_loc_conf_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_sockaddr_t u;
|
||||
ngx_sockaddr_t sockaddr;
|
||||
socklen_t socklen;
|
||||
|
||||
unsigned set:1;
|
||||
|
@ -235,13 +235,13 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
||||
struct sockaddr_in6 *sin6;
|
||||
#endif
|
||||
|
||||
sa = &listen->u.sockaddr;
|
||||
sa = &listen->sockaddr.sockaddr;
|
||||
|
||||
switch (sa->sa_family) {
|
||||
|
||||
#if (NGX_HAVE_INET6)
|
||||
case AF_INET6:
|
||||
sin6 = &listen->u.sockaddr_in6;
|
||||
sin6 = &listen->sockaddr.sockaddr_in6;
|
||||
p = sin6->sin6_port;
|
||||
break;
|
||||
#endif
|
||||
@ -253,7 +253,7 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
||||
#endif
|
||||
|
||||
default: /* AF_INET */
|
||||
sin = &listen->u.sockaddr_in;
|
||||
sin = &listen->sockaddr.sockaddr_in;
|
||||
p = sin->sin_port;
|
||||
break;
|
||||
}
|
||||
@ -340,7 +340,7 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
||||
continue;
|
||||
}
|
||||
|
||||
ls = ngx_create_listening(cf, &addr[i].opt.u.sockaddr,
|
||||
ls = ngx_create_listening(cf, &addr[i].opt.sockaddr.sockaddr,
|
||||
addr[i].opt.socklen);
|
||||
if (ls == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
@ -423,7 +423,7 @@ ngx_mail_add_addrs(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
||||
|
||||
for (i = 0; i < mport->naddrs; i++) {
|
||||
|
||||
sin = &addr[i].opt.u.sockaddr_in;
|
||||
sin = &addr[i].opt.sockaddr.sockaddr_in;
|
||||
addrs[i].addr = sin->sin_addr.s_addr;
|
||||
|
||||
addrs[i].conf.ctx = addr[i].opt.ctx;
|
||||
@ -431,8 +431,8 @@ ngx_mail_add_addrs(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
||||
addrs[i].conf.ssl = addr[i].opt.ssl;
|
||||
#endif
|
||||
|
||||
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
len = ngx_sock_ntop(&addr[i].opt.sockaddr.sockaddr, addr[i].opt.socklen,
|
||||
buf, NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
p = ngx_pnalloc(cf->pool, len);
|
||||
if (p == NULL) {
|
||||
@ -472,7 +472,7 @@ ngx_mail_add_addrs6(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
||||
|
||||
for (i = 0; i < mport->naddrs; i++) {
|
||||
|
||||
sin6 = &addr[i].opt.u.sockaddr_in6;
|
||||
sin6 = &addr[i].opt.sockaddr.sockaddr_in6;
|
||||
addrs6[i].addr6 = sin6->sin6_addr;
|
||||
|
||||
addrs6[i].conf.ctx = addr[i].opt.ctx;
|
||||
@ -480,8 +480,8 @@ ngx_mail_add_addrs6(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
||||
addrs6[i].conf.ssl = addr[i].opt.ssl;
|
||||
#endif
|
||||
|
||||
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
len = ngx_sock_ntop(&addr[i].opt.sockaddr.sockaddr, addr[i].opt.socklen,
|
||||
buf, NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
p = ngx_pnalloc(cf->pool, len);
|
||||
if (p == NULL) {
|
||||
|
@ -27,7 +27,7 @@ typedef struct {
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_sockaddr_t u;
|
||||
ngx_sockaddr_t sockaddr;
|
||||
socklen_t socklen;
|
||||
|
||||
/* server ctx */
|
||||
|
@ -318,7 +318,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
for (i = 0; i < cmcf->listen.nelts; i++) {
|
||||
|
||||
if (ngx_cmp_sockaddr(&ls[i].u.sockaddr, ls[i].socklen,
|
||||
if (ngx_cmp_sockaddr(&ls[i].sockaddr.sockaddr, ls[i].socklen,
|
||||
(struct sockaddr *) &u.sockaddr, u.socklen, 1)
|
||||
!= NGX_OK)
|
||||
{
|
||||
@ -337,7 +337,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
ngx_memzero(ls, sizeof(ngx_mail_listen_t));
|
||||
|
||||
ngx_memcpy(&ls->u.sockaddr, &u.sockaddr, u.socklen);
|
||||
ngx_memcpy(&ls->sockaddr.sockaddr, &u.sockaddr, u.socklen);
|
||||
|
||||
ls->socklen = u.socklen;
|
||||
ls->backlog = NGX_LISTEN_BACKLOG;
|
||||
@ -394,7 +394,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
size_t len;
|
||||
u_char buf[NGX_SOCKADDR_STRLEN];
|
||||
|
||||
if (ls->u.sockaddr.sa_family == AF_INET6) {
|
||||
if (ls->sockaddr.sockaddr.sa_family == AF_INET6) {
|
||||
|
||||
if (ngx_strcmp(&value[i].data[10], "n") == 0) {
|
||||
ls->ipv6only = 1;
|
||||
@ -412,7 +412,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
ls->bind = 1;
|
||||
|
||||
} else {
|
||||
len = ngx_sock_ntop(&ls->u.sockaddr, ls->socklen, buf,
|
||||
len = ngx_sock_ntop(&ls->sockaddr.sockaddr, ls->socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
|
@ -250,13 +250,13 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
||||
struct sockaddr_in6 *sin6;
|
||||
#endif
|
||||
|
||||
sa = &listen->u.sockaddr;
|
||||
sa = &listen->sockaddr.sockaddr;
|
||||
|
||||
switch (sa->sa_family) {
|
||||
|
||||
#if (NGX_HAVE_INET6)
|
||||
case AF_INET6:
|
||||
sin6 = &listen->u.sockaddr_in6;
|
||||
sin6 = &listen->sockaddr.sockaddr_in6;
|
||||
p = sin6->sin6_port;
|
||||
break;
|
||||
#endif
|
||||
@ -268,7 +268,7 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
||||
#endif
|
||||
|
||||
default: /* AF_INET */
|
||||
sin = &listen->u.sockaddr_in;
|
||||
sin = &listen->sockaddr.sockaddr_in;
|
||||
p = sin->sin_port;
|
||||
break;
|
||||
}
|
||||
@ -359,7 +359,7 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
||||
continue;
|
||||
}
|
||||
|
||||
ls = ngx_create_listening(cf, &addr[i].opt.u.sockaddr,
|
||||
ls = ngx_create_listening(cf, &addr[i].opt.sockaddr.sockaddr,
|
||||
addr[i].opt.socklen);
|
||||
if (ls == NULL) {
|
||||
return NGX_CONF_ERROR;
|
||||
@ -453,7 +453,7 @@ ngx_stream_add_addrs(ngx_conf_t *cf, ngx_stream_port_t *stport,
|
||||
|
||||
for (i = 0; i < stport->naddrs; i++) {
|
||||
|
||||
sin = &addr[i].opt.u.sockaddr_in;
|
||||
sin = &addr[i].opt.sockaddr.sockaddr_in;
|
||||
addrs[i].addr = sin->sin_addr.s_addr;
|
||||
|
||||
addrs[i].conf.ctx = addr[i].opt.ctx;
|
||||
@ -461,8 +461,8 @@ ngx_stream_add_addrs(ngx_conf_t *cf, ngx_stream_port_t *stport,
|
||||
addrs[i].conf.ssl = addr[i].opt.ssl;
|
||||
#endif
|
||||
|
||||
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
len = ngx_sock_ntop(&addr[i].opt.sockaddr.sockaddr, addr[i].opt.socklen,
|
||||
buf, NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
p = ngx_pnalloc(cf->pool, len);
|
||||
if (p == NULL) {
|
||||
@ -502,7 +502,7 @@ ngx_stream_add_addrs6(ngx_conf_t *cf, ngx_stream_port_t *stport,
|
||||
|
||||
for (i = 0; i < stport->naddrs; i++) {
|
||||
|
||||
sin6 = &addr[i].opt.u.sockaddr_in6;
|
||||
sin6 = &addr[i].opt.sockaddr.sockaddr_in6;
|
||||
addrs6[i].addr6 = sin6->sin6_addr;
|
||||
|
||||
addrs6[i].conf.ctx = addr[i].opt.ctx;
|
||||
@ -510,8 +510,8 @@ ngx_stream_add_addrs6(ngx_conf_t *cf, ngx_stream_port_t *stport,
|
||||
addrs6[i].conf.ssl = addr[i].opt.ssl;
|
||||
#endif
|
||||
|
||||
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
len = ngx_sock_ntop(&addr[i].opt.sockaddr.sockaddr, addr[i].opt.socklen,
|
||||
buf, NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
p = ngx_pnalloc(cf->pool, len);
|
||||
if (p == NULL) {
|
||||
|
@ -31,7 +31,7 @@ typedef struct {
|
||||
|
||||
|
||||
typedef struct {
|
||||
ngx_sockaddr_t u;
|
||||
ngx_sockaddr_t sockaddr;
|
||||
socklen_t socklen;
|
||||
|
||||
/* server ctx */
|
||||
|
@ -280,7 +280,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
|
||||
ngx_memzero(ls, sizeof(ngx_stream_listen_t));
|
||||
|
||||
ngx_memcpy(&ls->u.sockaddr, &u.sockaddr, u.socklen);
|
||||
ngx_memcpy(&ls->sockaddr.sockaddr, &u.sockaddr, u.socklen);
|
||||
|
||||
ls->socklen = u.socklen;
|
||||
ls->backlog = NGX_LISTEN_BACKLOG;
|
||||
@ -328,7 +328,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
size_t len;
|
||||
u_char buf[NGX_SOCKADDR_STRLEN];
|
||||
|
||||
if (ls->u.sockaddr.sa_family == AF_INET6) {
|
||||
if (ls->sockaddr.sockaddr.sa_family == AF_INET6) {
|
||||
|
||||
if (ngx_strcmp(&value[i].data[10], "n") == 0) {
|
||||
ls->ipv6only = 1;
|
||||
@ -346,7 +346,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
ls->bind = 1;
|
||||
|
||||
} else {
|
||||
len = ngx_sock_ntop(&ls->u.sockaddr, ls->socklen, buf,
|
||||
len = ngx_sock_ntop(&ls->sockaddr.sockaddr, ls->socklen, buf,
|
||||
NGX_SOCKADDR_STRLEN, 1);
|
||||
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
@ -505,8 +505,8 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ngx_cmp_sockaddr(&als[i].u.sockaddr, als[i].socklen,
|
||||
&ls->u.sockaddr, ls->socklen, 1)
|
||||
if (ngx_cmp_sockaddr(&als[i].sockaddr.sockaddr, als[i].socklen,
|
||||
&ls->sockaddr.sockaddr, ls->socklen, 1)
|
||||
!= NGX_OK)
|
||||
{
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user