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

diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 98f974b..799d90d 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -39,6 +39,7 @@ FWW_NW_DSCP = 1 << 1
 FWW_NW_ECN = 1 << 2
 FWW_ARP_SHA = 1 << 3
 FWW_ARP_THA = 1 << 6
+FWW_IPV6_LABEL = 1 << 7
 FWW_NW_TTL = 1 << 8
 FWW_ALL = (1 << 13) - 1
 
@@ -83,6 +84,7 @@ class Flow(object):
         self.tun_id = 0
         self.arp_spa = 0
         self.arp_tpa = 0
+        self.ipv6_label = 0
 
 
 class FlowWildcards(object):
@@ -222,6 +224,10 @@ class ClsRule(object):
     def set_icmpv6_code(self, icmp_code):
         self.set_tp_dst(icmp_code)
 
+    def set_ipv6_label(self, label):
+        self.wc.wildcards &= ~FWW_IPV6_LABEL
+        self.flow.ipv6_label = label
+
     def flow_format(self):
         # Tunnel ID is only supported by NXM
         if self.wc.tun_id_mask != 0:
@@ -556,6 +562,17 @@ class MFICMPV6Code(MFField):
         return self._put(buf, offset, rule.flow.tp_dst)
 
 
+@_register_make
+@_set_nxm_headers([ofproto_v1_0.NXM_NX_IPV6_LABEL])
+class MFICMPV6Label(MFField):
+    @classmethod
+    def make(cls):
+        return cls(MF_PACK_STRING_BE32)
+
+    def put(self, buf, offset, rule):
+        return self._put(buf, offset, rule.flow.ipv6_label)
+
+
 def serialize_nxm_match(rule, buf, offset):
     old_offset = offset
 
@@ -662,6 +679,9 @@ def serialize_nxm_match(rule, buf, offset):
             offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_ICMPV6_CODE,
                               rule)
 
+    if not rule.wc.wildcards & FWW_IPV6_LABEL:
+        offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_IPV6_LABEL, 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 b88581e..4564843 100644
--- a/ryu/ofproto/ofproto_v1_0.py
+++ b/ryu/ofproto/ofproto_v1_0.py
@@ -714,6 +714,8 @@ NXM_NX_ND_SLL = nxm_header(0x0001, 24, 6)
 
 NXM_NX_ND_TLL = nxm_header(0x0001, 25, 6)
 
+NXM_NX_IPV6_LABEL = nxm_header(0x0001, 27, 4)
+
 NXM_NX_IP_ECN = nxm_header(0x0001, 28, 1)
 
 NXM_NX_IP_TTL = nxm_header(0x0001, 29, 1)
-- 
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