With --config-file, ovsdb-server only reads the file while loading or
reloading configuration.  Configuration-changing unixctl commands are
rejected.  save_config() writes only the internal temporary file used
when --config-file is absent.

Open the user-provided file read-only so immutable configurations can
be used directly.

Fixes: 55140090e63a ("ovsdb-server: Allow user-provided config files.")
Signed-off-by: Ihar Hrachyshka <[email protected]>
---
 ovsdb/ovsdb-server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index af217476f..a7f89e148 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -642,7 +642,7 @@ reconfigure_ovsdb_server(struct server_config 
*server_config)
     FILE *file = NULL;
 
     if (config_file_path) {
-        file = fopen(config_file_path, "r+b");
+        file = fopen(config_file_path, "rb");
         if (!file) {
             VLOG_ERR("failed to open configuration file '%s': %s",
                      config_file_path, ovs_strerror(errno));
-- 
2.54.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to