datapath: Add vlan acceleration field for older kernels.
[openvswitch] / utilities / ovs-vsctl.c
index acdcaf31739654a31f5c7231de0a0fd143106751..fd9f8f4aba9600c7c8aff3279b32695076d1737b 100644 (file)
@@ -531,7 +531,7 @@ default_db(void)
 {
     static char *def;
     if (!def) {
-        def = xasprintf("unix:%s/db.sock", ovs_rundir);
+        def = xasprintf("unix:%s/db.sock", ovs_rundir());
     }
     return def;
 }
@@ -978,9 +978,11 @@ static void
 pre_cmd_emer_reset(struct vsctl_context *ctx)
 {
     ovsdb_idl_add_column(ctx->idl, &ovsrec_open_vswitch_col_managers);
+    ovsdb_idl_add_column(ctx->idl, &ovsrec_open_vswitch_col_manager_options);
     ovsdb_idl_add_column(ctx->idl, &ovsrec_open_vswitch_col_ssl);
 
     ovsdb_idl_add_column(ctx->idl, &ovsrec_bridge_col_controller);
+    ovsdb_idl_add_column(ctx->idl, &ovsrec_bridge_col_fail_mode);
     ovsdb_idl_add_column(ctx->idl, &ovsrec_bridge_col_mirrors);
     ovsdb_idl_add_column(ctx->idl, &ovsrec_bridge_col_netflow);
     ovsdb_idl_add_column(ctx->idl, &ovsrec_bridge_col_sflow);
@@ -1004,12 +1006,14 @@ cmd_emer_reset(struct vsctl_context *ctx)
     const struct ovsrec_interface *iface;
     const struct ovsrec_mirror *mirror, *next_mirror;
     const struct ovsrec_controller *ctrl, *next_ctrl;
+    const struct ovsrec_manager *mgr, *next_mgr;
     const struct ovsrec_netflow *nf, *next_nf;
     const struct ovsrec_ssl *ssl, *next_ssl;
     const struct ovsrec_sflow *sflow, *next_sflow;
 
     /* Reset the Open_vSwitch table. */
     ovsrec_open_vswitch_set_managers(ctx->ovs, NULL, 0);
+    ovsrec_open_vswitch_set_manager_options(ctx->ovs, NULL, 0);
     ovsrec_open_vswitch_set_ssl(ctx->ovs, NULL);
 
     OVSREC_BRIDGE_FOR_EACH (br, idl) {
@@ -1018,6 +1022,7 @@ cmd_emer_reset(struct vsctl_context *ctx)
         char *hw_val = NULL;
 
         ovsrec_bridge_set_controller(br, NULL, 0);
+        ovsrec_bridge_set_fail_mode(br, NULL);
         ovsrec_bridge_set_mirrors(br, NULL, 0);
         ovsrec_bridge_set_netflow(br, NULL);
         ovsrec_bridge_set_sflow(br, NULL);
@@ -1058,6 +1063,10 @@ cmd_emer_reset(struct vsctl_context *ctx)
         ovsrec_controller_delete(ctrl);
     }
 
+    OVSREC_MANAGER_FOR_EACH_SAFE (mgr, next_mgr, idl) {
+        ovsrec_manager_delete(mgr);
+    }
+
     OVSREC_NETFLOW_FOR_EACH_SAFE (nf, next_nf, idl) {
         ovsrec_netflow_delete(nf);
     }
@@ -1699,6 +1708,14 @@ verify_controllers(struct ovsrec_bridge *bridge)
     }
 }
 
+static void
+pre_controller(struct vsctl_context *ctx)
+{
+    pre_get_info(ctx);
+
+    ovsdb_idl_add_column(ctx->idl, &ovsrec_controller_col_target);
+}
+
 static void
 cmd_get_controller(struct vsctl_context *ctx)
 {
@@ -1973,6 +1990,16 @@ static const struct vsctl_table_class tables[] = {
      {{&ovsrec_table_port, &ovsrec_port_col_name, &ovsrec_port_col_qos},
       {NULL, NULL, NULL}}},
 
+    {&ovsrec_table_monitor,
+     {{&ovsrec_table_interface,
+       &ovsrec_interface_col_name,
+       &ovsrec_interface_col_monitor},
+      {NULL, NULL, NULL}}},
+
+    {&ovsrec_table_maintenance_point,
+     {{NULL, NULL, NULL},
+      {NULL, NULL, NULL}}},
+
     {&ovsrec_table_queue,
      {{NULL, NULL, NULL},
       {NULL, NULL, NULL}}},
@@ -3160,7 +3187,6 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
 
     for (c = commands; c < &commands[n_commands]; c++) {
         struct ds *ds = &c->output;
-        struct shash_node *node;
 
         if (oneline) {
             size_t j;
@@ -3187,10 +3213,7 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
         }
         ds_destroy(&c->output);
 
-        SHASH_FOR_EACH (node, &c->options) {
-            free(node->data);
-        }
-        shash_destroy(&c->options);
+        smap_destroy(&c->options);
     }
     free(commands);
 
@@ -3256,10 +3279,10 @@ static const struct vsctl_command_syntax all_commands[] = {
     {"iface-to-br", 1, 1, pre_get_info, cmd_iface_to_br, NULL, "", RO},
 
     /* Controller commands. */
-    {"get-controller", 1, 1, pre_get_info, cmd_get_controller, NULL, "", RO},
-    {"del-controller", 1, 1, pre_get_info, cmd_del_controller, NULL, "", RW},
-    {"set-controller", 1, INT_MAX, pre_get_info, cmd_set_controller, NULL, "",
-     RW},
+    {"get-controller", 1, 1, pre_controller, cmd_get_controller, NULL, "", RO},
+    {"del-controller", 1, 1, pre_controller, cmd_del_controller, NULL, "", RW},
+    {"set-controller", 1, INT_MAX, pre_controller, cmd_set_controller, NULL,
+     "", RW},
     {"get-fail-mode", 1, 1, pre_get_info, cmd_get_fail_mode, NULL, "", RO},
     {"del-fail-mode", 1, 1, pre_get_info, cmd_del_fail_mode, NULL, "", RW},
     {"set-fail-mode", 2, 2, pre_get_info, cmd_set_fail_mode, NULL, "", RW},