This commit is contained in:
Anthony Doeraene 2025-07-15 19:16:57 +00:00 committed by GitHub
commit 8c1685493a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 43 additions and 2 deletions

View File

@ -65,7 +65,7 @@ syn match ngxListenComment '#.*$'
\ contained \ contained
\ nextgroup=@ngxListenParams skipwhite skipempty \ nextgroup=@ngxListenParams skipwhite skipempty
syn keyword ngxListenOptions contained syn keyword ngxListenOptions contained
\ default_server ssl quic proxy_protocol \ default_server ssl quic proxy_protocol multipath
\ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind \ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind
\ ipv6only reuseport so_keepalive \ ipv6only reuseport so_keepalive
\ nextgroup=@ngxListenParams skipwhite skipempty \ nextgroup=@ngxListenParams skipwhite skipempty

View File

@ -487,7 +487,8 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
continue; continue;
} }
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0); s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type,
+ ls[i].protocol);
if (s == (ngx_socket_t) -1) { if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,

View File

@ -24,6 +24,7 @@ struct ngx_listening_s {
ngx_str_t addr_text; ngx_str_t addr_text;
int type; int type;
int protocol;
int backlog; int backlog;
int rcvbuf; int rcvbuf;

View File

@ -1846,6 +1846,7 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
#endif #endif
ls->type = addr->opt.type; ls->type = addr->opt.type;
ls->protocol = addr->opt.protocol;
ls->backlog = addr->opt.backlog; ls->backlog = addr->opt.backlog;
ls->rcvbuf = addr->opt.rcvbuf; ls->rcvbuf = addr->opt.rcvbuf;
ls->sndbuf = addr->opt.sndbuf; ls->sndbuf = addr->opt.sndbuf;

View File

@ -4106,6 +4106,13 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} }
#endif #endif
#ifdef IPPROTO_MPTCP
if (ngx_strcmp(value[n].data, "multipath") == 0) {
lsopt.protocol = IPPROTO_MPTCP;
continue;
}
#endif
if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) { if (ngx_strncmp(value[n].data, "backlog=", 8) == 0) {
lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8); lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8);
lsopt.set = 1; lsopt.set = 1;
@ -4395,6 +4402,12 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} }
#endif #endif
#ifdef IPPROTO_MPTCP
if (lsopt.protocol == IPPROTO_MPTCP) {
return "\"multipath\" parameter is incompatible with \"quic\"";
}
#endif
#if (NGX_HTTP_V2) #if (NGX_HTTP_V2)
if (lsopt.http2) { if (lsopt.http2) {
return "\"http2\" parameter is incompatible with \"quic\""; return "\"http2\" parameter is incompatible with \"quic\"";

View File

@ -88,6 +88,7 @@ typedef struct {
int rcvbuf; int rcvbuf;
int sndbuf; int sndbuf;
int type; int type;
int protocol;
#if (NGX_HAVE_SETFIB) #if (NGX_HAVE_SETFIB)
int setfib; int setfib;
#endif #endif

View File

@ -332,6 +332,7 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
ls->log.data = &ls->addr_text; ls->log.data = &ls->addr_text;
ls->log.handler = ngx_accept_log_error; ls->log.handler = ngx_accept_log_error;
ls->protocol = addr[i].opt.protocol;
ls->backlog = addr[i].opt.backlog; ls->backlog = addr[i].opt.backlog;
ls->rcvbuf = addr[i].opt.rcvbuf; ls->rcvbuf = addr[i].opt.rcvbuf;
ls->sndbuf = addr[i].opt.sndbuf; ls->sndbuf = addr[i].opt.sndbuf;

View File

@ -47,6 +47,7 @@ typedef struct {
int tcp_keepintvl; int tcp_keepintvl;
int tcp_keepcnt; int tcp_keepcnt;
#endif #endif
int protocol;
int backlog; int backlog;
int rcvbuf; int rcvbuf;
int sndbuf; int sndbuf;

View File

@ -468,6 +468,13 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#endif #endif
} }
#ifdef IPPROTO_MPTCP
if (ngx_strcmp(value[i].data, "multipath") == 0) {
ls->protocol = IPPROTO_MPTCP;
continue;
}
#endif
if (ngx_strncmp(value[i].data, "so_keepalive=", 13) == 0) { if (ngx_strncmp(value[i].data, "so_keepalive=", 13) == 0) {
if (ngx_strcmp(&value[i].data[13], "on") == 0) { if (ngx_strcmp(&value[i].data[13], "on") == 0) {

View File

@ -1010,6 +1010,7 @@ ngx_stream_add_listening(ngx_conf_t *cf, ngx_stream_conf_addr_t *addr)
ls->log.handler = ngx_accept_log_error; ls->log.handler = ngx_accept_log_error;
ls->type = addr->opt.type; ls->type = addr->opt.type;
ls->protocol = addr[i].opt.protocol;
ls->backlog = addr->opt.backlog; ls->backlog = addr->opt.backlog;
ls->rcvbuf = addr->opt.rcvbuf; ls->rcvbuf = addr->opt.rcvbuf;
ls->sndbuf = addr->opt.sndbuf; ls->sndbuf = addr->opt.sndbuf;

View File

@ -62,6 +62,7 @@ typedef struct {
int rcvbuf; int rcvbuf;
int sndbuf; int sndbuf;
int type; int type;
int protocol;
#if (NGX_HAVE_SETFIB) #if (NGX_HAVE_SETFIB)
int setfib; int setfib;
#endif #endif

View File

@ -984,6 +984,13 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} }
#endif #endif
#ifdef IPPROTO_MPTCP
if (ngx_strcmp(value[i].data, "multipath") == 0) {
lsopt.protocol = IPPROTO_MPTCP;
continue;
}
#endif
if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) { if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) {
lsopt.backlog = ngx_atoi(value[i].data + 8, value[i].len - 8); lsopt.backlog = ngx_atoi(value[i].data + 8, value[i].len - 8);
lsopt.set = 1; lsopt.set = 1;
@ -1252,6 +1259,12 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} }
} }
#ifdef IPPROTO_MPTCP
if (lsopt.protocol == IPPROTO_MPTCP) {
return "\"multipath\" parameter is incompatible with \"udp\"";
}
#endif
for (n = 0; n < u.naddrs; n++) { for (n = 0; n < u.naddrs; n++) {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {