From 876ba6ded291e8f00753c35ed74ab1124c60439e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 30 Jun 2010 12:43:24 -0700 Subject: [PATCH] ovsdb-client: Fix "selects" argument to "monitor" command. This code assumed that the types of operations that were selected were default-off, so it only added JSON to the query to turn on the ones that were wanted, but in fact they are default-on, so this commit changes it to add JSON for each possible operation type. --- ovsdb/ovsdb-client.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 7177b2614..0199b0e03 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -936,14 +936,30 @@ do_monitor(int argc, char *argv[]) } if (argc >= 6 && *argv[5] != '\0') { + bool initial, insert, delete, modify; char *save_ptr = NULL; char *token; - select = json_object_create(); + initial = insert = delete = modify = false; + for (token = strtok_r(argv[5], ",", &save_ptr); token != NULL; token = strtok_r(NULL, ",", &save_ptr)) { - json_object_put(select, token, json_boolean_create(true)); + if (!strcmp(token, "initial")) { + initial = true; + } else if (!strcmp(token, "insert")) { + insert = true; + } else if (!strcmp(token, "delete")) { + delete = true; + } else if (!strcmp(token, "modify")) { + modify = true; + } } + + select = json_object_create(); + json_object_put(select, "initial", json_boolean_create(initial)); + json_object_put(select, "insert", json_boolean_create(insert)); + json_object_put(select, "delete", json_boolean_create(delete)); + json_object_put(select, "modify", json_boolean_create(modify)); } else { select = NULL; } -- 2.43.0