Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPTCP: implementation of mptcp #1

Closed
wants to merge 10 commits into from
10 changes: 8 additions & 2 deletions src/core/ngx_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,14 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
continue;
}

s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);

mux99 marked this conversation as resolved.
Show resolved Hide resolved
s = (ngx_socket_t) -1;
if (ls[i].protocol > 0) {
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type,
ls[i].protocol);
}
if (s == (ngx_socket_t) -1) {
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
}
if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_socket_n " %V failed", &ls[i].addr_text);
Expand Down
1 change: 1 addition & 0 deletions src/core/ngx_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct ngx_listening_s {
ngx_str_t addr_text;

int type;
int protocol;

int backlog;
int rcvbuf;
Expand Down
1 change: 1 addition & 0 deletions src/http/ngx_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions src/http/ngx_http_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -4049,6 +4049,13 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
#endif

#if (NGX_LINUX)
if (ngx_strcmp(value[n].data, "mptcp") == 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;
Expand Down
1 change: 1 addition & 0 deletions src/http/ngx_http_core_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ typedef struct {
int rcvbuf;
int sndbuf;
int type;
int protocol;
#if (NGX_HAVE_SETFIB)
int setfib;
#endif
Expand Down
7 changes: 7 additions & 0 deletions src/stream/ngx_stream_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,13 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
#endif

#if (NGX_LINUX)
if (ngx_strcmp(value[n].data, "mptcp") == 0) {
lsopt.protocol = IPPROTO_MPTCP;
continue;
}
#endif

if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) {
ls->backlog = ngx_atoi(value[i].data + 8, value[i].len - 8);
ls->bind = 1;
Expand Down