diff --git a/SOURCES/openvswitch-2.16.0.patch b/SOURCES/openvswitch-2.16.0.patch index 7e073c5..dc7a56d 100644 --- a/SOURCES/openvswitch-2.16.0.patch +++ b/SOURCES/openvswitch-2.16.0.patch @@ -1053,6 +1053,19 @@ index 77cc76a9f6..7074561588 100644 ovsdb_datum_destroy(&add, type); } if (old.n > type->n_max) { +diff --git a/lib/dns-resolve.c b/lib/dns-resolve.c +index d344514343..8bcecb90ce 100644 +--- a/lib/dns-resolve.c ++++ b/lib/dns-resolve.c +@@ -265,7 +265,7 @@ resolve_callback__(void *req_, int err, struct ub_result *result) + if (err != 0 || (result->qtype == ns_t_aaaa && !result->havedata)) { + ub_resolve_free(result); + req->state = RESOLVE_ERROR; +- VLOG_ERR_RL(&rl, "%s: failed to resolve", req->name); ++ VLOG_WARN_RL(&rl, "%s: failed to resolve", req->name); + return; + } + diff --git a/lib/dp-packet.c b/lib/dp-packet.c index 72f6d09ac7..35c72542a2 100644 --- a/lib/dp-packet.c @@ -3181,6 +3194,132 @@ index a929ddfd2d..89a0bcaf95 100644 if (deadline != LLONG_MAX) { long long int remaining = deadline - now; return MAX(0, MIN(INT_MAX, remaining)); +diff --git a/lib/socket-util.c b/lib/socket-util.c +index 4f1ffecf5d..38705cc51e 100644 +--- a/lib/socket-util.c ++++ b/lib/socket-util.c +@@ -62,7 +62,8 @@ static bool parse_sockaddr_components(struct sockaddr_storage *ss, + const char *port_s, + uint16_t default_port, + const char *s, +- bool resolve_host); ++ bool resolve_host, ++ bool *dns_failure); + + /* Sets 'fd' to non-blocking mode. Returns 0 if successful, otherwise a + * positive errno value. */ +@@ -438,7 +439,7 @@ parse_sockaddr_components_dns(struct sockaddr_storage *ss OVS_UNUSED, + dns_resolve(host_s, &tmp_host_s); + if (tmp_host_s != NULL) { + parse_sockaddr_components(ss, tmp_host_s, port_s, +- default_port, s, false); ++ default_port, s, false, NULL); + free(tmp_host_s); + return true; + } +@@ -450,11 +451,15 @@ parse_sockaddr_components(struct sockaddr_storage *ss, + char *host_s, + const char *port_s, uint16_t default_port, + const char *s, +- bool resolve_host) ++ bool resolve_host, bool *dns_failure) + { + struct sockaddr_in *sin = sin_cast(sa_cast(ss)); + int port; + ++ if (dns_failure) { ++ *dns_failure = false; ++ } ++ + if (port_s && port_s[0]) { + if (!str_to_int(port_s, 10, &port) || port < 0 || port > 65535) { + VLOG_ERR("%s: bad port number \"%s\"", s, port_s); +@@ -501,10 +506,15 @@ parse_sockaddr_components(struct sockaddr_storage *ss, + return true; + + resolve: +- if (resolve_host && parse_sockaddr_components_dns(ss, host_s, port_s, +- default_port, s)) { +- return true; +- } else if (!resolve_host) { ++ if (resolve_host) { ++ if (parse_sockaddr_components_dns(ss, host_s, port_s, ++ default_port, s)) { ++ return true; ++ } ++ if (dns_failure) { ++ *dns_failure = true; ++ } ++ } else { + VLOG_ERR("%s: bad IP address \"%s\"", s, host_s); + } + exit: +@@ -521,10 +531,12 @@ exit: + * It resolves the host if 'resolve_host' is true. + * + * On success, returns true and stores the parsed remote address into '*ss'. +- * On failure, logs an error, stores zeros into '*ss', and returns false. */ ++ * On failure, logs an error, stores zeros into '*ss', and returns false, ++ * '*dns_failure' indicates if the host resolution failed. */ + bool + inet_parse_active(const char *target_, int default_port, +- struct sockaddr_storage *ss, bool resolve_host) ++ struct sockaddr_storage *ss, ++ bool resolve_host, bool *dns_failure) + { + char *target = xstrdup(target_); + char *port, *host; +@@ -539,7 +551,7 @@ inet_parse_active(const char *target_, int default_port, + ok = false; + } else { + ok = parse_sockaddr_components(ss, host, port, default_port, +- target_, resolve_host); ++ target_, resolve_host, dns_failure); + } + if (!ok) { + memset(ss, 0, sizeof *ss); +@@ -576,7 +588,7 @@ inet_open_active(int style, const char *target, int default_port, + int error; + + /* Parse. */ +- if (!inet_parse_active(target, default_port, &ss, true)) { ++ if (!inet_parse_active(target, default_port, &ss, true, NULL)) { + error = EAFNOSUPPORT; + goto exit; + } +@@ -660,7 +672,7 @@ inet_parse_passive(const char *target_, int default_port, + ok = false; + } else { + ok = parse_sockaddr_components(ss, host, port, default_port, +- target_, true); ++ target_, true, NULL); + } + if (!ok) { + memset(ss, 0, sizeof *ss); +@@ -783,7 +795,8 @@ inet_parse_address(const char *target_, struct sockaddr_storage *ss) + { + char *target = xstrdup(target_); + char *host = unbracket(target); +- bool ok = parse_sockaddr_components(ss, host, NULL, 0, target_, false); ++ bool ok = parse_sockaddr_components(ss, host, NULL, 0, ++ target_, false, NULL); + if (!ok) { + memset(ss, 0, sizeof *ss); + } +diff --git a/lib/socket-util.h b/lib/socket-util.h +index 9ccb7d4cc4..bf66393df9 100644 +--- a/lib/socket-util.h ++++ b/lib/socket-util.h +@@ -49,7 +49,8 @@ ovs_be32 guess_netmask(ovs_be32 ip); + void inet_parse_host_port_tokens(char *s, char **hostp, char **portp); + void inet_parse_port_host_tokens(char *s, char **portp, char **hostp); + bool inet_parse_active(const char *target, int default_port, +- struct sockaddr_storage *ssp, bool resolve_host); ++ struct sockaddr_storage *ssp, ++ bool resolve_host, bool *dns_failure); + int inet_open_active(int style, const char *target, int default_port, + struct sockaddr_storage *ssp, int *fdp, uint8_t dscp); + diff --git a/lib/stopwatch.c b/lib/stopwatch.c index f5602163bc..1c71df1a12 100644 --- a/lib/stopwatch.c @@ -3256,6 +3395,19 @@ index 809b405a52..a869b5f390 100644 p->error_count++; goto out; } +diff --git a/lib/stream.c b/lib/stream.c +index fcaddf10ad..71039e24f1 100644 +--- a/lib/stream.c ++++ b/lib/stream.c +@@ -788,7 +788,7 @@ stream_parse_target_with_default_port(const char *target, int default_port, + struct sockaddr_storage *ss) + { + return ((!strncmp(target, "tcp:", 4) || !strncmp(target, "ssl:", 4)) +- && inet_parse_active(target + 4, default_port, ss, true)); ++ && inet_parse_active(target + 4, default_port, ss, true, NULL)); + } + + /* Attempts to guess the content type of a stream whose first few bytes were diff --git a/lib/tc.c b/lib/tc.c index 38a1dfc0eb..df73a43d4c 100644 --- a/lib/tc.c @@ -3960,6 +4112,20 @@ index e4b42b0594..877bca3127 100644 int tnl_neigh_lookup(const char dev_name[IFNAMSIZ], const struct in6_addr *dst, struct eth_addr *mac); void tnl_neigh_cache_init(void); +diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c +index 864c136b5d..0f4a61ac6b 100644 +--- a/ofproto/ofproto-dpif-sflow.c ++++ b/ofproto/ofproto-dpif-sflow.c +@@ -468,7 +468,8 @@ sflow_choose_agent_address(const char *agent_device, + const char *target; + SSET_FOR_EACH (target, targets) { + struct sockaddr_storage ss; +- if (inet_parse_active(target, SFL_DEFAULT_COLLECTOR_PORT, &ss, true)) { ++ if (inet_parse_active(target, SFL_DEFAULT_COLLECTOR_PORT, ++ &ss, true, NULL)) { + /* sFlow only supports target in default routing table with + * packet mark zero. + */ diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 1c9c720f04..57f94df544 100644 --- a/ofproto/ofproto-dpif-upcall.c @@ -5181,10 +5347,34 @@ index 61cded16d3..a2ee10af1b 100755 if type.value: valueType = type.value.toAtomicType() diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c -index 0b3d2bb714..b34d97e291 100644 +index 0b3d2bb714..5772955c92 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c -@@ -904,8 +904,8 @@ query_db_string(const struct shash *all_dbs, const char *name, +@@ -26,6 +26,7 @@ + #include "command-line.h" + #include "daemon.h" + #include "dirs.h" ++#include "dns-resolve.h" + #include "openvswitch/dynamic-string.h" + #include "fatal-signal.h" + #include "file.h" +@@ -329,6 +330,7 @@ main(int argc, char *argv[]) + service_start(&argc, &argv); + fatal_ignore_sigpipe(); + process_init(); ++ dns_resolve_init(true); + + bool active = false; + parse_options(argc, argv, &db_filenames, &remotes, &unixctl_path, +@@ -511,6 +513,7 @@ main(int argc, char *argv[]) + run_command, process_status_msg(status)); + } + } ++ dns_resolve_destroy(); + perf_counters_destroy(); + service_stop(); + return 0; +@@ -904,8 +907,8 @@ query_db_string(const struct shash *all_dbs, const char *name, datum = &row->fields[column->index]; for (i = 0; i < datum->n; i++) { @@ -5195,7 +5385,7 @@ index 0b3d2bb714..b34d97e291 100644 } } } -@@ -1018,7 +1018,7 @@ query_db_remotes(const char *name, const struct shash *all_dbs, +@@ -1018,7 +1021,7 @@ query_db_remotes(const char *name, const struct shash *all_dbs, datum = &row->fields[column->index]; for (i = 0; i < datum->n; i++) { @@ -5344,7 +5534,7 @@ index 4a7bd0f0ec..ec2d235ec2 100644 bool is_relay; /* True, if database is in relay mode. */ /* List that holds transactions waiting to be forwarded to the server. */ diff --git a/ovsdb/raft-private.c b/ovsdb/raft-private.c -index 26d39a087f..30760233ee 100644 +index 26d39a087f..4145c8729f 100644 --- a/ovsdb/raft-private.c +++ b/ovsdb/raft-private.c @@ -18,11 +18,14 @@ @@ -5362,7 +5552,19 @@ index 26d39a087f..30760233ee 100644 /* Addresses of Raft servers. */ -@@ -281,7 +284,8 @@ void +@@ -33,7 +36,10 @@ raft_address_validate(const char *address) + return NULL; + } else if (!strncmp(address, "ssl:", 4) || !strncmp(address, "tcp:", 4)) { + struct sockaddr_storage ss; +- if (!inet_parse_active(address + 4, -1, &ss, true)) { ++ bool dns_failure = false; ++ ++ if (!inet_parse_active(address + 4, -1, &ss, true, &dns_failure) ++ && !dns_failure) { + return ovsdb_error(NULL, "%s: syntax error in address", address); + } + return NULL; +@@ -281,7 +287,8 @@ void raft_entry_clone(struct raft_entry *dst, const struct raft_entry *src) { dst->term = src->term; @@ -5372,7 +5574,7 @@ index 26d39a087f..30760233ee 100644 dst->eid = src->eid; dst->servers = json_nullable_clone(src->servers); dst->election_timer = src->election_timer; -@@ -291,7 +295,8 @@ void +@@ -291,7 +298,8 @@ void raft_entry_uninit(struct raft_entry *e) { if (e) { @@ -5382,7 +5584,7 @@ index 26d39a087f..30760233ee 100644 json_destroy(e->servers); } } -@@ -301,8 +306,9 @@ raft_entry_to_json(const struct raft_entry *e) +@@ -301,8 +309,9 @@ raft_entry_to_json(const struct raft_entry *e) { struct json *json = json_object_create(); raft_put_uint64(json, "term", e->term); @@ -5394,7 +5596,7 @@ index 26d39a087f..30760233ee 100644 json_object_put_format(json, "eid", UUID_FMT, UUID_ARGS(&e->eid)); } if (e->servers) { -@@ -323,9 +329,10 @@ raft_entry_from_json(struct json *json, struct raft_entry *e) +@@ -323,9 +332,10 @@ raft_entry_from_json(struct json *json, struct raft_entry *e) struct ovsdb_parser p; ovsdb_parser_init(&p, json, "raft log entry"); e->term = raft_parse_required_uint64(&p, "term"); @@ -5407,7 +5609,7 @@ index 26d39a087f..30760233ee 100644 e->servers = json_nullable_clone( ovsdb_parser_member(&p, "servers", OP_OBJECT | OP_OPTIONAL)); if (e->servers) { -@@ -344,9 +351,72 @@ bool +@@ -344,9 +354,72 @@ bool raft_entry_equals(const struct raft_entry *a, const struct raft_entry *b) { return (a->term == b->term @@ -5482,7 +5684,7 @@ index 26d39a087f..30760233ee 100644 } void -@@ -402,8 +472,8 @@ raft_header_from_json__(struct raft_header *h, struct ovsdb_parser *p) +@@ -402,8 +475,8 @@ raft_header_from_json__(struct raft_header *h, struct ovsdb_parser *p) * present, all of them must be. */ h->snap_index = raft_parse_optional_uint64(p, "prev_index"); if (h->snap_index) { @@ -5493,7 +5695,7 @@ index 26d39a087f..30760233ee 100644 h->snap.eid = raft_parse_required_uuid(p, "prev_eid"); h->snap.term = raft_parse_required_uint64(p, "prev_term"); h->snap.election_timer = raft_parse_optional_uint64( -@@ -455,8 +525,9 @@ raft_header_to_json(const struct raft_header *h) +@@ -455,8 +528,9 @@ raft_header_to_json(const struct raft_header *h) if (h->snap_index) { raft_put_uint64(json, "prev_index", h->snap_index); raft_put_uint64(json, "prev_term", h->snap.term); diff --git a/SPECS/openvswitch2.16.spec b/SPECS/openvswitch2.16.spec index 0e9c491..efba37d 100644 --- a/SPECS/openvswitch2.16.spec +++ b/SPECS/openvswitch2.16.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.16.0 -Release: 63%{?dist} +Release: 64%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -699,6 +699,12 @@ exit 0 %endif %changelog +* Wed Mar 30 2022 Open vSwitch CI - 2.16.0-64 +- Merging upstream branch-2.16 [RH git: 32008eb008] + Commit list: + 1570924c3f ovsdb: raft: Fix inability to read the database with DNS host names. (#2055097) + + * Mon Mar 28 2022 Open vSwitch CI - 2.16.0-63 - Merging upstream branch-2.16 [RH git: a3c48a5aeb] Commit list: