[ovs-dev] [PATCH v2] Shutdown SSL connection before closing socket

Daniel Alvarez Sanchez dalvarez at redhat.com
Tue Jul 16 14:14:06 UTC 2019


Acked-By: Daniel Alvarez <dalvarez at redhat.com>

On Thu, Jul 11, 2019 at 3:08 PM Terry Wilson <twilson at redhat.com> wrote:
>
> Without shutting down the SSL connection, log messages like:
>
> stream_ssl|WARN|SSL_read: unexpected SSL connection close
> jsonrpc|WARN|ssl:127.0.0.1:47052: receive error: Protocol error
> reconnect|WARN|ssl:127.0.0.1:47052: connection dropped (Protocol error)
>
> would occur whenever the socket is closed. This just adds an
> SSLStream.close() that calls shutdown() and ignores SSL errors, the
> same way that lib/stream-ssl.c does in ssl_close().
>
> Signed-off-by: Terry Wilson <twilson at redhat.com>
> ---
>  python/ovs/stream.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/python/ovs/stream.py b/python/ovs/stream.py
> index c15be4b..a98057e 100644
> --- a/python/ovs/stream.py
> +++ b/python/ovs/stream.py
> @@ -825,6 +825,14 @@ class SSLStream(Stream):
>          except SSL.SysCallError as e:
>              return -ovs.socket_util.get_exception_errno(e)
>
> +    def close(self):
> +        if self.socket:
> +            try:
> +                self.socket.shutdown()
> +            except SSL.Error:
> +                pass
> +        return super(SSLStream, self).close()
> +
>
>  if SSL:
>      # Register SSL only if the OpenSSL module is available
> --
> 1.8.3.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list