Hello,
I updated the code for the match_tuple() function:
It installs the match for the network src/dst if the mask is valid, else
the nw src/dst is ignored.
My last patch had an error there, sorry.

Changes:
FIX: match_tuple() function now handles nw src/dst correctly.
FIX: match_tuple function now handles the nw src/dst masks correctly.
If the mask is not valid, because there is no NX, it will be ignored.

Christopher


PATCH:
--- nx_match.py.orig 2013-03-27 19:31:48.000000000 +0100
+++ nx_match.py 2013-03-31 23:45:30.764089011 +0200
@@ -336,15 +336,15 @@ class ClsRule(object):
         if self.flow.nw_proto != 0:
             wildcards &= ~ofproto_v1_0.OFPFW_NW_PROTO

-        if self.flow.nw_src != 0:
+        if self.wc.nw_src_mask != 0 and "01" not in
bin(self.wc.nw_src_mask):
             wildcards &= ~ofproto_v1_0.OFPFW_NW_SRC_MASK
-            # maximum size of 32 to prevent changes on other bits
-            wildcards |= (self.wc.nw_src_mask % 32) << 8
+            maskbits = (bin(self.wc.nw_src_mask).count("0") - 1)
+            wildcards |= (maskbits << ofproto_v1_0.OFPFW_NW_SRC_SHIFT)

-        if self.flow.nw_dst != 0:
+        if self.wc.nw_dst_mask != 0 and "01" not in
bin(self.wc.nw_dst_mask):
             wildcards &= ~ofproto_v1_0.OFPFW_NW_DST_MASK
-            # maximum size of 32 to prevent changes on other bits
-            wildcards |= (self.wc.nw_dst_mask % 32) << 14
+            maskbits = (bin(self.wc.nw_dst_mask).count("0") - 1)
+            wildcards |= (maskbits << ofproto_v1_0.OFPFW_NW_DST_SHIFT)

         if self.flow.tp_src != 0:
             wildcards &= ~ofproto_v1_0.OFPFW_TP_SRC
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to