mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-10 14:56:11 +02:00
services/ovsdb: Listen on IPv6 Address
This patch enables Ryu to listen ovsdb connections on IPv6 Address.
Note that you need to make a config file like belows:
[ovsdb]
address=::
Signed-off-by: Dingyuan Hu <hdyvip@gmail.com>
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
7f537c4185
commit
bc7451dc7c
@ -300,7 +300,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)
|
||||
@ -390,8 +390,8 @@ 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.system_id)
|
||||
self.logger.exception(
|
||||
'Error submitting specific event for OVSDB %s', self.system_id)
|
||||
|
||||
def _idl_loop(self):
|
||||
while self.is_active:
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
import ssl
|
||||
import socket
|
||||
import netaddr
|
||||
|
||||
from ryu import cfg
|
||||
from ryu.base import app_manager
|
||||
@ -91,7 +92,12 @@ class OVSDB(app_manager.RyuApp):
|
||||
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[:2])
|
||||
t = hub.spawn(self._start_remote, sock, client_address)
|
||||
self.threads.append(t)
|
||||
|
||||
@ -158,7 +164,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 +183,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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user