[nginx] Stream pass: disabled passing from or to udp.
Roman Arutyunyan
arut at nginx.com
Fri May 3 16:33:10 UTC 2024
details: https://hg.nginx.org/nginx/rev/89093b003fcb
branches:
changeset: 9246:89093b003fcb
user: Roman Arutyunyan <arut at nginx.com>
date: Fri May 03 20:26:05 2024 +0400
description:
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:
src/stream/ngx_stream_pass_module.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r c4792b0f1976 -r 89093b003fcb src/stream/ngx_stream_pass_module.c
--- a/src/stream/ngx_stream_pass_module.c Fri May 03 20:29:01 2024 +0400
+++ b/src/stream/ngx_stream_pass_module.c Fri May 03 20:26:05 2024 +0400
@@ -83,6 +83,11 @@ ngx_stream_pass_handler(ngx_stream_sessi
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);
More information about the nginx-devel
mailing list