Bugfix now multiple switches can connect with TLS
This fixes a bug in RYU StreamServer where SSLContext was modified for
each connection. Now the SSLContext of the server socket is modified
only once in __init__
@@ -127,7 +127,6 @@ if HUB_TYPE == 'eventlet':
self.server = eventlet.listen(listen_info)
if ssl_args:
- def wrap_and_handle(sock, addr):
ssl_args.setdefault('server_side', True)
if 'ssl_ctx' in ssl_args:
ctx = ssl_args.pop('ssl_ctx')
@@ -137,11 +136,16 @@ if HUB_TYPE == 'eventlet':
ctx.verify_mode = ssl_args.pop('cert_reqs')
if 'ca_certs' in ssl_args:
ctx.load_verify_locations(ssl_args.pop('ca_certs'))
+
+ def wrap_and_handle_ctx(sock, addr):
handle(ctx.wrap_socket(sock, **ssl_args), addr)
+
+ self.handle = wrap_and_handle_ctx
else:
+ def wrap_and_handle_ssl(sock, addr):
handle(ssl.wrap_socket(sock, **ssl_args), addr)
- self.handle = wrap_and_handle
+ self.handle = wrap_and_handle_ssl
else:
self.handle = handle
