Hello,
sorry for problems with the patch submission. Hope it works now.

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


>From 85974e5ded85dd6f9e0592d32ffc949c4df3eab0 Mon Sep 17 00:00:00 2001
From: blacksheeep <blacksheeep@blacksheeep-Latitude-E6420.(none)>
Date: Mon, 8 Apr 2013 13:03:54 +0200
Subject: [PATCH] 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.

---
 ryu/ofproto/nx_match.py |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 715129c..1019ac4 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -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
@@ -352,8 +352,6 @@ class ClsRule(object):
         if self.flow.tp_dst != 0:
             wildcards &= ~ofproto_v1_0.OFPFW_TP_DST
 
-        #FIXME: add support for arp, icmp, etc
-
         return (wildcards, self.flow.in_port, self.flow.dl_src,
                 self.flow.dl_dst, self.flow.dl_vlan,
self.flow.dl_vlan_pcp,
                 self.flow.dl_type, self.flow.nw_tos & IP_DSCP_MASK,
-- 
1.7.10.4





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