On Fri, 22 Jun 2012 01:24:51 +0900
Isaku Yamahata <[email protected]> wrote:

> On Thu, Jun 21, 2012 at 02:55:02PM +0900, FUJITA Tomonori wrote:
>> v6 address and mask are represented in a list including four int
>> values like the following:
>> 
>> set_ipv6_src_masked([0xf1234567, 3, 4, 7], [0xffff0000, 0, 0, 0])
>> 
>> Signed-off-by: FUJITA Tomonori <[email protected]>
>> ---
>>  ryu/ofproto/nx_match.py     |   74 
>> ++++++++++++++++++++++++++++++++++++++++++-
>>  ryu/ofproto/ofproto_v1_0.py |    5 +++
>>  2 files changed, 78 insertions(+), 1 deletions(-)
>> 
>> diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
>> index 799d90d..209d1c2 100644
>> --- a/ryu/ofproto/nx_match.py
>> +++ b/ryu/ofproto/nx_match.py
>> @@ -16,6 +16,7 @@
>>  # limitations under the License.
>>  
>>  import struct
>> +import itertools
>>  
>>  from ryu import exception
>>  from ryu.lib import mac
>> @@ -84,6 +85,8 @@ class Flow(object):
>>          self.tun_id = 0
>>          self.arp_spa = 0
>>          self.arp_tpa = 0
>> +        self.ipv6_src = []
>> +        self.ipv6_dst = []
>>          self.ipv6_label = 0
>>  
>>  
>> @@ -99,6 +102,8 @@ class FlowWildcards(object):
>>          self.arp_spa_mask = 0
>>          self.arp_tpa_mask = 0
>>          self.vlan_tci_mask = 0
>> +        self.ipv6_src_mask = []
>> +        self.ipv6_dst_mask = []
>>          self.wildcards = FWW_ALL
>>  
>>  
>> @@ -228,6 +233,20 @@ class ClsRule(object):
>>          self.wc.wildcards &= ~FWW_IPV6_LABEL
>>          self.flow.ipv6_label = label
>>  
>> +    def set_ipv6_src_masked(self, src, mask):
>> +        self.wc.ipv6_src_mask = mask
>> +        self.flow.ipv6_src = [x & y for (x, y) in itertools.izip(src, mask)]
>> +
>> +    def set_ipv6_src(self, src):
>> +        self.flow.ipv6_src = src
>> +
>> +    def set_ipv6_dst_masked(self, dst, mask):
>> +        self.wc.ipv6_dst_mask = mask
>> +        self.flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)]
>> +
>> +    def set_ipv6_dst(self, dst):
>> +        self.flow.ipv6_dst = dst
>> +
>>      def flow_format(self):
>>          # Tunnel ID is only supported by NXM
>>          if self.wc.tun_id_mask != 0:
>> @@ -317,6 +336,17 @@ class MFField(object):
>>          else:
>>              return self.putw(buf, offset, value, mask)
>>  
>> +    def _putv6(self, buf, offset, value):
>> +        ofproto_parser.msg_pack_into(self.pack_str, buf, offset,
>> +                                     *value)
>> +        return self.n_bytes
>> +
>> +    def putv6(self, buf, offset, value, mask):
>> +        _len = self._putv6(buf, offset, value)
>> +        if len(mask):
>> +            return _len + self._putv6(buf, offset + _len, mask)
>> +        return _len
>> +
> 
> s/_len/len_/ please.
> Otherwise looks good.

Oops, I fix and merge this.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to