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

diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index f33bb98..0c53013 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -868,6 +868,7 @@ class Flow(object):
         self.vlan_vid = 0
         self.vlan_pcp = 0
         self.ip_dscp = 0
+        self.ip_ecn = 0
         self.arp_op = 0
         self.arp_spa = 0
         self.arp_tpa = 0
@@ -943,6 +944,10 @@ class OFPMatch(object):
             self.fields.append(
                 OFPMatchField.make(ofproto_v1_2.OXM_OF_IP_DSCP))
 
+        if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IP_ECN):
+            self.fields.append(
+                OFPMatchField.make(ofproto_v1_2.OXM_OF_IP_ECN))
+
         if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_OP):
             self.fields.append(
                 OFPMatchField.make(ofproto_v1_2.OXM_OF_ARP_OP))
@@ -1045,6 +1050,10 @@ class OFPMatch(object):
         self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IP_DSCP)
         self.flow.ip_dscp = ip_dscp
 
+    def set_ip_ecn(self, ip_ecn):
+        self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IP_ECN)
+        self.flow.ip_ecn = ip_ecn
+
     def set_arp_opcode(self, arp_op):
         self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_OP)
         self.flow.arp_op = arp_op
@@ -1262,6 +1271,19 @@ class MTIPDscp(OFPMatchField):
         return MTIPDscp(header)
 
 
[email protected]_field_header([ofproto_v1_2.OXM_OF_IP_ECN])
+class MTIPECN(OFPMatchField):
+    def __init__(self, header):
+        super(MTIPECN, self).__init__(header, '!B')
+
+    def serialize(self, buf, offset, match):
+        self.put(buf, offset, match.flow.ip_ecn)
+
+    @classmethod
+    def parser(cls, header, buf, offset):
+        return MTIPECN(header)
+
+
 @OFPMatchField.register_field_header([ofproto_v1_2.OXM_OF_ARP_OP])
 class MTArpOp(OFPMatchField):
     def __init__(self, header):
-- 
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