]> git.proxmox.com Git - mirror_ovs.git/commitdiff
ovn-controller: Disable probes by default for unix sockets.
authorHan Zhou <zhouhan@gmail.com>
Tue, 2 May 2017 20:22:35 +0000 (13:22 -0700)
committerBen Pfaff <blp@ovn.org>
Wed, 3 May 2017 16:01:59 +0000 (09:01 -0700)
Normally the OVS JSON-RPC library does not probe idle connections across
Unix domain sockets, since the kernel can tell OVS whether the connections
are truly connected without probes, but ovn-controller carelessly
overrode that.

(This should not be an issue in typical OVN deployments, because the OVN SB
database is normally accessed via TCP or SSL.)

CC: Nirapada Ghosh <nghosh@us.ibm.com>
Fixes: 715038b6b222 ("ovn-controller: reload configured SB probe timer")
Signed-off-by: Han Zhou <zhouhan@gmail.com>
Co-authored-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovn/controller/ovn-controller.c

index 8b3a1a05ba7bfee501200e997f40f7772c803abe..f22551d6dcf3e8c8234ff0dd23a5ae5498e23221 100644 (file)
@@ -64,7 +64,8 @@ static unixctl_cb_func inject_pkt;
 #define DEFAULT_BRIDGE_NAME "br-int"
 #define DEFAULT_PROBE_INTERVAL_MSEC 5000
 
-static void update_probe_interval(struct controller_ctx *);
+static void update_probe_interval(struct controller_ctx *,
+                                  const char *ovnsb_remote);
 static void parse_options(int argc, char *argv[]);
 OVS_NO_RETURN static void usage(void);
 
@@ -599,7 +600,7 @@ main(int argc, char *argv[])
             .ovnsb_idl_txn = ovsdb_idl_loop_run(&ovnsb_idl_loop),
         };
 
-        update_probe_interval(&ctx);
+        update_probe_interval(&ctx, ovnsb_remote);
 
         update_ssl_config(ctx.ovs_idl);
 
@@ -930,14 +931,21 @@ inject_pkt(struct unixctl_conn *conn, int argc OVS_UNUSED,
 /* Get the desired SB probe timer from the OVS database and configure it into
  * the SB database. */
 static void
-update_probe_interval(struct controller_ctx *ctx)
+update_probe_interval(struct controller_ctx *ctx, const char *ovnsb_remote)
 {
     const struct ovsrec_open_vswitch *cfg
         = ovsrec_open_vswitch_first(ctx->ovs_idl);
-    int interval = (cfg
-                    ? smap_get_int(&cfg->external_ids,
-                                   "ovn-remote-probe-interval",
-                                   DEFAULT_PROBE_INTERVAL_MSEC)
-                    : DEFAULT_PROBE_INTERVAL_MSEC);
+    int interval = -1;
+    if (cfg) {
+        interval = smap_get_int(&cfg->external_ids,
+                                "ovn-remote-probe-interval",
+                                -1);
+    }
+    if (interval == -1) {
+        interval = stream_or_pstream_needs_probes(ovnsb_remote)
+                   ? DEFAULT_PROBE_INTERVAL_MSEC
+                   : 0;
+    }
+
     ovsdb_idl_set_probe_interval(ctx->ovnsb_idl, interval);
 }