From 0190f2af0f1dca3928c1a84c9b60d1e14197ff38 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: Aug 03 2023 18:17:49 +0000 Subject: Import openvswitch3.1-3.1.0-46 from Fast DataPath --- diff --git a/SOURCES/openvswitch-3.1.0.patch b/SOURCES/openvswitch-3.1.0.patch index 646c736..ed752bb 100644 --- a/SOURCES/openvswitch-3.1.0.patch +++ b/SOURCES/openvswitch-3.1.0.patch @@ -3420,6 +3420,65 @@ index 4e15167ab..fa7973ac7 100644 void ofproto_set_forward_bpdu(struct ofproto *, bool forward_bpdu); void ofproto_set_mac_table_config(struct ofproto *, unsigned idle_time, size_t max_entries); +diff --git a/ovsdb/execution.c b/ovsdb/execution.c +index f9b8067d0..5587ef96f 100644 +--- a/ovsdb/execution.c ++++ b/ovsdb/execution.c +@@ -320,7 +320,7 @@ parse_row(const struct json *json, const struct ovsdb_table *table, + } + + row = ovsdb_row_create(table); +- error = ovsdb_row_from_json(row, json, symtab, columns); ++ error = ovsdb_row_from_json(row, json, symtab, columns, false); + if (error) { + ovsdb_row_destroy(row); + return error; +@@ -764,7 +764,7 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser, + + row = ovsdb_row_create(table); + error = ovsdb_row_from_json(row, rows->array.elems[i], x->symtab, +- NULL); ++ NULL, false); + if (error) { + ovsdb_row_destroy(row); + break; +diff --git a/ovsdb/file.c b/ovsdb/file.c +index fdc289ad1..a3273229b 100644 +--- a/ovsdb/file.c ++++ b/ovsdb/file.c +@@ -107,13 +107,18 @@ ovsdb_file_update_row_from_json(struct ovsdb_row *row, bool converting, + column_name, schema->name); + } + +- error = ovsdb_datum_from_json(&datum, &column->type, node->data, NULL); ++ if (row_contains_diff) { ++ /* Diff may violate the type size rules. */ ++ error = ovsdb_transient_datum_from_json(&datum, &column->type, ++ node->data); ++ } else { ++ error = ovsdb_datum_from_json(&datum, &column->type, ++ node->data, NULL); ++ } + if (error) { + return error; + } +- if (row_contains_diff +- && !ovsdb_datum_is_default(&row->fields[column->index], +- &column->type)) { ++ if (row_contains_diff) { + error = ovsdb_datum_apply_diff_in_place( + &row->fields[column->index], + &datum, &column->type); +@@ -154,8 +159,7 @@ ovsdb_file_txn_row_from_json(struct ovsdb_txn *txn, struct ovsdb_table *table, + + new = ovsdb_row_create(table); + *ovsdb_row_get_uuid_rw(new) = *row_uuid; +- error = ovsdb_file_update_row_from_json(new, converting, +- row_contains_diff, json); ++ error = ovsdb_file_update_row_from_json(new, converting, false, json); + if (error) { + ovsdb_row_destroy(new); + } else { diff --git a/ovsdb/log.c b/ovsdb/log.c index e42f00246..fff7c6ba1 100644 --- a/ovsdb/log.c @@ -3506,9 +3565,18 @@ index 191befcae..bf5d083cc 100644 dbmon->new_change_set = NULL; } diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c -index 33ca4910d..cb4671d51 100644 +index 33ca4910d..b7b4d1559 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c +@@ -233,7 +233,7 @@ main_loop(struct server_config *config, + + SHASH_FOR_EACH_SAFE (node, all_dbs) { + struct db *db = node->data; +- ovsdb_txn_history_run(db->db); ++ + ovsdb_storage_run(db->db->storage); + read_db(config, db); + /* Run triggers after storage_run and read_db to make sure new raft @@ -573,8 +573,9 @@ close_db(struct server_config *config, struct db *db, char *comment) } } @@ -3588,7 +3656,7 @@ index 33ca4910d..cb4671d51 100644 } if (txn_json) { -@@ -624,24 +646,25 @@ parse_txn(struct server_config *config, struct db *db, +@@ -624,24 +646,26 @@ parse_txn(struct server_config *config, struct db *db, return ovsdb_error(NULL, "%s: data without schema", db->filename); } @@ -3620,13 +3688,14 @@ index 33ca4910d..cb4671d51 100644 + if (!error && !uuid_is_zero(txnid)) { + db->db->prereq = *txnid; + } ++ ovsdb_txn_history_run(db->db); + } + return error; } static void diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c -index 60f353197..e26536532 100644 +index 60f353197..facd680ff 100644 --- a/ovsdb/ovsdb-tool.c +++ b/ovsdb/ovsdb-tool.c @@ -1006,7 +1006,8 @@ raft_header_to_standalone_log(const struct raft_header *h, @@ -3680,7 +3749,15 @@ index 60f353197..e26536532 100644 if (data_json->type != JSON_NULL) { check_ovsdb_error(ovsdb_log_write(db_log_data, data_json)); } -@@ -1636,7 +1670,8 @@ do_compare_versions(struct ovs_cmdl_context *ctx) +@@ -1060,6 +1094,7 @@ do_show_log_cluster(struct ovsdb_log *log) + free(s); + } + ++ json_destroy(json); + putchar('\n'); + } + +@@ -1636,7 +1671,8 @@ do_compare_versions(struct ovs_cmdl_context *ctx) } static void @@ -3690,7 +3767,7 @@ index 60f353197..e26536532 100644 { for (unsigned int i = 0; ; i++) { struct json *json; -@@ -1653,7 +1688,7 @@ do_convert_to_standalone(struct ovsdb_log *log, struct ovsdb_log *db_log_data) +@@ -1653,7 +1689,7 @@ do_convert_to_standalone(struct ovsdb_log *log, struct ovsdb_log *db_log_data) } else { struct raft_record r; check_ovsdb_error(raft_record_from_json(&r, json)); @@ -3699,7 +3776,7 @@ index 60f353197..e26536532 100644 raft_record_uninit(&r); } json_destroy(json); -@@ -1676,7 +1711,7 @@ do_cluster_standalone(struct ovs_cmdl_context *ctx) +@@ -1676,7 +1712,7 @@ do_cluster_standalone(struct ovs_cmdl_context *ctx) if (strcmp(ovsdb_log_get_magic(log), RAFT_MAGIC) != 0) { ovs_fatal(0, "Database is not clustered db.\n"); } @@ -3709,7 +3786,7 @@ index 60f353197..e26536532 100644 ovsdb_log_close(db_log_data); ovsdb_log_close(log); diff --git a/ovsdb/relay.c b/ovsdb/relay.c -index 9ff6ed8f3..94ffe01e5 100644 +index 9ff6ed8f3..5a2b4b3b6 100644 --- a/ovsdb/relay.c +++ b/ovsdb/relay.c @@ -301,6 +301,8 @@ static void @@ -3753,6 +3830,14 @@ index 9ff6ed8f3..94ffe01e5 100644 if (!error) { if (update->clear) { error = ovsdb_relay_clear(ctx->db); +@@ -386,6 +400,7 @@ ovsdb_relay_run(void) + } + ovsdb_cs_event_destroy(event); + } ++ ovsdb_txn_history_run(ctx->db); + } + } + diff --git a/ovsdb/relay.h b/ovsdb/relay.h index 390ea70c8..2d66b5e5f 100644 --- a/ovsdb/relay.h @@ -3771,6 +3856,56 @@ index 390ea70c8..2d66b5e5f 100644 void ovsdb_relay_add_db(struct ovsdb *, const char *remote, schema_change_callback schema_change_cb, +diff --git a/ovsdb/row.c b/ovsdb/row.c +index d7bfbdd36..2b52b6816 100644 +--- a/ovsdb/row.c ++++ b/ovsdb/row.c +@@ -302,12 +302,14 @@ ovsdb_row_columns_to_string(const struct ovsdb_row *row, + struct ovsdb_error * + ovsdb_row_from_json(struct ovsdb_row *row, const struct json *json, + struct ovsdb_symbol_table *symtab, +- struct ovsdb_column_set *included) ++ struct ovsdb_column_set *included, bool is_diff) + { + struct ovsdb_table_schema *schema = row->table->schema; + struct ovsdb_error *error; + struct shash_node *node; + ++ ovs_assert(!is_diff || !symtab); ++ + if (json->type != JSON_OBJECT) { + return ovsdb_syntax_error(json, NULL, "row must be JSON object"); + } +@@ -324,8 +326,13 @@ ovsdb_row_from_json(struct ovsdb_row *row, const struct json *json, + column_name, schema->name); + } + +- error = ovsdb_datum_from_json(&datum, &column->type, node->data, +- symtab); ++ if (is_diff) { ++ error = ovsdb_transient_datum_from_json(&datum, &column->type, ++ node->data); ++ } else { ++ error = ovsdb_datum_from_json(&datum, &column->type, node->data, ++ symtab); ++ } + if (error) { + return error; + } +diff --git a/ovsdb/row.h b/ovsdb/row.h +index ff91288fe..59f498a20 100644 +--- a/ovsdb/row.h ++++ b/ovsdb/row.h +@@ -114,7 +114,8 @@ void ovsdb_row_columns_to_string(const struct ovsdb_row *, + struct ovsdb_error *ovsdb_row_from_json(struct ovsdb_row *, + const struct json *, + struct ovsdb_symbol_table *, +- struct ovsdb_column_set *included) ++ struct ovsdb_column_set *included, ++ bool is_diff) + OVS_WARN_UNUSED_RESULT; + struct json *ovsdb_row_to_json(const struct ovsdb_row *, + const struct ovsdb_column_set *include); diff --git a/ovsdb/storage.c b/ovsdb/storage.c index e8f95ce64..6c395106c 100644 --- a/ovsdb/storage.c @@ -3827,6 +3962,29 @@ index a1fdaa564..05f40ce93 100644 const struct uuid *prereq, struct uuid *result) OVS_WARN_UNUSED_RESULT; +diff --git a/ovsdb/table.c b/ovsdb/table.c +index 66071ce2f..0792e1580 100644 +--- a/ovsdb/table.c ++++ b/ovsdb/table.c +@@ -368,7 +368,8 @@ ovsdb_table_execute_insert(struct ovsdb_txn *txn, const struct uuid *row_uuid, + + struct ovsdb_row *row = ovsdb_row_create(table); + +- struct ovsdb_error *error = ovsdb_row_from_json(row, json_row, NULL, NULL); ++ struct ovsdb_error *error = ovsdb_row_from_json(row, json_row, ++ NULL, NULL, false); + if (!error) { + *ovsdb_row_get_uuid_rw(row) = *row_uuid; + ovsdb_txn_row_insert(txn, row); +@@ -411,7 +412,7 @@ ovsdb_table_execute_update(struct ovsdb_txn *txn, const struct uuid *row_uuid, + struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER; + struct ovsdb_row *update = ovsdb_row_create(table); + struct ovsdb_error *error = ovsdb_row_from_json(update, json_row, +- NULL, &columns); ++ NULL, &columns, xor); + + if (!error && (xor || !ovsdb_row_equal_columns(row, update, &columns))) { + error = ovsdb_row_update_columns(ovsdb_txn_row_modify(txn, row), diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c index 03541af85..f01de2a34 100644 --- a/ovsdb/transaction.c @@ -4397,6 +4555,85 @@ index a92156f00..a368bff6e 100644 AT_CHECK([RUN_OVS_VSCTL([remove netflow `cat netflow-uuid` targets '"1.2.3.4:567"'])], [1], [], [ovs-vsctl: "remove" operation would put 0 values in column targets of table NetFlow but the minimum number is 1 ]) +diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at +index e72bf0606..fd1c7a239 100644 +--- a/tests/ovsdb-execution.at ++++ b/tests/ovsdb-execution.at +@@ -728,6 +728,53 @@ dnl collide (only) with their previous values (succeeds). + [{"count":2},{"uuid":["uuid","<6>"]},{"uuid":["uuid","<7>"]},{"rows":[{"name":"new one","number":1},{"name":"new two","number":2},{"name":"old one","number":10},{"name":"old two","number":20}]}] + ]]) + ++OVSDB_CHECK_EXECUTION([size constraints on sets], ++ [constraint_schema], ++ [ ++ [[["constraints", ++ {"op": "insert", ++ "table": "b", ++ "row": {"b": 1} ++ }]]], ++ [[["constraints", ++ {"op": "mutate", ++ "table": "b", ++ "where": [], ++ "mutations": [["x", "delete", 0]] ++ }]]], ++ [[["constraints", ++ {"op": "mutate", ++ "table": "b", ++ "where": [], ++ "mutations": [["x", "insert", 1]] ++ }]]], ++ [[["constraints", ++ {"op": "update", ++ "table": "b", ++ "where": [], ++ "row": {"x": ["set", [3, 4]]} ++ }]]], ++ [[["constraints", ++ {"op": "mutate", ++ "table": "b", ++ "where": [], ++ "mutations": [["x", "insert", 5]] ++ }]]], ++ [[["constraints", ++ {"op": "mutate", ++ "table": "b", ++ "where": [], ++ "mutations": [["x", "delete", 4], ["x", "insert", 5]] ++ }]]] ++ ], ++ [[[{"uuid":["uuid","<0>"]}] ++[{"details":"Attempted to store 0 elements in set of 1 to 2 integers.","error":"constraint violation"}] ++[{"count":1}] ++[{"count":1}] ++[{"details":"Attempted to store 3 elements in set of 1 to 2 integers.","error":"constraint violation"}] ++[{"count":1}] ++]]) ++ + OVSDB_CHECK_EXECUTION([referential integrity -- simple], + [constraint_schema], + [[[["constraints", +@@ -751,12 +798,6 @@ OVSDB_CHECK_EXECUTION([referential integrity -- simple], + {"op": "delete", + "table": "b", + "where": []}]]], +-dnl Check that "mutate" honors number-of-elements constraints on sets and maps. +- [[["constraints", +- {"op": "mutate", +- "table": "b", +- "where": [], +- "mutations": [["x", "delete", 0]]}]]], + [[["constraints", + {"op": "delete", + "table": "a", +@@ -783,7 +824,6 @@ dnl Check that "mutate" honors number-of-elements constraints on sets and maps. + "where": []}]]]], + [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}] + [{"count":1},{"details":"cannot delete b row <0> because of 3 remaining reference(s)","error":"referential integrity violation"}] +-[{"details":"Attempted to store 0 elements in set of 1 to 2 integers.","error":"constraint violation"}] + [{"count":1}] + [{"count":1},{"details":"cannot delete b row <0> because of 2 remaining reference(s)","error":"referential integrity violation"}] + [{"count":1}] diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 5a7e76eaa..9d28672ef 100644 --- a/tests/ovsdb-idl.at @@ -4493,6 +4730,44 @@ index 3b622b3ec..82b0e9362 100644 +<1>,initial,"""zero""" +]) +AT_CLEANUP +diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at +index bf539b6e5..b9c3bf203 100644 +--- a/tests/ovsdb-server.at ++++ b/tests/ovsdb-server.at +@@ -24,6 +24,9 @@ m4_define([OVSDB_SERVER_SHUTDOWN2], + # If a given UUID appears more than once it is always replaced by the + # same marker. + # ++# Additionally, checks that records written to a database file can be ++# read back producing the same in-memory database content. ++# + # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. + m4_define([OVSDB_CHECK_EXECUTION], + [AT_SETUP([$1]) +@@ -31,12 +34,22 @@ m4_define([OVSDB_CHECK_EXECUTION], + $2 > schema + AT_CHECK([ovsdb-tool create db schema], [0], [stdout], [ignore]) + on_exit 'kill `cat *.pid`' +- AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --remote=punix:socket db], [0], [ignore], [ignore]) ++ AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile \ ++ --remote=punix:socket db], [0], [ignore], [ignore]) + m4_foreach([txn], [$3], + [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], [stdout], [ignore]) + cat stdout >> output + ]) + AT_CHECK([uuidfilt output], [0], [$4], [ignore]) ++ ++ AT_CHECK([ovsdb-client dump unix:socket], [0], [stdout], [ignore]) ++ ++ OVSDB_SERVER_SHUTDOWN ++ ++ AT_CHECK([ovsdb-server --detach --no-chdir --log-file --pidfile \ ++ --remote=punix:socket db], [0], [ignore], [ignore]) ++ OVS_WAIT_UNTIL([ovsdb-client dump unix:socket > dump2; diff stdout dump2]) ++ + OVSDB_SERVER_SHUTDOWN + AT_CLEANUP]) + diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at index 12ad6fb3f..5496ccda7 100644 --- a/tests/ovsdb-tool.at @@ -5163,6 +5438,65 @@ index b34a84775..40210f7fa 100644 +[ + AT_SKIP_IF([:]) +]) +diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c +index 1bc5ac17a..c761822e6 100644 +--- a/tests/test-ovsdb.c ++++ b/tests/test-ovsdb.c +@@ -870,7 +870,8 @@ do_parse_rows(struct ovs_cmdl_context *ctx) + row = ovsdb_row_create(table); + + json = unbox_json(parse_json(ctx->argv[i])); +- check_ovsdb_error(ovsdb_row_from_json(row, json, NULL, &columns)); ++ check_ovsdb_error(ovsdb_row_from_json(row, json, NULL, ++ &columns, false)); + json_destroy(json); + + print_and_free_json(ovsdb_row_to_json(row, &all_columns)); +@@ -937,7 +938,7 @@ do_compare_rows(struct ovs_cmdl_context *ctx) + } + names[i] = xstrdup(json->array.elems[0]->string); + check_ovsdb_error(ovsdb_row_from_json(rows[i], json->array.elems[1], +- NULL, NULL)); ++ NULL, NULL, false)); + json_destroy(json); + } + for (i = 0; i < n_rows; i++) { +@@ -1050,7 +1051,7 @@ do_evaluate_condition__(struct ovs_cmdl_context *ctx, int mode) + for (i = 0; i < n_rows; i++) { + rows[i] = ovsdb_row_create(table); + check_ovsdb_error(ovsdb_row_from_json(rows[i], json->array.elems[i], +- NULL, NULL)); ++ NULL, NULL, false)); + } + json_destroy(json); + +@@ -1224,7 +1225,7 @@ do_execute_mutations(struct ovs_cmdl_context *ctx) + for (i = 0; i < n_rows; i++) { + rows[i] = ovsdb_row_create(table); + check_ovsdb_error(ovsdb_row_from_json(rows[i], json->array.elems[i], +- NULL, NULL)); ++ NULL, NULL, false)); + } + json_destroy(json); + +@@ -1338,7 +1339,7 @@ do_query(struct ovs_cmdl_context *ctx) + struct ovsdb_row *row = ovsdb_row_create(table); + uuid_generate(ovsdb_row_get_uuid_rw(row)); + check_ovsdb_error(ovsdb_row_from_json(row, json->array.elems[i], +- NULL, NULL)); ++ NULL, NULL, false)); + if (ovsdb_table_get_row(table, ovsdb_row_get_uuid(row))) { + ovs_fatal(0, "duplicate UUID "UUID_FMT" in table", + UUID_ARGS(ovsdb_row_get_uuid(row))); +@@ -1445,7 +1446,7 @@ do_query_distinct(struct ovs_cmdl_context *ctx) + row = ovsdb_row_create(table); + uuid_generate(ovsdb_row_get_uuid_rw(row)); + check_ovsdb_error(ovsdb_row_from_json(row, json->array.elems[i], +- NULL, NULL)); ++ NULL, NULL, false)); + + /* Initialize row and find equivalence class. */ + rows[i].uuid = *ovsdb_row_get_uuid(row); diff --git a/tests/testsuite.at b/tests/testsuite.at index cf4e3eadf..9d77a9f51 100644 --- a/tests/testsuite.at @@ -5206,10 +5540,21 @@ index eabec18a3..3ce4e82ec 100644 enum ofp_version version = vconn_get_version(vconn); struct ofpbuf *msg = ofp_ct_match_encode(&match, pzone, version); diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in -index a49ec9f94..420c11eb8 100755 +index a49ec9f94..4cbd9a5d3 100755 --- a/utilities/ovs-tcpdump.in +++ b/utilities/ovs-tcpdump.in -@@ -538,6 +538,17 @@ def main(): +@@ -96,6 +96,10 @@ def _install_dst_if_linux(tap_name, mtu_value=None): + *(['ip', 'link', 'set', 'dev', str(tap_name), 'up'])) + pipe.wait() + ++ pipe = _doexec( ++ *(['ip', '-6', 'addr', 'flush', 'dev', str(tap_name)])) ++ pipe.wait() ++ + + def _remove_dst_if_linux(tap_name): + _doexec( +@@ -538,6 +542,17 @@ def main(): print(data.decode('utf-8')) raise KeyboardInterrupt except KeyboardInterrupt: diff --git a/SPECS/openvswitch3.1.spec b/SPECS/openvswitch3.1.spec index 865a1ef..f1c9f9a 100644 --- a/SPECS/openvswitch3.1.spec +++ b/SPECS/openvswitch3.1.spec @@ -63,7 +63,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 3.1.0 -Release: 45%{?dist} +Release: 46%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -757,6 +757,18 @@ exit 0 %endif %changelog +* Thu Aug 03 2023 Open vSwitch CI - 3.1.0-46 +- Merging upstream branch-3.1 [RH git: ab94f613c7] + Commit list: + 8b1795c69f ovsdb-tool: Fix json leak while showing clustered log. + d4d068fef6 ovsdb-server: Fix excessive memory usage on DB open. (#2228464) + 369daff0d4 tests: Add ovsdb execution cases for set size constraints. + eb33626b59 ovsdb: relay: Fix handling of XOR updates with size constraints. + 8d2c8c33e7 ovsdb: file: Fix diff application to a default column value. + 3797558158 ovsdb: file: Fix inability to read diffs that violate type size. + 96d02ee7a8 ovs-tcpdump: Clear auto-assigned ipv6 address of mirror port. + + * Tue Aug 01 2023 Open vSwitch CI - 3.1.0-45 - Merging upstream branch-3.1 [RH git: 4224df5b41] Commit list: