Signed-off-by: IWASE Yusuke <[email protected]>
---
ryu/services/protocols/bgp/utils/bgp.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/ryu/services/protocols/bgp/utils/bgp.py
b/ryu/services/protocols/bgp/utils/bgp.py
index 4979e44..4bdedf0 100644
--- a/ryu/services/protocols/bgp/utils/bgp.py
+++ b/ryu/services/protocols/bgp/utils/bgp.py
@@ -17,10 +17,10 @@
Utilities related to bgp data types and models.
"""
import logging
-import socket
import netaddr
+from ryu.lib import ip
from ryu.lib.packet.bgp import (
BGPUpdate,
RF_IPv4_UC,
@@ -107,8 +107,7 @@ def from_inet_ptoi(bgp_id):
"""
four_byte_id = None
try:
- packed_byte = socket.inet_pton(socket.AF_INET, bgp_id)
- four_byte_id = int(packed_byte.encode('hex'), 16)
+ four_byte_id = ip.ipv4_to_int(bgp_id)
except ValueError:
LOG.debug('Invalid bgp id given for conversion to integer value %s',
bgp_id)
--
2.7.4
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel