Hi:
Is there a reason why the "to_match_ip" uses the socket library and the
"to_match_ipv6" uses the netaddr library? That's ok but the current
implementation does not return the same results, the ipv6 match returns the
ipv6 address and mask in forms of tuples instead of integers
Here's a little test to show the difference
import netaddr
import struct
import socket
def to_match_ip(value):
ip_mask = value.split('/')
# ip
ipv4 = struct.unpack('!I', socket.inet_aton(ip_mask[0]))[0]
# netmask
mask = 32
if len(ip_mask) == 2:
mask = int(ip_mask[1])
#netmask = ofproto_v1_3_parser.UINT32_MAX << 32 - mask\
# & ofproto_v1_3_parser.UINT32_MAX
return ipv4, mask
def to_match_ipv6(value):
ip = netaddr.IPNetwork(value)
return ip.ip.words, ip.netmask.words
print 'IPV4 192.168.0.1 to integer is',to_match_ip('192.168.0.1/32')
print 'IPV6 0101::01 to integer
is',to_match_ipv6('2001:0DB8:AC10:FE01:0000:0000:0000:0000/48')
Result is below
IPV4 192.168.0.1 to integer is (3232235521, 32)
IPV6 0101::01 to integer is ((8193, 3512, 44048, 65025, 0, 0, 0, 0), (65535,
65535, 65535, 0, 0, 0, 0, 0))
I'm just curious if there's a requirement that calls for handles IPV6 flow
matching differently, I didn't find anything obvious on the spec...
Much Thanks
Morgan Yang
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel