The check for the need of default values was in the wrong place,
causing no prefix tracking to be used when database had no
configuration for a flow table.  Missing configuration means that
defaults should be used.

To limit clutter on the log, we now log the prefix tracking
configuration when it is explicitly set in the database.

Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
---
 vswitchd/bridge.c |   42 ++++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 3f17490..34d205d 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3134,6 +3134,7 @@ bridge_configure_tables(struct bridge *br)
     j = 0;
     for (i = 0; i < n_tables; i++) {
         struct ofproto_table_settings s;
+        bool no_prefixes = false;
 
         s.name = NULL;
         s.max_flows = UINT_MAX;
@@ -3144,7 +3145,6 @@ bridge_configure_tables(struct bridge *br)
 
         if (j < br->cfg->n_flow_tables && i == br->cfg->key_flow_tables[j]) {
             struct ovsrec_flow_table *cfg = br->cfg->value_flow_tables[j++];
-            bool no_prefixes;
 
             s.name = cfg->name;
             if (cfg->n_flow_limit && *cfg->flow_limit < UINT_MAX) {
@@ -3173,7 +3173,6 @@ bridge_configure_tables(struct bridge *br)
                 }
             }
             /* Prefix lookup fields. */
-            no_prefixes = false;
             s.n_prefix_fields = 0;
             for (k = 0; k < cfg->n_prefixes; k++) {
                 const char *name = cfg->prefixes[k];
@@ -3181,7 +3180,8 @@ bridge_configure_tables(struct bridge *br)
 
                 if (strcmp(name, "none") == 0) {
                     no_prefixes = true;
-                    continue;
+                    s.n_prefix_fields = 0;
+                    break;
                 }
                 mf = mf_from_name(name);
                 if (!mf) {
@@ -3201,25 +3201,27 @@ bridge_configure_tables(struct bridge *br)
                 }
                 s.prefix_fields[s.n_prefix_fields++] = mf->id;
             }
-            if (s.n_prefix_fields == 0 && !no_prefixes) {
-                /* Use default values. */
-                s.n_prefix_fields = ARRAY_SIZE(default_prefix_fields);
-                memcpy(s.prefix_fields, default_prefix_fields,
-                       sizeof default_prefix_fields);
-            }
-            if (s.n_prefix_fields > 0) {
-                int k;
-                struct ds ds = DS_EMPTY_INITIALIZER;
-                for (k = 0; k < s.n_prefix_fields; k++) {
-                    if (k) {
-                        ds_put_char(&ds, ',');
-                    }
-                    ds_put_cstr(&ds, mf_from_id(s.prefix_fields[k])->name);
+        }
+        if (s.n_prefix_fields == 0 && !no_prefixes) {
+            /* Use default values. */
+            s.n_prefix_fields = ARRAY_SIZE(default_prefix_fields);
+            memcpy(s.prefix_fields, default_prefix_fields,
+                   sizeof default_prefix_fields);
+        } else {
+            int k;
+            struct ds ds = DS_EMPTY_INITIALIZER;
+            for (k = 0; k < s.n_prefix_fields; k++) {
+                if (k) {
+                    ds_put_char(&ds, ',');
                 }
-                VLOG_INFO("bridge %s table %d: Prefix lookup with: %s.",
-                          br->name, i, ds_cstr(&ds));
-                ds_destroy(&ds);
+                ds_put_cstr(&ds, mf_from_id(s.prefix_fields[k])->name);
+            }
+            if (s.n_prefix_fields == 0) {
+                ds_put_cstr(&ds, "none");
             }
+            VLOG_INFO("bridge %s table %d: Prefix lookup with: %s.",
+                      br->name, i, ds_cstr(&ds));
+            ds_destroy(&ds);
         }
 
         ofproto_configure_table(br->ofproto, i, &s);
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to