summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
committerrobert <robert@openbsd.org>2014-06-12 15:27:08 +0000
commit48c5ce6cae7e303dfeee3a51091514ba4307bd3d (patch)
tree2c947b91869e053e1c22daedc8be6fc26be784d6 /usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c
parentDisable the "switch to insertion sort" optimization to avoid quadratic (diff)
downloadwireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.tar.xz
wireguard-openbsd-48c5ce6cae7e303dfeee3a51091514ba4307bd3d.zip
update to 1.6.0 with official syslog support backported from the 1.7 branch
tested by several, ok sthen@
Diffstat (limited to 'usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c')
-rw-r--r--usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c b/usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c
index ed9c5f9e82c..7a621180379 100644
--- a/usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c
+++ b/usr.sbin/nginx/src/http/modules/ngx_http_realip_module.c
@@ -13,6 +13,7 @@
#define NGX_HTTP_REALIP_XREALIP 0
#define NGX_HTTP_REALIP_XFWD 1
#define NGX_HTTP_REALIP_HEADER 2
+#define NGX_HTTP_REALIP_PROXY 3
typedef struct {
@@ -156,6 +157,18 @@ ngx_http_realip_handler(ngx_http_request_t *r)
break;
+ case NGX_HTTP_REALIP_PROXY:
+
+ value = &r->connection->proxy_protocol_addr;
+
+ if (value->len == 0) {
+ return NGX_DECLINED;
+ }
+
+ xfwd = NULL;
+
+ break;
+
default: /* NGX_HTTP_REALIP_HEADER */
part = &r->headers_in.headers.part;
@@ -230,7 +243,8 @@ ngx_http_realip_set_addr(ngx_http_request_t *r, ngx_addr_t *addr)
c = r->connection;
- len = ngx_sock_ntop(addr->sockaddr, text, NGX_SOCKADDR_STRLEN, 0);
+ len = ngx_sock_ntop(addr->sockaddr, addr->socklen, text,
+ NGX_SOCKADDR_STRLEN, 0);
if (len == 0) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
@@ -342,6 +356,11 @@ ngx_http_realip(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_OK;
}
+ if (ngx_strcmp(value[1].data, "proxy_protocol") == 0) {
+ rlcf->type = NGX_HTTP_REALIP_PROXY;
+ return NGX_CONF_OK;
+ }
+
rlcf->type = NGX_HTTP_REALIP_HEADER;
rlcf->hash = ngx_hash_strlow(value[1].data, value[1].data, value[1].len);
rlcf->header = value[1];