vlan-splinter: Fix inverted logic bug.
[cascardo/ovs.git] / vswitchd / bridge.c
index 1fbbe32..96bd997 100644 (file)
@@ -274,6 +274,7 @@ bridge_init(const char *remote)
     idl = ovsdb_idl_create(remote, &ovsrec_idl_class, true);
     idl_seqno = ovsdb_idl_get_seqno(idl);
     ovsdb_idl_set_lock(idl, "ovs_vswitchd");
+    ovsdb_idl_verify_write_only(idl);
 
     ovsdb_idl_omit_alert(idl, &ovsrec_open_vswitch_col_cur_cfg);
     ovsdb_idl_omit_alert(idl, &ovsrec_open_vswitch_col_statistics);
@@ -305,6 +306,7 @@ bridge_init(const char *remote)
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_fault_status);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_remote_mpids);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_health);
+    ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_remote_opstate);
     ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_lacp_current);
     ovsdb_idl_omit(idl, &ovsrec_interface_col_external_ids);
 
@@ -885,7 +887,7 @@ port_configure_stp(const struct ofproto *ofproto, struct port *port,
     const char *config_str;
     struct iface *iface;
 
-    if (smap_get_bool(&port->cfg->other_config, "stp-enable", false)) {
+    if (!smap_get_bool(&port->cfg->other_config, "stp-enable", true)) {
         port_s->enable = false;
         return;
     } else {
@@ -1415,7 +1417,7 @@ bridge_configure_flow_eviction_threshold(struct bridge *br)
     if (threshold_str) {
         threshold = strtoul(threshold_str, NULL, 10);
     } else {
-        threshold = OFPROTO_FLOW_EVICTON_THRESHOLD_DEFAULT;
+        threshold = OFPROTO_FLOW_EVICTION_THRESHOLD_DEFAULT;
     }
     ofproto_set_flow_eviction_threshold(br->ofproto, threshold);
 }
@@ -2525,7 +2527,12 @@ bridge_add_del_ports(struct bridge *br,
             if (iface) {
                 iface->cfg = cfg;
                 iface->type = type;
-            } else if (strcmp(type, "null")) {
+            } else if (!strcmp(type, "null")) {
+                VLOG_WARN_ONCE("%s: The null interface type is deprecated and"
+                               " may be removed in February 2013. Please email"
+                               " dev@openvswitch.org with concerns.",
+                               cfg->name);
+            } else {
                 bridge_queue_if_cfg(br, cfg, port);
             }
         }
@@ -3305,12 +3312,24 @@ iface_configure_cfm(struct iface *iface)
     const char *opstate_str;
     const char *cfm_ccm_vlan;
     struct cfm_settings s;
+    struct smap netdev_args;
 
     if (!cfg->n_cfm_mpid) {
         ofproto_port_clear_cfm(iface->port->bridge->ofproto, iface->ofp_port);
         return;
     }
 
+    s.check_tnl_key = false;
+    smap_init(&netdev_args);
+    if (!netdev_get_config(iface->netdev, &netdev_args)) {
+        const char *key = smap_get(&netdev_args, "key");
+        const char *in_key = smap_get(&netdev_args, "in_key");
+
+        s.check_tnl_key = (key && !strcmp(key, "flow"))
+                           || (in_key && !strcmp(in_key, "flow"));
+    }
+    smap_destroy(&netdev_args);
+
     s.mpid = *cfg->cfm_mpid;
     s.interval = smap_get_int(&iface->cfg->other_config, "cfm_interval", 0);
     cfm_ccm_vlan = smap_get(&iface->cfg->other_config, "cfm_ccm_vlan");
@@ -3683,10 +3702,10 @@ collect_splinter_vlans(const struct ovsrec_open_vswitch *ovs_cfg)
                 if (!netdev_open(vlan_dev->name, "system", &netdev)) {
                     if (!netdev_get_in4(netdev, NULL, NULL) ||
                         !netdev_get_in6(netdev, NULL)) {
-                        vlandev_del(vlan_dev->name);
-                    } else {
                         /* It has an IP address configured, so we don't own
                          * it.  Don't delete it. */
+                    } else {
+                        vlandev_del(vlan_dev->name);
                     }
                     netdev_close(netdev);
                 }