Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/ofproto/nx_match.py     |   31 +++++++++++++++++++++++++++++++
 ryu/ofproto/ofproto_v1_0.py |    3 +++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 209d1c2..4d37471 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -87,6 +87,7 @@ class Flow(object):
         self.arp_tpa = 0
         self.ipv6_src = []
         self.ipv6_dst = []
+        self.nd_target = []
         self.ipv6_label = 0
 
 
@@ -104,6 +105,7 @@ class FlowWildcards(object):
         self.vlan_tci_mask = 0
         self.ipv6_src_mask = []
         self.ipv6_dst_mask = []
+        self.nd_target_mask = []
         self.wildcards = FWW_ALL
 
 
@@ -247,6 +249,14 @@ class ClsRule(object):
     def set_ipv6_dst(self, dst):
         self.flow.ipv6_dst = dst
 
+    def set_nd_target_masked(self, target, mask):
+        self.wc.nd_target_mask = mask
+        self.flow.nd_target = [x & y for (x, y) in
+                               itertools.izip(target, mask)]
+
+    def set_nd_target(self, target):
+        self.flow.nd_target = target
+
     def flow_format(self):
         # Tunnel ID is only supported by NXM
         if self.wc.tun_id_mask != 0:
@@ -566,6 +576,20 @@ class MFIPV6Dst(MFField):
 
 
 @_register_make
+@_set_nxm_headers([ofproto_v1_0.NXM_NX_ND_TARGET,
+                   ofproto_v1_0.NXM_NX_ND_TARGET_W])
+class MFNdTarget(MFField):
+    @classmethod
+    def make(cls):
+        return cls('!4I')
+
+    def put(self, buf, offset, rule):
+        return self.putv6(buf, offset,
+                          rule.flow.nd_target,
+                          rule.wc.nd_target_mask)
+
+
+@_register_make
 @_set_nxm_headers([ofproto_v1_0.NXM_NX_ARP_THA])
 class MFArpTha(MFField):
     @classmethod
@@ -754,6 +778,13 @@ def serialize_nxm_match(rule, buf, offset):
             header = ofproto_v1_0.NXM_NX_IPV6_DST
         offset += nxm_put(buf, offset, header, rule)
 
+    if len(rule.flow.nd_target):
+        if len(rule.wc.nd_target_mask):
+            header = ofproto_v1_0.NXM_NX_ND_TARGET_W
+        else:
+            header = ofproto_v1_0.NXM_NX_ND_TARGET
+        offset += nxm_put(buf, offset, header, rule)
+
     # ARP
     if rule.flow.arp_spa != 0:
         if rule.wc.arp_spa_mask == UINT32_MAX:
diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
index bc1ce5c..078178e 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -715,6 +715,9 @@ NXM_NX_IPV6_DST_W = nxm_header_w(0x0001, 20, 16)
 NXM_NX_ICMPV6_TYPE = nxm_header(0x0001, 21, 1)
 NXM_NX_ICMPV6_CODE = nxm_header(0x0001, 22, 1)
 
+NXM_NX_ND_TARGET = nxm_header(0x0001, 23, 16)
+NXM_NX_ND_TARGET_W = nxm_header_w(0x0001, 23, 16)
+
 NXM_NX_ND_SLL = nxm_header(0x0001, 24, 6)
 
 NXM_NX_ND_TLL = nxm_header(0x0001, 25, 6)
-- 
1.7.4.4


------------------------------------------------------------------------------
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