Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
---
 ryu/lib/packet/vrrp.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ryu/lib/packet/vrrp.py b/ryu/lib/packet/vrrp.py
index ab544e7..2067fb2 100644
--- a/ryu/lib/packet/vrrp.py
+++ b/ryu/lib/packet/vrrp.py
@@ -169,6 +169,18 @@ def is_ipv6(ip_address):
     return False
 
 
+def ip_text_to_bin(ip_text):
+    if is_ipv6(ip_text):
+        return addrconv.ipv6.text_to_bin(ip_text)
+    else:
+        return addrconv.ipv4.text_to_bin(ip_text)
+
+
+# This is used for master selection
+def ip_address_lt(ip1, ip2):
+    return ip_text_to_bin(ip1) < ip_text_to_bin(ip2)
+
+
 class vrrp(packet_base.PacketBase):
     """The base class for VRRPv2 (RFC 3768) and VRRPv3 (RFC 5798)
     header encoder/decoder classes.
-- 
1.8.3.1


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to