[ovs-dev] [PATCH] tests/classifier: Make test work in big-endian systems.

Jarno Rajahalme jrajahalme at nicira.com
Wed Dec 3 21:21:48 UTC 2014


Change a test so that the result will be the same in both
little-endian and big-endian systems.

Reported-by: Mijo Safradin <mijo at linux.vnet.ibm.com>
Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
---
 lib/classifier.c    |    3 ++-
 tests/classifier.at |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index fe43bd1..1985efe 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1336,7 +1336,8 @@ miniflow_and_mask_matches_flow_wc(const struct miniflow *flow,
             /* Only unwildcard if none of the differing bits is already
              * exact-matched. */
             if (!(flow_u32_value(&wc->masks, idx) & diff)) {
-                /* Keep one bit of the difference. */
+                /* Keep one bit of the difference.  The selected bit may be
+                 * different in big-endian v.s. little-endian systems. */
                 *flow_u32_lvalue(&wc->masks, idx) |= rightmost_1bit(diff);
             }
             return false;
diff --git a/tests/classifier.at b/tests/classifier.at
index 4d23be5..eb97022 100644
--- a/tests/classifier.at
+++ b/tests/classifier.at
@@ -43,9 +43,9 @@ AT_CHECK([tail -2 stdout], [0],
   [Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
 Datapath actions: 1
 ])
-AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=11.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
 AT_CHECK([tail -2 stdout], [0],
-  [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=0.0.0.0/2.0.0.0,nw_frag=no
+  [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=1.0.0.0/1.0.0.0,nw_frag=no
 Datapath actions: drop
 ])
 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
-- 
1.7.10.4




More information about the dev mailing list