From 05ac209a5d3a5e85896f58d16b244e6b2a4cf2d0 Mon Sep 17 00:00:00 2001 From: Andy Zhou Date: Mon, 6 Feb 2017 14:00:22 -0800 Subject: ovsdb: Prevent OVSDB server from replicating itself. Replication OVSDB server from itself is usually caused by configuration errors. Such configuration errors can lead to OVSDB server data loss. See "reported-at" for more details. This patch adds logics that prevent OVSDB server from replicating itself. Reported-by: Guishuai Li Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/326963.html Suggested-by: Ben Pfaff Signed-off-by: Andy Zhou Acked-by: Ben Pfaff --- ovsdb/jsonrpc-server.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ovsdb/jsonrpc-server.c') diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index 5353ba743..1ba6bb390 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -944,6 +944,13 @@ ovsdb_jsonrpc_session_got_request(struct ovsdb_jsonrpc_session *s, } reply = jsonrpc_create_reply(json_array_create(dbs, n_dbs), request->id); + } else if (!strcmp(request->method, "get_server_id")) { + const struct uuid *uuid = &s->up.server->uuid; + struct json *result; + + result = json_string_create_nocopy(xasprintf(UUID_FMT, + UUID_ARGS(uuid))); + reply = jsonrpc_create_reply(result, request->id); } else if (!strcmp(request->method, "lock")) { reply = ovsdb_jsonrpc_session_lock(s, request, OVSDB_LOCK_WAIT); } else if (!strcmp(request->method, "steal")) { -- cgit v1.2.1