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

diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index 4a980ea..2a6b748 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -874,6 +874,8 @@ class Flow(object):
         self.ipv4_dst = 0
         self.tcp_src = 0
         self.tcp_dst = 0
+        self.udp_src = 0
+        self.udp_dst = 0
         self.arp_op = 0
         self.arp_spa = 0
         self.arp_tpa = 0
@@ -983,6 +985,14 @@ class OFPMatch(object):
             self.fields.append(
                 OFPMatchField.make(ofproto_v1_2.OXM_OF_TCP_DST))
 
+        if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_UDP_SRC):
+            self.fields.append(
+                OFPMatchField.make(ofproto_v1_2.OXM_OF_UDP_SRC))
+
+        if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_UDP_DST):
+            self.fields.append(
+                OFPMatchField.make(ofproto_v1_2.OXM_OF_UDP_DST))
+
         if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_OP):
             self.fields.append(
                 OFPMatchField.make(ofproto_v1_2.OXM_OF_ARP_OP))
@@ -1117,6 +1127,14 @@ class OFPMatch(object):
         self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_TCP_DST)
         self.flow.tcp_dst = tcp_dst
 
+    def set_udp_src(self, udp_src):
+        self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_UDP_SRC)
+        self.flow.udp_src = udp_src
+
+    def set_udp_dst(self, udp_dst):
+        self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_UDP_DST)
+        self.flow.udp_dst = udp_dst
+
     def set_arp_opcode(self, arp_op):
         self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_OP)
         self.flow.arp_op = arp_op
@@ -1422,6 +1440,32 @@ class MTTCPDst(OFPMatchField):
         return MTTCPDst(header)
 
 
[email protected]_field_header([ofproto_v1_2.OXM_OF_UDP_SRC])
+class MTUDPSrc(OFPMatchField):
+    def __init__(self, header):
+        super(MTUDPSrc, self).__init__(header, '!H')
+
+    def serialize(self, buf, offset, match):
+        self.put(buf, offset, match.flow.udp_src)
+
+    @classmethod
+    def parser(cls, header, buf, offset):
+        return MTUDPSrc(header)
+
+
[email protected]_field_header([ofproto_v1_2.OXM_OF_UDP_DST])
+class MTUDPDst(OFPMatchField):
+    def __init__(self, header):
+        super(MTUDPDst, self).__init__(header, '!H')
+
+    def serialize(self, buf, offset, match):
+        self.put(buf, offset, match.flow.udp_dst)
+
+    @classmethod
+    def parser(cls, header, buf, offset):
+        return MTUDPDst(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