Re: nginx-quic socket() 0.0.0.0:80 failed (94: Socket type not supported)

2022-11-10 Thread Sergey Kandaurov
On Tue, Nov 01, 2022 at 05:02:51PM +0400, Roman Arutyunyan wrote:

[..]

> # HG changeset patch
> # User Roman Arutyunyan 
> # Date 1667307635 -14400
> #  Tue Nov 01 17:00:35 2022 +0400
> # Branch quic
> # Node ID 40777e329eea363001186c4bf609d2ef0682bcee
> # Parent  598cbf105892bf9d7acc0fc3278ba9329b3a151c
> Set default listen socket type in http.
> 
> The type field was added in 7999d3fbb765 at early stages of QUIC 
> implementation
> and was not initialized for default listen.  Missing initialization resulted 
> in
> default listen socket creation error.
> 
> diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
> --- a/src/http/ngx_http_core_module.c
> +++ b/src/http/ngx_http_core_module.c
> @@ -3008,6 +3008,7 @@ ngx_http_core_server(ngx_conf_t *cf, ngx
>  lsopt.socklen = sizeof(struct sockaddr_in);
>  
>  lsopt.backlog = NGX_LISTEN_BACKLOG;
> +lsopt.type = SOCK_STREAM;
>  lsopt.rcvbuf = -1;
>  lsopt.sndbuf = -1;
>  #if (NGX_HAVE_SETFIB)

Looks good, please commit.
___
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org


Re: nginx-quic socket() 0.0.0.0:80 failed (94: Socket type not supported)

2022-11-01 Thread George
Ok fixed the patch and yup working now! No more socket() 0.0.0.0:80 failed
(94: Socket type not supported) errors when listen directive is not
specifically set.

Thanks Roman!

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,295642,295646#msg-295646

___
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org


Re: nginx-quic socket() 0.0.0.0:80 failed (94: Socket type not supported)

2022-11-01 Thread George
That was a quick reply, was about to pop on Nginx slack channel :)

Tried the patch but getting

patching file src/http/ngx_http_core_module.c
patch:  malformed patch at line 18: lsopt.socklen = sizeof(struct
sockaddr_in);

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,295642,295645#msg-295645

___
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org


Re: nginx-quic socket() 0.0.0.0:80 failed (94: Socket type not supported)

2022-11-01 Thread Roman Arutyunyan
Hi George,

On Tue, Nov 01, 2022 at 08:19:15AM -0400, George wrote:
> I tested nginx-quic https://quic.nginx.org/README for HTTP/3 over QUIC using
> quictls openssl 1.1.1q forked library and ran into an interesting error for
> non-HTTPS nginx vhost configurations. If non-HTTPS nginx vhost doesn't
> specifically list the listen directive for port 80, I get this error when
> running nginx -t config check
> 
> nginx: [emerg] socket() 0.0.0.0:80 failed (94: Socket type not supported)
> 
> server {
> 
>   server_name domain.com www.domain.com;
> }
> 
> but if I specifically list the listen directive no error
> 
> server {
>   listen 80;
>   server_name domain1.com www.domain1.com;
> }
> 
> Nginx was built on CentOS 7 with GCC 11.2.1 and quictls openssl 1.1.1q
> 
> nginx -V
> nginx version: nginx/1.23.2 (011122-105436-centos7-d9e494b-br-6e975bc)
> built by gcc 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC) 
> built with OpenSSL 1.1.1q+quic  5 Jul 2022
> TLS SNI support enabled
> 
> This seems to only be an issue with nginx-quic built Nginx versions. If I
> build a regular Nginx version without nginx-quic/quictls the non-HTTPS vhost
> with no listen directive specifically listed for port 80 works fine and has
> been the expected case since I started using Nginx ~11yrs ago.
> 
> So with nginx-quic, does the assumption that server{} contexts without a
> specifically mentioned listen port, no longer default to port 80?

Thanks for reporting this.

Indeed, default listen is broken in nginx-quic branch.

Please try the attached patch which should fix the problem.

--
Roman Arutyunyan
# HG changeset patch
# User Roman Arutyunyan 
# Date 1667307635 -14400
#  Tue Nov 01 17:00:35 2022 +0400
# Branch quic
# Node ID 40777e329eea363001186c4bf609d2ef0682bcee
# Parent  598cbf105892bf9d7acc0fc3278ba9329b3a151c
Set default listen socket type in http.

The type field was added in 7999d3fbb765 at early stages of QUIC implementation
and was not initialized for default listen.  Missing initialization resulted in
default listen socket creation error.

diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3008,6 +3008,7 @@ ngx_http_core_server(ngx_conf_t *cf, ngx
 lsopt.socklen = sizeof(struct sockaddr_in);
 
 lsopt.backlog = NGX_LISTEN_BACKLOG;
+lsopt.type = SOCK_STREAM;
 lsopt.rcvbuf = -1;
 lsopt.sndbuf = -1;
 #if (NGX_HAVE_SETFIB)
___
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org


nginx-quic socket() 0.0.0.0:80 failed (94: Socket type not supported)

2022-11-01 Thread George
I tested nginx-quic https://quic.nginx.org/README for HTTP/3 over QUIC using
quictls openssl 1.1.1q forked library and ran into an interesting error for
non-HTTPS nginx vhost configurations. If non-HTTPS nginx vhost doesn't
specifically list the listen directive for port 80, I get this error when
running nginx -t config check

nginx: [emerg] socket() 0.0.0.0:80 failed (94: Socket type not supported)

server {

  server_name domain.com www.domain.com;
}

but if I specifically list the listen directive no error

server {
  listen 80;
  server_name domain1.com www.domain1.com;
}

Nginx was built on CentOS 7 with GCC 11.2.1 and quictls openssl 1.1.1q

nginx -V
nginx version: nginx/1.23.2 (011122-105436-centos7-d9e494b-br-6e975bc)
built by gcc 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC) 
built with OpenSSL 1.1.1q+quic  5 Jul 2022
TLS SNI support enabled

This seems to only be an issue with nginx-quic built Nginx versions. If I
build a regular Nginx version without nginx-quic/quictls the non-HTTPS vhost
with no listen directive specifically listed for port 80 works fine and has
been the expected case since I started using Nginx ~11yrs ago.

So with nginx-quic, does the assumption that server{} contexts without a
specifically mentioned listen port, no longer default to port 80?

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,295642,295642#msg-295642

___
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-le...@nginx.org