This commit is contained in:
Anthony Doeraene 2025-02-06 05:32:40 +00:00 committed by GitHub
commit 956a8d29df
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
\ nextgroup=@ngxListenParams skipwhite skipempty
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
\ ipv6only reuseport so_keepalive
\ nextgroup=@ngxListenParams skipwhite skipempty

View File

@ -487,7 +487,8 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
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) {
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;
int type;
int protocol;
int backlog;
int rcvbuf;

View File

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

View File

@ -4059,6 +4059,13 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
#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) {
lsopt.backlog = ngx_atoi(value[n].data + 8, value[n].len - 8);
lsopt.set = 1;
@ -4348,6 +4355,12 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
#endif
#ifdef IPPROTO_MPTCP
if (lsopt.protocol == IPPROTO_MPTCP) {
return "\"multipath\" parameter is incompatible with \"quic\"";
}
#endif
#if (NGX_HTTP_V2)
if (lsopt.http2) {
return "\"http2\" parameter is incompatible with \"quic\"";

View File

@ -88,6 +88,7 @@ typedef struct {
int rcvbuf;
int sndbuf;
int type;
int protocol;
#if (NGX_HAVE_SETFIB)
int setfib;
#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.handler = ngx_accept_log_error;
ls->protocol = addr[i].opt.protocol;
ls->backlog = addr[i].opt.backlog;
ls->rcvbuf = addr[i].opt.rcvbuf;
ls->sndbuf = addr[i].opt.sndbuf;

View File

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

View File

@ -468,6 +468,13 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#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_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->type = addr->opt.type;
ls->protocol = addr[i].opt.protocol;
ls->backlog = addr->opt.backlog;
ls->rcvbuf = addr->opt.rcvbuf;
ls->sndbuf = addr->opt.sndbuf;

View File

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

View File

@ -984,6 +984,13 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
#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) {
lsopt.backlog = ngx_atoi(value[i].data + 8, value[i].len - 8);
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 (i = 0; i < n; i++) {