On Tue, Jun 12, 2012 at 10:55:20AM +0900, FUJITA Tomonori wrote:
> On Tue, 12 Jun 2012 10:51:26 +0900
> Simon Horman <[email protected]> wrote:
> 
> > On Sun, Jun 10, 2012 at 09:37:03AM +0900, FUJITA Tomonori wrote:
> >> Signed-off-by: FUJITA Tomonori <[email protected]>
> >> ---
> >>  ryu/ofproto/nx_match.py     |   28 +++++++++++++++++++++-------
> >>  ryu/ofproto/ofproto_v1_0.py |    1 +
> >>  2 files changed, 22 insertions(+), 7 deletions(-)
> >> 
> >> diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
> >> index 30e9e3a..ff89357 100644
> >> --- a/ryu/ofproto/nx_match.py
> >> +++ b/ryu/ofproto/nx_match.py
> >> @@ -31,7 +31,6 @@ UINT64_MAX = (1 << 64) - 1
> >>  UINT16_MAX = (1 << 16) - 1
> >>  
> >>  FWW_IN_PORT = 1 << 0
> >> -FWW_DL_SRC = 1 << 2
> >>  FWW_DL_TYPE = 1 << 4
> >>  FWW_NW_PROTO = 1 << 5
> >>  # No corresponding OFPFW_* bits
> >> @@ -72,6 +71,7 @@ class Flow(object):
> >>  
> >>  class FlowWildcards(object):
> >>      def __init__(self):
> >> +        self.dl_src_mask = 0
> >>          self.dl_dst_mask = 0
> >>          self.tun_id_mask = 0
> >>          self.vlan_tci_mask = 0
> >> @@ -98,9 +98,14 @@ class ClsRule(object):
> >>                                        zip(dl_dst, mask)))
> >>  
> >>      def set_dl_src(self, dl_src):
> >> -        self.wc.wildcards &= ~FWW_DL_SRC
> >>          self.flow.dl_src = dl_src
> >>  
> >> +    def set_dl_src_masked(self, dl_src, mask):
> >> +        self.wc.dl_src_mask = mask
> >> +        self.flow.dl_src = reduce(lambda x, y: x + y,
> >> +                                  map(lambda x: chr(ord(x[0]) & 
> >> ord(x[1])),
> >> +                                      zip(dl_src, mask)))
> >> +
> > 
> > The above reduce(...) logic also appears in set_dl_dst_masked().
> > Perhaps it would be a good time to put it in its own method?
> 
> I thought about adding it to lib.mac since oxm needs it too. I let it
> alone for the future cleanups.

''.join([chr(ord(x) & ord(y)) for (x, y) in itertools.izip(dl_src, mask)])

Probably I should send the clean up patch after applying this series.


> 
> ------------------------------------------------------------------------------
> 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
> 

-- 
yamahata

------------------------------------------------------------------------------
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