note:
To enable IPv6, you should config
```
[ovsdb]
address=::
```
If you only listen on IPv6 address :: , you still can accept IPv4
connection thought IPv4-mapped Address (e.g. ::ffff:192.0.2.3)
---
 ryu/services/protocols/ovsdb/client.py  |  4 ++--
 ryu/services/protocols/ovsdb/manager.py | 21 ++++++++++++++++-----
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ryu/services/protocols/ovsdb/client.py
b/ryu/services/protocols/ovsdb/client.py
index d0ec5b0a..ce219894 100644
--- a/ryu/services/protocols/ovsdb/client.py
+++ b/ryu/services/protocols/ovsdb/client.py
@@ -299,7 +299,7 @@ class RemoteOvsdb(app_manager.RyuApp):
                                       schema_exclude_columns)

         fsm = reconnect.Reconnect(now())
-        fsm.set_name('%s:%s' % address)
+        fsm.set_name('%s:%s' % address[:2])
         fsm.enable(now())
         fsm.set_passive(True, now())
         fsm.set_max_tries(-1)
@@ -387,7 +387,7 @@ class RemoteOvsdb(app_manager.RyuApp):
             if proxy_ev_cls:
                 self.send_event_to_observers(proxy_ev_cls(ev))
         except Exception:
-            self.logger.exception('Error submitting specific event for
OVSDB',
+            self.logger.exception('Error submitting specific event for
OVSDB %s',
                                   self.system_id)

     def _idl_loop(self):
diff --git a/ryu/services/protocols/ovsdb/manager.py
b/ryu/services/protocols/ovsdb/manager.py
index 86a2d1ff..b8d62e8a 100644
--- a/ryu/services/protocols/ovsdb/manager.py
+++ b/ryu/services/protocols/ovsdb/manager.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.

+import netaddr
 import ssl
 import socket

@@ -90,8 +91,10 @@ class OVSDB(app_manager.RyuApp):
                 sock.shutdown(socket.SHUT_RDWR)
                 sock.close()
                 continue
-
-            self.logger.debug('New connection from %s:%s' % client_address)
+            if netaddr.valid_ipv6(client_address[0]):
+                self.logger.debug('New connection from [%s]:%s' %
client_address[:2])
+            else:
+                self.logger.debug('New connection from %s:%s' %
client_address)
             t = hub.spawn(self._start_remote, sock, client_address)
             self.threads.append(t)

@@ -158,7 +161,11 @@ class OVSDB(app_manager.RyuApp):
             sock.close()

     def start(self):
-        server = hub.listen((self._address, self._port))
+        if netaddr.valid_ipv6(self._address):
+            server = hub.listen((self._address, self._port),
+                                family=socket.AF_INET6)
+        else:
+            server = hub.listen((self._address, self._port))
         key = self.CONF.ovsdb.mngr_privkey or self.CONF.ctl_privkey
         cert = self.CONF.ovsdb.mngr_cert or self.CONF.ctl_cert

@@ -173,8 +180,12 @@ class OVSDB(app_manager.RyuApp):

         self._server = server

-        self.logger.info('Listening on %s:%s for clients' % (self._address,
-                                                             self._port))
+        if netaddr.valid_ipv6(self._address):
+            self.logger.info('Listening on [%s]:%s for clients',
+                             self._address, self._port)
+        else:
+            self.logger.info('Listening on %s:%s for clients',
+                             self._address, self._port)
         t = hub.spawn(self._accept, self._server)
         super(OVSDB, self).start()
         return t
-- 
2.13.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to