From: Ben Pfaff Date: Wed, 30 Jun 2010 19:43:24 +0000 (-0700) Subject: ovsdb-client: Fix "selects" argument to "monitor" command. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=876ba6ded291e8f00753c35ed74ab1124c60439e;p=openvswitch 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. --- diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index 7177b261..0199b0e0 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; }