On Wed, 20 Jun 2012 09:11:50 +0900 Simon Horman <[email protected]> wrote:
> On Wed, Jun 20, 2012 at 07:26:17AM +0900, FUJITA Tomonori wrote: > > Signed-off-by: FUJITA Tomonori <[email protected]> > > Reviewed-by: Simon Horman <[email protected]> I fixed one bug that NXM_NX_ICMPV6_TYPE and NXM_NX_ICMPV6_CODE can't be configured independently (the same bug for ICMP_TYPE and ICMP_CODE that I've just fixed). I've merged the following patch. - >From c4e18263003e1222079050df8d80d177c24226c6 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori <[email protected]> Date: Wed, 20 Jun 2012 11:46:05 +0900 Subject: [PATCH] nxm: add NXM_NX_ICMPV6_TYPE and NXM_NX_ICMPV6_CODE support Signed-off-by: FUJITA Tomonori <[email protected]> --- ryu/ofproto/nx_match.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index a6f531f..f287aa4 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -50,6 +50,7 @@ ETH_TYPE_IPV6 = 0x86dd ETH_TYPE_LACP = 0x8809 IPPROTO_ICMP = 1 +IPPROTO_ICMPV6 = 58 IP_ECN_MASK = 0x03 IP_DSCP_MASK = 0xfc @@ -197,6 +198,12 @@ class ClsRule(object): self.wc.wildcards &= ~FWW_ARP_THA self.flow.arp_tha = tha + def set_icmpv6_type(self, icmp_type): + self.set_tp_src(icmp_type) + + def set_icmpv6_code(self, icmp_code): + self.set_tp_dst(icmp_code) + def flow_format(self): # Tunnel ID is only supported by NXM if self.wc.tun_id_mask != 0: @@ -487,6 +494,28 @@ class MFICMPCode(MFField): return self._put(buf, offset, rule.flow.tp_dst) +@_register_make +@_set_nxm_headers([ofproto_v1_0.NXM_NX_ICMPV6_TYPE]) +class MFICMPV6Type(MFField): + @classmethod + def make(cls): + return cls(MF_PACK_STRING_8) + + def put(self, buf, offset, rule): + return self._put(buf, offset, rule.flow.tp_src) + + +@_register_make +@_set_nxm_headers([ofproto_v1_0.NXM_NX_ICMPV6_CODE]) +class MFICMPV6Code(MFField): + @classmethod + def make(cls): + return cls(MF_PACK_STRING_8) + + def put(self, buf, offset, rule): + return self._put(buf, offset, rule.flow.tp_dst) + + def serialize_nxm_match(rule, buf, offset): old_offset = offset @@ -584,6 +613,15 @@ def serialize_nxm_match(rule, buf, offset): offset += nxm_put(buf, offset, header, rule) # XXX: IPv6 + if not rule.wc.wildcards & FWW_NW_PROTO and (rule.flow.nw_proto + == IPPROTO_ICMPV6): + if rule.wc.tp_src_mask != 0: + offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_ICMPV6_TYPE, + rule) + if rule.wc.tp_dst_mask != 0: + offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_ICMPV6_CODE, + rule) + # ARP if not rule.wc.wildcards & FWW_ARP_SHA: offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_ARP_SHA, rule) -- 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
