diff options
author | Roman Arutyunyan <arut@nginx.com> | 2024-05-03 20:26:05 +0400 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2024-05-03 20:26:05 +0400 |
commit | 489e1e61912a808fdaffb4f513426cb285f267a3 (patch) | |
tree | cccbe3b0eb1b148f2bf32c82ca29bc5e08c92534 /src/stream/ngx_stream_pass_module.c | |
parent | 6f7494081ae8a56664afb480eff583d639b60ab4 (diff) | |
download | nginx-489e1e61912a808fdaffb4f513426cb285f267a3.tar.gz nginx-489e1e61912a808fdaffb4f513426cb285f267a3.zip |
Stream pass: disabled passing from or to udp.
Passing from udp was not possible for the most part due to preread buffer
restriction. Passing to udp could occasionally work, but the connection would
still be bound to the original listen rbtree, which prevented it from being
deleted on connection closure.
Diffstat (limited to 'src/stream/ngx_stream_pass_module.c')
-rw-r--r-- | src/stream/ngx_stream_pass_module.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/stream/ngx_stream_pass_module.c b/src/stream/ngx_stream_pass_module.c index 2c1c60c6a..1d671087c 100644 --- a/src/stream/ngx_stream_pass_module.c +++ b/src/stream/ngx_stream_pass_module.c @@ -83,6 +83,11 @@ ngx_stream_pass_handler(ngx_stream_session_t *s) c->log->action = "passing connection to port"; + if (c->type == SOCK_DGRAM) { + ngx_log_error(NGX_LOG_ERR, c->log, 0, "cannot pass udp connection"); + goto failed; + } + if (c->buffer && c->buffer->pos != c->buffer->last) { ngx_log_error(NGX_LOG_ERR, c->log, 0, "cannot pass connection with preread data"); @@ -217,6 +222,10 @@ ngx_stream_pass_cleanup(void *data) static ngx_int_t ngx_stream_pass_match(ngx_listening_t *ls, ngx_addr_t *addr) { + if (ls->type == SOCK_DGRAM) { + return NGX_DECLINED; + } + if (!ls->wildcard) { return ngx_cmp_sockaddr(ls->sockaddr, ls->socklen, addr->sockaddr, addr->socklen, 1); |