X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=vswitchd%2Fmgmt.c;h=45c3580243d39c721de193d02f2323677b3b7253;hb=c735214e852e1706a3e0ad346c114292fd3e7047;hp=a65934b6e40de6e61c5e0c9f41f7c16d75882890;hpb=23834de273c6bd42362f4e6c013703c5b6fa2fd5;p=openvswitch diff --git a/vswitchd/mgmt.c b/vswitchd/mgmt.c index a65934b6..45c35802 100644 --- a/vswitchd/mgmt.c +++ b/vswitchd/mgmt.c @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include "bridge.h" #include "cfg.h" @@ -101,6 +104,7 @@ mgmt_configure_ssl(void) static char *private_key_file; static char *certificate_file; static char *cacert_file; + struct stat s; /* XXX SSL should be configurable separate from the bridges. * XXX should be possible to de-configure SSL. */ @@ -112,7 +116,13 @@ mgmt_configure_ssl(void) vconn_ssl_set_certificate_file(certificate_file); } - if (config_string_change("ssl.ca-cert", &cacert_file)) { + /* We assume that even if the filename hasn't changed, if the CA cert + * file has been removed, that we want to move back into + * boot-strapping mode. This opens a small security hole, because + * the old certificate will still be trusted until vSwitch is + * restarted. We may want to address this in vconn's SSL library. */ + if (config_string_change("ssl.ca-cert", &cacert_file) + || (stat(cacert_file, &s) && errno == ENOENT)) { vconn_ssl_set_ca_cert_file(cacert_file, cfg_get_bool(0, "ssl.bootstrap-ca-cert")); } @@ -131,6 +141,7 @@ mgmt_reconfigure(void) int retval; if (!cfg_has_section("mgmt")) { + svec_clear(&mgmt_cfg); if (mgmt_rconn) { rconn_destroy(mgmt_rconn); mgmt_rconn = NULL;