From ce6538af11317bb378d4814c477ac7c4df20500a Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 29 Dec 2015 12:52:07 +0800 Subject: [PATCH] ipv6 support tcp connection with bgp open messages Signed-off-by: Peng Xiao --- yabgp/core/protocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yabgp/core/protocol.py b/yabgp/core/protocol.py index f314489..3744f45 100644 --- a/yabgp/core/protocol.py +++ b/yabgp/core/protocol.py @@ -92,7 +92,11 @@ def connectionMade(self): # Set the local BGP id from the local IP address if it's not set if self.factory.bgp_id is None: try: - self.factory.bgp_id = int(netaddr.IPAddress(self.transport.getHost().host)) + local_host_addr = netaddr.IPAddress(self.transport.getHost().host) + if 'IPv6' in local_host_addr.info: + self.factory.bgp_id = int(netaddr.IPAddress('127.0.0.1')) + else: + self.factory.bgp_id = int(local_host_addr) except Exception as e: LOG.error(e) error_str = traceback.format_exc()