From ddb32f678a5e1f0bbbf2cf810bdd16871abb22d9 Mon Sep 17 00:00:00 2001 From: Brad Cowie Date: Thu, 11 Jun 2020 15:01:42 +1200 Subject: [PATCH] Add workaround for Python3.7+ eventlet bug. --- ryu/controller/controller.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py index b3d2d35b..1506efb4 100644 --- a/ryu/controller/controller.py +++ b/ryu/controller/controller.py @@ -30,6 +30,7 @@ from socket import TCP_NODELAY from socket import SHUT_WR from socket import timeout as SocketTimeout import ssl +import sys from ryu import cfg from ryu.lib import hub @@ -169,6 +170,12 @@ class OpenFlowController(object): # anything less than python 2.7.9 supports only TLSv1 # or less, thus we choose TLSv1 ssl_args = {'ssl_version': ssl.PROTOCOL_TLSv1} + elif sys.version_info >= (3, 7,): + # On Python3.7+ we can't wrap an SSLContext due to this bug: + # https://github.com/eventlet/eventlet/issues/526 + # Lets assume the system has a new enough OpenSSL that + # SSL is fully disabled. + ssl_args = {'ssl_version': ssl.PROTOCOL_TLSv1} else: # from 2.7.9 and versions 3.4+ ssl context creation is # supported. Protocol_TLS from 2.7.13 and from 3.5.3