From: Ben Pfaff Date: Mon, 14 Jul 2008 20:56:39 +0000 (-0700) Subject: vconn: New function vconn_ssl_is_configured(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d07d22508e7b2ed628e3dce125c09f71f0ad0efc;p=openvswitch vconn: New function vconn_ssl_is_configured(). The secure channel, in discovery mode, wants to enable TCP connections by default only if SSL has not been configured. This function allows it to do that. --- diff --git a/include/vconn-ssl.h b/include/vconn-ssl.h index 1d4a923d..fb80068e 100644 --- a/include/vconn-ssl.h +++ b/include/vconn-ssl.h @@ -33,7 +33,10 @@ #ifndef VCONN_SSL_H #define VCONN_SSL_H 1 +#include + #ifdef HAVE_OPENSSL +bool vconn_ssl_is_configured(void); void vconn_ssl_set_private_key_file(const char *file_name); void vconn_ssl_set_certificate_file(const char *file_name); void vconn_ssl_set_ca_cert_file(const char *file_name); @@ -56,6 +59,10 @@ void vconn_ssl_set_ca_cert_file(const char *file_name); vconn_ssl_set_ca_cert_file(optarg); \ break; #else /* !HAVE_OPENSSL */ +static inline bool vconn_ssl_is_configured(void) +{ + return false; +} #define VCONN_SSL_LONG_OPTIONS #define VCONN_SSL_OPTION_HANDLERS #endif /* !HAVE_OPENSSL */ diff --git a/lib/vconn-ssl.c b/lib/vconn-ssl.c index 607d9b9e..0da4c578 100644 --- a/lib/vconn-ssl.c +++ b/lib/vconn-ssl.c @@ -867,6 +867,13 @@ tmp_dh_callback(SSL *ssl, int is_export UNUSED, int keylength) return NULL; } +/* Returns true if SSL is at least partially configured. */ +bool +vconn_ssl_is_configured(void) +{ + return has_private_key || has_certificate || has_ca_cert; +} + void vconn_ssl_set_private_key_file(const char *file_name) {