X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fbridge.c;h=ef2a22a95819d6bf7aef6f43ae8bd38bd7bafa48;hb=6b7c12fdc1d3a08a934b29109fa6ffac6b45ebe0;hp=1065d6eaf8177a50deb64807a8c13b194823f59d;hpb=bffc058934d43fb5a2c8629ee914a949ddf80c8e;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1065d6ea..ef2a22a9 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1342,13 +1342,20 @@ bridge_refresh_controller_status(const struct bridge *br) ofproto_get_ofproto_controller_info(br->ofproto, &info); OVSREC_CONTROLLER_FOR_EACH(cfg, idl) { - struct ofproto_controller_info *cinfo = shash_find_data(&info, cfg->target); - - ovsrec_controller_set_is_connected(cfg, cinfo->is_connected); - ovsrec_controller_set_role(cfg, nx_role_to_str(cinfo->role)); - ovsrec_controller_set_status(cfg, (char **) cinfo->pairs.keys, - (char **) cinfo->pairs.values, - cinfo->pairs.n); + struct ofproto_controller_info *cinfo = + shash_find_data(&info, cfg->target); + + if (cinfo) { + ovsrec_controller_set_is_connected(cfg, cinfo->is_connected); + ovsrec_controller_set_role(cfg, nx_role_to_str(cinfo->role)); + ovsrec_controller_set_status(cfg, (char **) cinfo->pairs.keys, + (char **) cinfo->pairs.values, + cinfo->pairs.n); + } else { + ovsrec_controller_set_is_connected(cfg, false); + ovsrec_controller_set_role(cfg, NULL); + ovsrec_controller_set_status(cfg, NULL, NULL, 0); + } } ofproto_free_ofproto_controller_info(&info); @@ -1378,6 +1385,20 @@ bridge_run(void) /* (Re)configure if necessary. */ database_changed = ovsdb_idl_run(idl); cfg = ovsrec_open_vswitch_first(idl); +#ifdef HAVE_OPENSSL + /* Re-configure SSL. We do this on every trip through the main loop, + * instead of just when the database changes, because the contents of the + * key and certificate files can change without the database changing. + * + * We do this before bridge_reconfigure() because that function might + * initiate SSL connections and thus requires SSL to be configured. */ + if (cfg && cfg->ssl) { + const struct ovsrec_ssl *ssl = cfg->ssl; + + stream_ssl_set_key_and_cert(ssl->private_key, ssl->certificate); + stream_ssl_set_ca_cert_file(ssl->ca_cert, ssl->bootstrap_ca_cert); + } +#endif if (database_changed || datapath_destroyed) { if (cfg) { struct ovsdb_idl_txn *txn = ovsdb_idl_txn_create(idl); @@ -1397,18 +1418,6 @@ bridge_run(void) } } -#ifdef HAVE_OPENSSL - /* Re-configure SSL. We do this on every trip through the main loop, - * instead of just when the database changes, because the contents of the - * key and certificate files can change without the database changing. */ - if (cfg && cfg->ssl) { - const struct ovsrec_ssl *ssl = cfg->ssl; - - stream_ssl_set_key_and_cert(ssl->private_key, ssl->certificate); - stream_ssl_set_ca_cert_file(ssl->ca_cert, ssl->bootstrap_ca_cert); - } -#endif - /* Refresh system and interface stats if necessary. */ if (time_msec() >= stats_timer) { if (cfg) {