comparison src/stream/ngx_stream_realip_module.c @ 7590:06b01840bd42

Core: moved PROXY protocol fields out of ngx_connection_t. Now a new structure ngx_proxy_protocol_t holds these fields. This allows to add more PROXY protocol fields in the future without modifying the connection structure.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 21 Oct 2019 18:06:19 +0300
parents 2a288909abc6
children
comparison
equal deleted inserted replaced
7589:486d2e0b1b6f 7590:06b01840bd42
106 return NGX_DECLINED; 106 return NGX_DECLINED;
107 } 107 }
108 108
109 c = s->connection; 109 c = s->connection;
110 110
111 if (c->proxy_protocol_addr.len == 0) { 111 if (c->proxy_protocol == NULL) {
112 return NGX_DECLINED; 112 return NGX_DECLINED;
113 } 113 }
114 114
115 if (ngx_cidr_match(c->sockaddr, rscf->from) != NGX_OK) { 115 if (ngx_cidr_match(c->sockaddr, rscf->from) != NGX_OK) {
116 return NGX_DECLINED; 116 return NGX_DECLINED;
117 } 117 }
118 118
119 if (ngx_parse_addr(c->pool, &addr, c->proxy_protocol_addr.data, 119 if (ngx_parse_addr(c->pool, &addr, c->proxy_protocol->src_addr.data,
120 c->proxy_protocol_addr.len) 120 c->proxy_protocol->src_addr.len)
121 != NGX_OK) 121 != NGX_OK)
122 { 122 {
123 return NGX_DECLINED; 123 return NGX_DECLINED;
124 } 124 }
125 125
126 ngx_inet_set_port(addr.sockaddr, c->proxy_protocol_port); 126 ngx_inet_set_port(addr.sockaddr, c->proxy_protocol->src_port);
127 127
128 return ngx_stream_realip_set_addr(s, &addr); 128 return ngx_stream_realip_set_addr(s, &addr);
129 } 129 }
130 130
131 131