[ovs-dev] [PATCH] learning-switch: Wildcard more fields to avoid normalization warnings.

Ben Pfaff blp at nicira.com
Thu Jun 2 16:25:54 UTC 2011


On Wed, Jun 01, 2011 at 04:26:13PM -0700, Jean Tourrilhes wrote:
> On Wed, Jun 01, 2011 at 01:59:50PM -0700, Ben Pfaff wrote:
> > On Wed, Jun 01, 2011 at 01:38:17PM -0700, Jean Tourrilhes wrote:
> > > On Wed, Jun 01, 2011 at 09:34:22AM -0700, Ben Pfaff wrote:
> > > > FWW_NW_TOS and some other L3 fields weren't wildcarded, but should have
> > > > been.  It's better to start with all fields wildcarded and then unwildcard
> > > > the ones that shouldn't be.
> > > 
> > > 	Problems :
> > > 	1) By default, the controller does not start in exact match
> > > mode, flows are always wildcarded, and there is no way to set matching
> > > to exact match.
> > 
> > Why do you say this?
> 
> 	On the 1.1.0 branch, the fix to properly set exact_flows in
> the config is not done. The patch need to be done in
> ovs-controller.c... Maybe that's a separate patch, but don't forget
> about it ;-)

I was missing that patch.  Having applied it, I see the "new"
normalization warning that you mentioned:

> -------------------------------------------------
> Jun 01 13:30:38|00042|ofp_util|INFO| pre: wildcards=  0x2820f0  in_port=    1  dl_src=20:fd:f1:71:e3:99  dl_dst=01:80:c2:00:00:0a  dl_vlan=65535  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
> Jun 01 13:30:38|00043|ofp_util|INFO|post: wildcards=  0x2ffff0  in_port=    1  dl_src=20:fd:f1:71:e3:99  dl_dst=01:80:c2:00:00:0a  dl_vlan=65535  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
> -------------------------------------------------

This was fixed on "master" by the commit
f1f41fb6b9ad166769fedacf66aca3b0364ced29, which I'm happy to apply to
branch-1.1 also in the following form.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Fri, 29 Apr 2011 15:47:26 -0700
Subject: [PATCH] ofp-util: Don't warn for different forms of nw_{src,dst}
 wildcards.

OpenFlow 1.0 uses a 6-bit field to express the number of wildcarded bits
in the nw_src and nw_dst field.  Any value 32 or greater in these fields
(binary 1xxxxx) means that all of the bits are wildcarded.  That means
that there are 32 different ways to express a wildcarded nw_src or nw_dst.
At least two of those seem sensible (100000 and 111111) so we shouldn't
warn about one of them.

This fixes the problem by ORing with 100000 instead of 111111, so that any
already-correct wildcarded mask won't be affected.

This fix allows us to update some tests.

Reviewed-by: Simon Horman <horms at verge.net.au>
---
 lib/ofp-util.c     |    2 +-
 tests/ovs-ofctl.at |   19 +------------------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index d39b0bc..101fa6b 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2162,7 +2162,7 @@ actions_next(struct actions_iterator *iter)
 void
 normalize_match(struct ofp_match *m)
 {
-    enum { OFPFW_NW = (OFPFW_NW_SRC_MASK | OFPFW_NW_DST_MASK | OFPFW_NW_PROTO
+    enum { OFPFW_NW = (OFPFW_NW_SRC_ALL | OFPFW_NW_DST_ALL | OFPFW_NW_PROTO
                        | OFPFW_NW_TOS) };
     enum { OFPFW_TP = OFPFW_TP_SRC | OFPFW_TP_DST };
     uint32_t wc;
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 466ade6..41b0126 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -18,7 +18,7 @@ actions=drop
 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
 ]])
 AT_CHECK([ovs-ofctl parse-flows flows.txt
-], [0], [stdout], [stderr])
+], [0], [stdout])
 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], 
 [[OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
 OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
@@ -36,23 +36,6 @@ OFPT_FLOW_MOD: ADD actions=drop
 NXT_SET_FLOW_FORMAT: format=nxm
 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
 ]])
-AT_CHECK([sed 's/.*|//' stderr], [0], [dnl
-normalization changed ofp_match, details:
- pre: wildcards=  0x3820f8  in_port=65534  dl_src=00:0a:e4:25:6b:b0  dl_dst=00:00:00:00:00:00  dl_vlan=    9  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-post: wildcards=  0x3ffff8  in_port=65534  dl_src=00:0a:e4:25:6b:b0  dl_dst=00:00:00:00:00:00  dl_vlan=    9  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-normalization changed ofp_match, details:
- pre: wildcards=  0x3820ff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-post: wildcards=  0x3fffff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-normalization changed ofp_match, details:
- pre: wildcards=  0x3820ff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-post: wildcards=  0x3fffff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-normalization changed ofp_match, details:
- pre: wildcards=  0x3820ff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-post: wildcards=  0x3fffff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-normalization changed ofp_match, details:
- pre: wildcards= 0x23820ff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-post: wildcards= 0x23fffff  in_port=65534  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
-])
 AT_CLEANUP
 
 AT_SETUP([ovs-ofctl -F nxm parse-flows])
-- 
1.7.4.4




More information about the dev mailing list