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 cd21eab..923ab61 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -878,6 +878,8 @@ class Flow(object):
self.udp_dst = 0
self.sctp_src = 0
self.sctp_dst = 0
+ self.icmpv4_type = 0
+ self.icmpv4_code = 0
self.arp_op = 0
self.arp_spa = 0
self.arp_tpa = 0
@@ -1003,6 +1005,14 @@ class OFPMatch(object):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_SCTP_DST))
+ if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ICMPV4_TYPE):
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_ICMPV4_TYPE))
+
+ if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ICMPV4_CODE):
+ self.fields.append(
+ OFPMatchField.make(ofproto_v1_2.OXM_OF_ICMPV4_CODE))
+
if self.wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_OP):
self.fields.append(
OFPMatchField.make(ofproto_v1_2.OXM_OF_ARP_OP))
@@ -1153,6 +1163,14 @@ class OFPMatch(object):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_SCTP_DST)
self.flow.sctp_dst = sctp_dst
+ def set_icmpv4_type(self, icmpv4_type):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ICMPV4_TYPE)
+ self.flow.icmpv4_type = icmpv4_type
+
+ def set_icmpv4_code(self, icmpv4_code):
+ self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ICMPV4_CODE)
+ self.flow.icmpv4_code = icmpv4_code
+
def set_arp_opcode(self, arp_op):
self.wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_OP)
self.flow.arp_op = arp_op
@@ -1510,6 +1528,32 @@ class MTSCTPDst(OFPMatchField):
return MTSCTPDst(header)
[email protected]_field_header([ofproto_v1_2.OXM_OF_ICMPV4_TYPE])
+class MTICMPV4Type(OFPMatchField):
+ def __init__(self, header):
+ super(MTICMPV4Type, self).__init__(header, '!B')
+
+ def serialize(self, buf, offset, match):
+ self.put(buf, offset, match.flow.icmpv4_type)
+
+ @classmethod
+ def parser(cls, header, buf, offset):
+ return MTICMPV4Type(header)
+
+
[email protected]_field_header([ofproto_v1_2.OXM_OF_ICMPV4_CODE])
+class MTICMPV4Code(OFPMatchField):
+ def __init__(self, header):
+ super(MTICMPV4Code, self).__init__(header, '!B')
+
+ def serialize(self, buf, offset, match):
+ self.put(buf, offset, match.flow.icmpv4_code)
+
+ @classmethod
+ def parser(cls, header, buf, offset):
+ return MTICMPV4Code(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