Hello,
The patch seems to be missed since I don't receive any responses. So I send
this mail as a reminder.
2013/4/2 can. <[email protected]>
> Then how about this:
> ----
>
> From 3e29f270b921ed871d9cbc8b80d275c9fe19e96f Mon Sep 17 00:00:00 2001
> From: Can Zhang <[email protected]>
> Date: Tue, 2 Apr 2013 11:45:20 +0800
> Subject: [PATCH] Changed pack string of IPv6 address in NXM from former
> '!4I'
> to '!8H'. Registered IPv6 src/dst field header so we could
> parse IPv6 addresses now.
>
> Signed-off-by: Can Zhang <[email protected]>
> ---
> ryu/ofproto/nx_match.py | 38 ++++++++++++++++++++++++++++++++++----
> 1 file changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
> index 715129c..70cb316 100644
> --- a/ryu/ofproto/nx_match.py
> +++ b/ryu/ofproto/nx_match.py
> @@ -57,6 +57,7 @@ MF_PACK_STRING_BE32 = '!I'
> MF_PACK_STRING_BE16 = '!H'
> MF_PACK_STRING_8 = '!B'
> MF_PACK_STRING_MAC = '!6s'
> +MF_PACK_STRING_IPV6 = '!8H'
>
> _MF_FIELDS = {}
>
> @@ -722,13 +723,35 @@ class MFArpSha(MFField):
> return self._put(buf, offset, rule.flow.arp_sha)
>
>
> +class MFIPV6(object):
> + pack_str = MF_PACK_STRING_IPV6
> +
> + @classmethod
> + def field_parser(cls, header, buf, offset):
> + hasmask = (header >> 8) & 1
> + if hasmask:
> + pack_string = '!' + cls.pack_str[1:] * 2
> + value = struct.unpack_from(pack_string, buf, offset + 4)
> + return cls(header, list(value[:8]), list(value[8:]))
> + else:
> + value = struct.unpack_from(cls.pack_str, buf, offset + 4)
> + return cls(header, list(value))
> +
> +
> @_register_make
> @_set_nxm_headers([ofproto_v1_0.NXM_NX_IPV6_SRC,
> ofproto_v1_0.NXM_NX_IPV6_SRC_W])
> -class MFIPV6Src(MFField):
> [email protected]_field_header([ofproto_v1_0.NXM_NX_IPV6_SRC,
> + ofproto_v1_0.NXM_NX_IPV6_SRC_W])
> +class MFIPV6Src(MFIPV6, MFField):
> + def __init__(self, header, value, mask = None):
> + super(MFIPV6Src, self).__init__(header, MFIPV6Src.pack_str)
> + self.value = value
> + self.mask = mask
> +
> @classmethod
> def make(cls, header):
> - return cls(header, '!4I')
> + return cls(header, cls.pack_str)
>
> def put(self, buf, offset, rule):
> return self.putv6(buf, offset,
> @@ -739,10 +762,17 @@ class MFIPV6Src(MFField):
> @_register_make
> @_set_nxm_headers([ofproto_v1_0.NXM_NX_IPV6_DST,
> ofproto_v1_0.NXM_NX_IPV6_DST_W])
> -class MFIPV6Dst(MFField):
> [email protected]_field_header([ofproto_v1_0.NXM_NX_IPV6_DST,
> + ofproto_v1_0.NXM_NX_IPV6_DST_W])
> +class MFIPV6Dst(MFIPV6, MFField):
> + def __init__(self, header, value, mask = None):
> + super(MFIPV6Dst, self).__init__(header, MFIPV6Dst.pack_str)
> + self.value = value
> + self.mask = mask
> +
> @classmethod
> def make(cls, header):
> - return cls(header, '!4I')
> + return cls(header, cls.pack_str)
>
> def put(self, buf, offset, rule):
> return self.putv6(buf, offset,
> --
> 1.7.11.1
>
>
--
Best regards,
Can Zhang
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel