[pve-devel] [PATCH http-server v2 4/5] add debug log for problems during accept

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 7 11:50:14 CET 2020


On 04.12.20 18:56, Stoiko Ivanov wrote:
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>  PVE/APIServer/AnyEvent.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm
> index a679006..0165264 100644
> --- a/PVE/APIServer/AnyEvent.pm
> +++ b/PVE/APIServer/AnyEvent.pm
> @@ -1547,6 +1547,7 @@ sub check_host_access {
>  	foreach my $t (@{$self->{allow_from}}) {
>  	    if ($t->overlaps($cip)) {
>  		$match_allow = 1;
> +		$self->dprint("client IP allowed: ". $t->prefix());
>  		last;
>  	    }
>  	}
> @@ -1555,6 +1556,7 @@ sub check_host_access {
>      if ($self->{deny_from}) {
>  	foreach my $t (@{$self->{deny_from}}) {
>  	    if ($t->overlaps($cip)) {
> +		$self->dprint("client IP denied: ". $t->prefix());
>  		$match_deny = 1;
>  		last;
>  	    }
> @@ -1591,6 +1593,7 @@ sub accept_connections {
>  		my ($pfamily, $pport, $phost) = PVE::Tools::unpack_sockaddr_in46($sin);
>  		($reqstate->{peer_port}, $reqstate->{peer_host}) = ($pport,  Socket::inet_ntop($pfamily, $phost));
>  	    } else {
> +		$self->dprint("getpeername failed: $!");
>  		shutdown($clientfh, 1);
>  		next;
>  	    }
> @@ -1638,6 +1641,7 @@ sub accept_connections {
>  
>      if (my $err = $@) {
>  	syslog('err', $err);
> +	self->dprint("connection accept error: $err");

this cannot work, missing the dollar signe: `self` vs. `$self`

>  	shutdown($clientfh, 1) if $early_err || $hdl_err;
>  	if ($hdl_err) {
>  	    if ($self->{conn_count} <= 0) {
> 






More information about the pve-devel mailing list