Open vSwitch CI 940672
diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
Open vSwitch CI 940672
index 2a191b57fb..5f8a1db6af 100755
Open vSwitch CI 940672
--- a/.ci/linux-prepare.sh
Open vSwitch CI 940672
+++ b/.ci/linux-prepare.sh
Open vSwitch CI 940672
@@ -23,7 +23,7 @@ cd ..
Open vSwitch CI 940672
 #     https://github.com/pypa/pip/issues/10655
Open vSwitch CI 940672
 pip3 install --disable-pip-version-check --user wheel
Open vSwitch CI 940672
 pip3 install --disable-pip-version-check --user \
Open vSwitch CI 940672
-    flake8 netaddr pyparsing sarif-tools sphinx setuptools
Open vSwitch CI 940672
+    flake8 netaddr pyparsing sarif-tools==2.0.0 sphinx setuptools
Open vSwitch CI 940672
 
Open vSwitch CI 940672
 # Install python test dependencies
Open vSwitch CI 940672
 pip3 install -r python/test_requirements.txt
Open vSwitch CI 88b1a2
diff --git a/Documentation/ref/ovs-appctl.8.rst b/Documentation/ref/ovs-appctl.8.rst
Open vSwitch CI 88b1a2
index 7054cf559e..e7c8b96d49 100644
Open vSwitch CI 88b1a2
--- a/Documentation/ref/ovs-appctl.8.rst
Open vSwitch CI 88b1a2
+++ b/Documentation/ref/ovs-appctl.8.rst
Open vSwitch CI 88b1a2
@@ -6,11 +6,11 @@ Synopsis
Open vSwitch CI 88b1a2
 ========
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
 ``ovs-appctl``
Open vSwitch CI 88b1a2
-[``--target=``<target> | ``-t`` <target>]
Open vSwitch CI 88b1a2
-[``--timeout=``<secs> | ``-T`` <secs>]
Open vSwitch CI 88b1a2
-[``--format=``<format> | ``-f`` <format>]
Open vSwitch CI 88b1a2
+[``--target=``\ *target* | ``-t`` *target*]
Open vSwitch CI 88b1a2
+[``--timeout=``\ *secs* | ``-T`` *secs*]
Open vSwitch CI 88b1a2
+[``--format=``\ *format* | ``-f`` *format*]
Open vSwitch CI 88b1a2
 [``--pretty``]
Open vSwitch CI 88b1a2
-<command> [<arg>...]
Open vSwitch CI 88b1a2
+*command* [*arg* ``...``]
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
 ``ovs-appctl --help``
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
@@ -33,11 +33,11 @@ command and prints the daemon's response on standard output.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
 In normal use only a single option is accepted:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``-t`` <target> or ``--target`` <target>
Open vSwitch CI 88b1a2
+* ``-t`` *target* or ``--target=``\ *target*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Tells ``ovs-appctl`` which daemon to contact.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  If <target> begins with ``/`` it must name a Unix domain socket on
Open vSwitch CI 88b1a2
+  If *target* begins with ``/`` it must name a Unix domain socket on
Open vSwitch CI 88b1a2
   which an Open vSwitch daemon is listening for control channel
Open vSwitch CI 88b1a2
   connections.  By default, each daemon listens on a Unix domain socket
Open vSwitch CI 88b1a2
   in the rundir (e.g. ``/run``) named ``<program>.<pid>.ctl``, where
Open vSwitch CI 88b1a2
@@ -47,33 +47,33 @@ In normal use only a single option is accepted:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Otherwise, ``ovs-appctl`` looks in the rundir for a pidfile, that is,
Open vSwitch CI 88b1a2
   a file whose contents are the process ID of a running process as a
Open vSwitch CI 88b1a2
-  decimal number, named ``<target>.pid``.  (The ``--pidfile`` option
Open vSwitch CI 88b1a2
+  decimal number, named *target*\ ``.pid``.  (The ``--pidfile`` option
Open vSwitch CI 88b1a2
   makes an Open vSwitch daemon create a pidfile.)  ``ovs-appctl`` reads
Open vSwitch CI 88b1a2
   the pidfile, then looks in the rundir for a Unix socket named
Open vSwitch CI 88b1a2
-  ``<target>.<pid>.ctl``, where <pid> is replaced by the process ID read
Open vSwitch CI 88b1a2
+  *target*\ ``.<pid>.ctl``, where <pid> is replaced by the process ID read
Open vSwitch CI 88b1a2
   from the pidfile, and uses that file as if it had been specified
Open vSwitch CI 88b1a2
   directly as the target.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  On Windows, <target> can be an absolute path to a file that contains a
Open vSwitch CI 88b1a2
+  On Windows, *target* can be an absolute path to a file that contains a
Open vSwitch CI 88b1a2
   localhost TCP port on which an Open vSwitch daemon is listening for
Open vSwitch CI 88b1a2
   control channel connections. By default, each daemon writes the TCP
Open vSwitch CI 88b1a2
   port on which it is listening for control connection into the file
Open vSwitch CI 88b1a2
-  ``<program>.ctl`` located inside the rundir. If <target> is not an
Open vSwitch CI 88b1a2
+  ``<program>.ctl`` located inside the rundir. If *target* is not an
Open vSwitch CI 88b1a2
   absolute path, ``ovs-appctl`` looks in the rundir for a file named
Open vSwitch CI 88b1a2
-  ``<target>.ctl``.  The default target is ``ovs-vswitchd``.
Open vSwitch CI 88b1a2
+  *target*\ ``.ctl``.  The default *target* is ``ovs-vswitchd``.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``-T <secs>`` or ``--timeout=<secs>``
Open vSwitch CI 88b1a2
+* ``-T`` *secs* or ``--timeout=``\ *secs*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  By default, or with a <secs> of ``0``, ``ovs-appctl`` waits forever to
Open vSwitch CI 88b1a2
+  By default, or with a *secs* of ``0``, ``ovs-appctl`` waits forever to
Open vSwitch CI 88b1a2
   connect to the daemon and receive a response.  This option limits
Open vSwitch CI 88b1a2
-  runtime to approximately <secs> seconds.  If the timeout expires,
Open vSwitch CI 88b1a2
+  runtime to approximately *secs* seconds.  If the timeout expires,
Open vSwitch CI 88b1a2
   ``ovs-appctl`` exits with a ``SIGALRM`` signal.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``-f <format>`` or ``--format=<format>``
Open vSwitch CI 88b1a2
+* ``-f`` *format* or ``--format=``\ *format*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Tells ``ovs-appctl`` which output format to use.  By default, or with a
Open vSwitch CI 88b1a2
-  <format> of ``text``, ``ovs-appctl`` will print plain-text for humans.
Open vSwitch CI 88b1a2
-  When <format> is ``json``, ``ovs-appctl`` will return a JSON document.
Open vSwitch CI 88b1a2
+  *format* of ``text``, ``ovs-appctl`` will print plain-text for humans.
Open vSwitch CI 88b1a2
+  When *format* is ``json``, ``ovs-appctl`` will return a JSON document.
Open vSwitch CI 88b1a2
   When ``json`` is requested, but a command has not implemented JSON
Open vSwitch CI 88b1a2
   output, the plain-text output will be wrapped in a provisional JSON
Open vSwitch CI 88b1a2
   document with the following structure::
Open vSwitch CI 88b1a2
@@ -158,10 +158,10 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Lists logging pattern used for each destination.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``vlog/set`` [<spec>]
Open vSwitch CI 88b1a2
+* ``vlog/set`` [*spec*]
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  Sets logging levels.  Without any <spec>, sets the log level for
Open vSwitch CI 88b1a2
-  every module and destination to ``dbg``.  Otherwise, <spec> is a
Open vSwitch CI 88b1a2
+  Sets logging levels.  Without any *spec*, sets the log level for
Open vSwitch CI 88b1a2
+  every module and destination to ``dbg``.  Otherwise, *spec* is a
Open vSwitch CI 88b1a2
   list of words separated by spaces or commas or colons, up to one from
Open vSwitch CI 88b1a2
   each category below:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
@@ -173,7 +173,7 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
     change to only to the system log, to the console, or to a file,
Open vSwitch CI 88b1a2
     respectively.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-    On Windows platform, ``syslog`` is only useful if <target> was
Open vSwitch CI 88b1a2
+    On Windows platform, ``syslog`` is only useful if *target* was
Open vSwitch CI 88b1a2
     started with the ``--syslog-target`` option (it has no effect
Open vSwitch CI 88b1a2
     otherwise).
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
@@ -182,20 +182,20 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
     will be logged, and messages of lower severity will be filtered out.
Open vSwitch CI 88b1a2
     ``off`` filters out all messages.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  Case is not significant within <spec>.
Open vSwitch CI 88b1a2
+  Case is not significant within *spec*.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Regardless of the log levels set for ``file``, logging to a file
Open vSwitch CI 88b1a2
   will not take place unless the target application was invoked with the
Open vSwitch CI 88b1a2
   ``--log-file`` option.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   For compatibility with older versions of OVS, ``any`` is accepted
Open vSwitch CI 88b1a2
-  within <spec> but it has no effect.
Open vSwitch CI 88b1a2
+  within *spec* but it has no effect.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``vlog/set PATTERN:<destination>:<pattern>``
Open vSwitch CI 88b1a2
+* ``vlog/set PATTERN:``\ *destination*:*pattern*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  Sets the log pattern for <destination> to <pattern>.  Each time a
Open vSwitch CI 88b1a2
-  message is logged to <destination>, <pattern> determines the
Open vSwitch CI 88b1a2
-  message's formatting.  Most characters in <pattern> are copied
Open vSwitch CI 88b1a2
+  Sets the log pattern for *destination* to *pattern*.  Each time a
Open vSwitch CI 88b1a2
+  message is logged to *destination*, *pattern* determines the
Open vSwitch CI 88b1a2
+  message's formatting.  Most characters in *pattern* are copied
Open vSwitch CI 88b1a2
   literally to the log, but special escapes beginning with ``%`` are
Open vSwitch CI 88b1a2
   expanded as follows:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
@@ -214,13 +214,13 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   * ``%d``
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-    The current date and time in ISO 8601 format (YYYY-MM-DD HH:MM:SS).
Open vSwitch CI 88b1a2
+    The current date and time in ISO 8601 format (``YYYY-MM-DD HH:MM:SS``).
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  * ``%d{<format>}``
Open vSwitch CI 88b1a2
+  * ``%d{``\ *format*\ ``}``
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-    The current date and time in the specified <format>, which takes
Open vSwitch CI 88b1a2
-    the same format as the <template> argument to ``strftime(3)``.  As
Open vSwitch CI 88b1a2
-    an extension, any ``#`` characters in <format> will be replaced by
Open vSwitch CI 88b1a2
+    The current date and time in the specified *format*, which takes
Open vSwitch CI 88b1a2
+    the same format as the ``template`` argument to ``strftime(3)``.  As
Open vSwitch CI 88b1a2
+    an extension, any ``#`` characters in *format* will be replaced by
Open vSwitch CI 88b1a2
     fractional seconds, e.g. use ``%H:%M:%S.###`` for the time to the
Open vSwitch CI 88b1a2
     nearest millisecond.  Sub-second times are only approximate and
Open vSwitch CI 88b1a2
     currently decimal places after the third will always be reported
Open vSwitch CI 88b1a2
@@ -228,14 +228,14 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   * ``%D``
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-    The current UTC date and time in ISO 8601 format (YYYY-MM-DD
Open vSwitch CI 88b1a2
-    HH:MM:SS).
Open vSwitch CI 88b1a2
+    The current UTC date and time in ISO 8601 format
Open vSwitch CI 88b1a2
+    (``YYYY-MM-DD HH:MM:SS``).
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  * ``%D{<format>}``
Open vSwitch CI 88b1a2
+  * ``%D{``\ *format*\ ``}``
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-    The current UTC date and time in the specified <format>, which
Open vSwitch CI 88b1a2
-    takes the same format as the <template> argument to
Open vSwitch CI 88b1a2
-    ``strftime``(3).  Supports the same extension for sub-second
Open vSwitch CI 88b1a2
+    The current UTC date and time in the specified *format*, which
Open vSwitch CI 88b1a2
+    takes the same format as the ``template`` argument to
Open vSwitch CI 88b1a2
+    ``strftime(3)``.  Supports the same extension for sub-second
Open vSwitch CI 88b1a2
     resolution as ``%d{...}``.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   * ``%E``
Open vSwitch CI 88b1a2
@@ -299,22 +299,23 @@ and adjusting log levels:
Open vSwitch CI 88b1a2
     Pad the field to the field width with ``0`` characters.  Padding
Open vSwitch CI 88b1a2
     with spaces is the default.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  * <width>
Open vSwitch CI 88b1a2
+  * *width*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
     A number specifies the minimum field width.  If the escape expands
Open vSwitch CI 88b1a2
-    to fewer characters than <width> then it is padded to fill the
Open vSwitch CI 88b1a2
-    field width.  (A field wider than <width> is not truncated to
Open vSwitch CI 88b1a2
+    to fewer characters than *width* then it is padded to fill the
Open vSwitch CI 88b1a2
+    field width.  (A field wider than *width* is not truncated to
Open vSwitch CI 88b1a2
     fit.)
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  The default pattern for console and file output is ``%D{%Y-%m-%dT
Open vSwitch CI 88b1a2
-  %H:%M:%SZ}|%05N|%c|%p|%m``; for syslog output, ``%05N|%c|%p|%m``.
Open vSwitch CI 88b1a2
+  The default pattern for console and file output is
Open vSwitch CI 88b1a2
+  ``%D{%Y-%m-%dT %H:%M:%SZ}|%05N|%c|%p|%m``; for syslog output,
Open vSwitch CI 88b1a2
+  ``%05N|%c|%p|%m``.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
   Daemons written in Python (e.g. ``ovs-monitor-ipsec``) do not allow
Open vSwitch CI 88b1a2
   control over the log pattern.
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-* ``vlog/set FACILITY:<facility>``
Open vSwitch CI 88b1a2
+* ``vlog/set FACILITY:``\ *facility*
Open vSwitch CI 88b1a2
 
Open vSwitch CI 88b1a2
-  Sets the RFC5424 facility of the log message. <facility> can be one
Open vSwitch CI 88b1a2
+  Sets the RFC5424 facility of the log message. *facility* can be one
Open vSwitch CI 88b1a2
   of ``kern``, ``user``, ``mail``, ``daemon``, ``auth``, ``syslog``,
Open vSwitch CI 88b1a2
   ``lpr``, ``news``, ``uucp``, ``clock``, ``ftp``, ``ntp``, ``audit``,
Open vSwitch CI 88b1a2
   ``alert``, ``clock2``, ``local0``, ``local1``, ``local2``,
Open vSwitch CI 940672
diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c
Open vSwitch CI 940672
index dc5164b41c..bf25e6f20a 100644
Open vSwitch CI 940672
--- a/lib/mcast-snooping.c
Open vSwitch CI 940672
+++ b/lib/mcast-snooping.c
Open vSwitch CI 940672
@@ -432,7 +432,9 @@ mcast_snooping_add_group(struct mcast_snooping *ms,
Open vSwitch CI 940672
         uint32_t hash = mcast_table_hash(ms, addr, vlan);
Open vSwitch CI 940672
 
Open vSwitch CI 940672
         if (hmap_count(&ms->table) >= ms->max_entries) {
Open vSwitch CI 940672
-            group_get_lru(ms, &grp;;
Open vSwitch CI 940672
+            if (!group_get_lru(ms, &grp)) {
Open vSwitch CI 940672
+                return false;
Open vSwitch CI 940672
+            }
Open vSwitch CI 940672
             mcast_snooping_flush_group(ms, grp);
Open vSwitch CI 940672
         }
Open vSwitch CI 940672
 
Open vSwitch CI 4991e3
diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
Open vSwitch CI 4991e3
index 16c56608d8..529d64fe1d 100644
Open vSwitch CI 4991e3
--- a/lib/netdev-native-tnl.c
Open vSwitch CI 4991e3
+++ b/lib/netdev-native-tnl.c
Open vSwitch CI 4991e3
@@ -254,7 +254,7 @@ dp_packet_tnl_ol_process(struct dp_packet *packet,
Open vSwitch CI 4991e3
 
Open vSwitch CI 4991e3
             if (IP_VER(ip->ip_ihl_ver) == 4) {
Open vSwitch CI 4991e3
                 dp_packet_hwol_set_tx_ipv4(packet);
Open vSwitch CI 4991e3
-                dp_packet_hwol_tx_ip_csum(packet);
Open vSwitch CI 4991e3
+                dp_packet_hwol_set_tx_ip_csum(packet);
Open vSwitch CI 4991e3
             } else if (IP_VER(ip->ip_ihl_ver) == 6) {
Open vSwitch CI 4991e3
                 dp_packet_hwol_set_tx_ipv6(packet);
Open vSwitch CI 4991e3
             }
Open vSwitch CI 940672
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
Open vSwitch CI 940672
index ba720474b6..d92df28d19 100644
Open vSwitch CI 940672
--- a/lib/ovsdb-idl.c
Open vSwitch CI 940672
+++ b/lib/ovsdb-idl.c
Open vSwitch CI 940672
@@ -3783,6 +3783,8 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_)
Open vSwitch CI 940672
     ovsdb_idl_remove_from_indexes(row_);
Open vSwitch CI 940672
     if (!row->old_datum) {
Open vSwitch CI 940672
         ovsdb_idl_row_unparse(row);
Open vSwitch CI 940672
+        ovsdb_idl_destroy_all_map_op_lists(row);
Open vSwitch CI 940672
+        ovsdb_idl_destroy_all_set_op_lists(row);
Open vSwitch CI 940672
         ovsdb_idl_row_clear_new(row);
Open vSwitch CI 940672
         ovs_assert(!row->prereqs);
Open vSwitch CI 940672
         hmap_remove(&row->table->rows, &row->hmap_node);
Open vSwitch CI 940672
diff --git a/lib/vconn.c b/lib/vconn.c
Open vSwitch CI 940672
index e9603432d2..4b1c262eaa 100644
Open vSwitch CI 940672
--- a/lib/vconn.c
Open vSwitch CI 940672
+++ b/lib/vconn.c
Open vSwitch CI 940672
@@ -1017,6 +1017,8 @@ recv_flow_stats_reply(struct vconn *vconn, ovs_be32 send_xid,
Open vSwitch CI 940672
                 VLOG_WARN_RL(&rl, "received bad reply: %s",
Open vSwitch CI 940672
                              ofp_to_string(reply->data, reply->size,
Open vSwitch CI 940672
                                            NULL, NULL, 1));
Open vSwitch CI 940672
+                ofpbuf_delete(reply);
Open vSwitch CI 940672
+                *replyp = NULL;
Open vSwitch CI 940672
                 return EPROTO;
Open vSwitch CI 940672
             }
Open vSwitch CI 940672
         }
Open vSwitch CI 940672
@@ -1031,9 +1033,9 @@ recv_flow_stats_reply(struct vconn *vconn, ovs_be32 send_xid,
Open vSwitch CI 940672
         case EOF:
Open vSwitch CI 940672
             more = ofpmp_more(reply->header);
Open vSwitch CI 940672
             ofpbuf_delete(reply);
Open vSwitch CI 940672
+            *replyp = NULL;
Open vSwitch CI 940672
             reply = NULL;
Open vSwitch CI 940672
             if (!more) {
Open vSwitch CI 940672
-                *replyp = NULL;
Open vSwitch CI 940672
                 return EOF;
Open vSwitch CI 940672
             }
Open vSwitch CI 940672
             break;
Open vSwitch CI 940672
@@ -1041,6 +1043,8 @@ recv_flow_stats_reply(struct vconn *vconn, ovs_be32 send_xid,
Open vSwitch CI 940672
         default:
Open vSwitch CI 940672
             VLOG_WARN_RL(&rl, "parse error in reply (%s)",
Open vSwitch CI 940672
                          ofperr_to_string(retval));
Open vSwitch CI 940672
+            ofpbuf_delete(reply);
Open vSwitch CI 940672
+            *replyp = NULL;
Open vSwitch CI 940672
             return EPROTO;
Open vSwitch CI 940672
         }
Open vSwitch CI 940672
     }
Open vSwitch CI 940672
diff --git a/ofproto/bond.c b/ofproto/bond.c
Open vSwitch CI 940672
index c31869a4c7..0858de3746 100644
Open vSwitch CI 940672
--- a/ofproto/bond.c
Open vSwitch CI 940672
+++ b/ofproto/bond.c
Open vSwitch CI 940672
@@ -246,7 +246,7 @@ bond_create(const struct bond_settings *s, struct ofproto_dpif *ofproto)
Open vSwitch CI 940672
     ovs_refcount_init(&bond->ref_cnt);
Open vSwitch CI 940672
     hmap_init(&bond->pr_rule_ops);
Open vSwitch CI 940672
 
Open vSwitch CI 940672
-    bond->active_member_mac = eth_addr_zero;
Open vSwitch CI 940672
+    bond->active_member_mac = s->active_member_mac;
Open vSwitch CI 940672
     bond->active_member_changed = false;
Open vSwitch CI 940672
     bond->primary = NULL;
Open vSwitch CI 940672
 
Open vSwitch CI 940672
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
Open vSwitch CI 940672
index 4d39bc5a71..e7d4c2b2c3 100644
Open vSwitch CI 940672
--- a/ofproto/ofproto-dpif-upcall.c
Open vSwitch CI 940672
+++ b/ofproto/ofproto-dpif-upcall.c
Open vSwitch CI 940672
@@ -57,6 +57,7 @@ COVERAGE_DEFINE(dumped_inconsistent_flow);
Open vSwitch CI 940672
 COVERAGE_DEFINE(dumped_new_flow);
Open vSwitch CI 940672
 COVERAGE_DEFINE(handler_duplicate_upcall);
Open vSwitch CI 940672
 COVERAGE_DEFINE(revalidate_missed_dp_flow);
Open vSwitch CI 940672
+COVERAGE_DEFINE(revalidate_missing_dp_flow);
Open vSwitch CI 940672
 COVERAGE_DEFINE(ukey_dp_change);
Open vSwitch CI 940672
 COVERAGE_DEFINE(ukey_invalid_stat_reset);
Open vSwitch CI 940672
 COVERAGE_DEFINE(ukey_replace_contention);
Open vSwitch CI 940672
@@ -284,6 +285,7 @@ enum flow_del_reason {
Open vSwitch CI 940672
     FDR_TOO_EXPENSIVE,      /* Too expensive to revalidate. */
Open vSwitch CI 940672
     FDR_UPDATE_FAIL,        /* Datapath update failed. */
Open vSwitch CI 940672
     FDR_XLATION_ERROR,      /* Flow translation error. */
Open vSwitch CI 940672
+    FDR_FLOW_MISSING_DP,    /* Flow is missing from the datapath. */
Open vSwitch CI 940672
 };
Open vSwitch CI 940672
 
Open vSwitch CI 940672
 /* 'udpif_key's are responsible for tracking the little bit of state udpif
Open vSwitch CI 940672
@@ -318,6 +320,7 @@ struct udpif_key {
Open vSwitch CI 940672
     uint64_t dump_seq OVS_GUARDED;            /* Tracks udpif->dump_seq. */
Open vSwitch CI 940672
     uint64_t reval_seq OVS_GUARDED;           /* Tracks udpif->reval_seq. */
Open vSwitch CI 940672
     enum ukey_state state OVS_GUARDED;        /* Tracks ukey lifetime. */
Open vSwitch CI 940672
+    uint32_t missed_dumps OVS_GUARDED;        /* Missed consecutive dumps. */
Open vSwitch CI 940672
 
Open vSwitch CI 940672
     /* 'state' debug information. */
Open vSwitch CI 940672
     unsigned int state_thread OVS_GUARDED;    /* Thread that transitions. */
Open vSwitch CI 940672
@@ -3040,6 +3043,21 @@ revalidator_sweep__(struct revalidator *revalidator, bool purge)
Open vSwitch CI 940672
                     result = revalidate_ukey(udpif, ukey, &stats, &odp_actions,
Open vSwitch CI 940672
                                              reval_seq, &recircs, &del_reason);
Open vSwitch CI 940672
                 }
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+                if (ukey->dump_seq != dump_seq) {
Open vSwitch CI 940672
+                    ukey->missed_dumps++;
Open vSwitch CI 940672
+                    if (ukey->missed_dumps >= 4) {
Open vSwitch CI 940672
+                        /* If the flow was not dumped for 4 revalidator rounds,
Open vSwitch CI 940672
+                         * we can assume the datapath flow no longer exists
Open vSwitch CI 940672
+                         * and the ukey should be deleted. */
Open vSwitch CI 940672
+                        COVERAGE_INC(revalidate_missing_dp_flow);
Open vSwitch CI 940672
+                        del_reason = FDR_FLOW_MISSING_DP;
Open vSwitch CI 940672
+                        result = UKEY_DELETE;
Open vSwitch CI 940672
+                    }
Open vSwitch CI 940672
+                } else {
Open vSwitch CI 940672
+                    ukey->missed_dumps = 0;
Open vSwitch CI 940672
+                }
Open vSwitch CI 940672
+
Open vSwitch CI 940672
                 if (result != UKEY_KEEP) {
Open vSwitch CI 940672
                     /* Clears 'recircs' if filled by revalidate_ukey(). */
Open vSwitch CI 940672
                     reval_op_init(&ops[n_ops++], result, udpif, ukey, &recircs,
Open vSwitch CI 940672
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
Open vSwitch CI 940672
index 42fb66de68..12cb7f7a6a 100644
Open vSwitch CI 940672
--- a/tests/ofproto-dpif.at
Open vSwitch CI 940672
+++ b/tests/ofproto-dpif.at
Open vSwitch CI 940672
@@ -757,6 +757,73 @@ Datapath actions: drop
Open vSwitch CI 940672
 OVS_VSWITCHD_STOP()
Open vSwitch CI 940672
 AT_CLEANUP
Open vSwitch CI 940672
 
Open vSwitch CI 940672
+AT_SETUP([ofproto-dpif - active bond member survives restart])
Open vSwitch CI 940672
+dnl Create bond0 with members p1, p2 and p3. Initially, set p2 as active.
Open vSwitch CI 940672
+dnl Restart ovs-vswitchd. Check that p2 is still active.
Open vSwitch CI 940672
+OVS_VSWITCHD_START(
Open vSwitch CI 940672
+  [add-bond br0 bond0 p1 p2 p3 bond_mode=active-backup -- \
Open vSwitch CI 940672
+   set interface p1 type=dummy ofport_request=1 -- \
Open vSwitch CI 940672
+   set interface p2 type=dummy ofport_request=2 -- \
Open vSwitch CI 940672
+   set interface p3 type=dummy ofport_request=3 --])
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl bond/set-active-member bond0 p2], [0], [ignore])
Open vSwitch CI 940672
+OVS_WAIT_UNTIL_EQUAL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [dnl
Open vSwitch CI 940672
+---- bond0 ----
Open vSwitch CI 940672
+bond_mode: active-backup
Open vSwitch CI 940672
+bond may use recirculation: no, 
Open vSwitch CI 940672
+bond-hash-basis: 0
Open vSwitch CI 940672
+lb_output action: disabled, bond-id: -1
Open vSwitch CI 940672
+updelay: 0 ms
Open vSwitch CI 940672
+downdelay: 0 ms
Open vSwitch CI 940672
+lacp_status: off
Open vSwitch CI 940672
+lacp_fallback_ab: false
Open vSwitch CI 940672
+active-backup primary: <none>
Open vSwitch CI 940672
+<active member mac del>
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p1: enabled
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p2: enabled
Open vSwitch CI 940672
+  active member
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p3: enabled
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Restart ovs-vswitchd with an empty ovs-vswitchd log file.
Open vSwitch CI 940672
+OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
Open vSwitch CI 940672
+mv ovs-vswitchd.log ovs-vswitchd_1.log
Open vSwitch CI 940672
+AT_CHECK([ovs-vswitchd --enable-dummy --disable-system --disable-system-route --detach \
Open vSwitch CI 940672
+         --no-chdir --pidfile --log-file -vfile:rconn:dbg -vvconn -vofproto_dpif -vunixctl],
Open vSwitch CI 940672
+         [0], [], [stderr])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+OVS_WAIT_UNTIL_EQUAL([ovs-appctl bond/show | STRIP_RECIRC_ID | STRIP_ACTIVE_MEMBER_MAC], [dnl
Open vSwitch CI 940672
+---- bond0 ----
Open vSwitch CI 940672
+bond_mode: active-backup
Open vSwitch CI 940672
+bond may use recirculation: no, 
Open vSwitch CI 940672
+bond-hash-basis: 0
Open vSwitch CI 940672
+lb_output action: disabled, bond-id: -1
Open vSwitch CI 940672
+updelay: 0 ms
Open vSwitch CI 940672
+downdelay: 0 ms
Open vSwitch CI 940672
+lacp_status: off
Open vSwitch CI 940672
+lacp_fallback_ab: false
Open vSwitch CI 940672
+active-backup primary: <none>
Open vSwitch CI 940672
+<active member mac del>
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p1: enabled
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p2: enabled
Open vSwitch CI 940672
+  active member
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+member p3: enabled
Open vSwitch CI 940672
+  may_enable: true
Open vSwitch CI 940672
+])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+OVS_VSWITCHD_STOP
Open vSwitch CI 940672
+AT_CLEANUP
Open vSwitch CI 940672
+
Open vSwitch CI 940672
 AT_SETUP([ofproto-dpif - bond - allow duplicated frames])
Open vSwitch CI 940672
 dnl Receiving of duplicated multicast frames should be allowed with 'all_members_active'.
Open vSwitch CI 940672
 OVS_VSWITCHD_START([dnl
Open vSwitch CI 940672
@@ -12661,3 +12728,48 @@ AT_CHECK([ovs-appctl revalidator/resume])
Open vSwitch CI 940672
 
Open vSwitch CI 940672
 OVS_VSWITCHD_STOP
Open vSwitch CI 940672
 AT_CLEANUP
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+AT_SETUP([ofproto-dpif - Cleanup missing datapath flows])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+OVS_VSWITCHD_START
Open vSwitch CI 940672
+add_of_ports br0 1 2
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+m4_define([ICMP_PKT], [m4_join([,],
Open vSwitch CI 940672
+    [eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800)],
Open vSwitch CI 940672
+    [ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no)],
Open vSwitch CI 940672
+    [icmp(type=8,code=0)])])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+AT_CHECK([ovs-ofctl del-flows br0])
Open vSwitch CI 940672
+AT_CHECK([ovs-ofctl add-flow br0 'actions=normal' ])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'ICMP_PKT'])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl dpctl/dump-flows --names | strip_used | strip_stats | dnl
Open vSwitch CI 940672
+          strip_duration | strip_dp_hash | sort], [0], [dnl
Open vSwitch CI 940672
+flow-dump from the main thread:
Open vSwitch CI 940672
+recirc_id(0),in_port(p1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:br0,p2
Open vSwitch CI 940672
+])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Make sure the ukey exists.
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl upcall/show | grep '(keys' | awk '{print $3}' | \
Open vSwitch CI 940672
+            grep -q '1)'], [0])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Delete all datapath flows, and make sure they are gone.
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl dpctl/del-flows])
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl dpctl/dump-flows --names ], [0], [])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Move forward in time and make sure we have at least 4 * 500ms.
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl time/warp 3000 300], [0], [ignore])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Make sure no more ukeys exists.
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl upcall/show | grep '(keys' | awk '{print $3}' | \
Open vSwitch CI 940672
+            grep -qv '0)'], [1])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+dnl Verify coverage counter was hit.
Open vSwitch CI 940672
+AT_CHECK([ovs-appctl coverage/read-counter revalidate_missing_dp_flow], [0],
Open vSwitch CI 940672
+         [dnl
Open vSwitch CI 940672
+1
Open vSwitch CI 940672
+])
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+OVS_VSWITCHD_STOP(["/failed to flow_del (No such file or directory)/d"])
Open vSwitch CI 940672
+AT_CLEANUP
Open vSwitch CI 940672
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
Open vSwitch CI 940672
index 9070ea051a..74ccaccdd2 100644
Open vSwitch CI 940672
--- a/tests/ovsdb-idl.at
Open vSwitch CI 940672
+++ b/tests/ovsdb-idl.at
Open vSwitch CI 940672
@@ -1881,7 +1881,10 @@ OVSDB_CHECK_IDL_PARTIAL_UPDATE_MAP_COLUMN([map, simple2 idl-partial-update-map-c
Open vSwitch CI 940672
 007: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
Open vSwitch CI 940672
 008: After trying to delete a deleted element
Open vSwitch CI 940672
 009: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
Open vSwitch CI 940672
-010: End test
Open vSwitch CI 940672
+010: After Create element, update smap and Delete element
Open vSwitch CI 940672
+011: name=String2 smap=[[key2 : value2]] imap=[[3 : myids2]]
Open vSwitch CI 940672
+012: After update smap and Delete element
Open vSwitch CI 940672
+014: End test
Open vSwitch CI 940672
 ]])
Open vSwitch CI 940672
 
Open vSwitch CI 940672
 OVSDB_CHECK_IDL_PY([partial-map idl],
Open vSwitch CI 940672
@@ -1944,7 +1947,9 @@ OVSDB_CHECK_IDL_PARTIAL_UPDATE_SET_COLUMN([set, simple3 idl-partial-update-set-c
Open vSwitch CI 940672
 009: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[] uuid=<2>
Open vSwitch CI 940672
 010: After add to other table + set of strong ref
Open vSwitch CI 940672
 011: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[<5>] uuid=<2>
Open vSwitch CI 940672
-012: End test
Open vSwitch CI 940672
+012: After Create element, update set and Delete element
Open vSwitch CI 940672
+013: table simple3: name=String2 uset=[<0>,<1>,<4>] uref=[<5>] uuid=<2>
Open vSwitch CI 940672
+014: End test
Open vSwitch CI 940672
 ]])
Open vSwitch CI 940672
 
Open vSwitch CI 940672
 OVSDB_CHECK_IDL_PY([partial-set idl],
Open vSwitch CI 940672
diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
Open vSwitch CI 940672
index 41c1525f45..710341b655 100644
Open vSwitch CI 940672
--- a/tests/test-ovsdb.c
Open vSwitch CI 940672
+++ b/tests/test-ovsdb.c
Open vSwitch CI 940672
@@ -3020,6 +3020,29 @@ do_idl_partial_update_map_column(struct ovs_cmdl_context *ctx)
Open vSwitch CI 940672
     printf("%03d: After trying to delete a deleted element\n", step++);
Open vSwitch CI 940672
     dump_simple2(idl, myRow, step++);
Open vSwitch CI 940672
 
Open vSwitch CI 940672
+    myTxn = ovsdb_idl_txn_create(idl);
Open vSwitch CI 940672
+    myRow = idltest_simple2_insert(myTxn);
Open vSwitch CI 940672
+    idltest_simple2_update_smap_setkey(myRow, "key3", "myList3");
Open vSwitch CI 940672
+    idltest_simple2_set_name(myRow, "String2");
Open vSwitch CI 940672
+    idltest_simple2_delete(myRow);
Open vSwitch CI 940672
+    ovsdb_idl_txn_commit_block(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_txn_destroy(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_get_initial_snapshot(idl);
Open vSwitch CI 940672
+    printf("%03d: After Create element, update smap and Delete element\n",
Open vSwitch CI 940672
+           step++);
Open vSwitch CI 940672
+    dump_simple2(idl, myRow, step++);
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+    myTxn = ovsdb_idl_txn_create(idl);
Open vSwitch CI 940672
+    myRow = idltest_simple2_first(idl);
Open vSwitch CI 940672
+    idltest_simple2_update_smap_setkey(myRow, "key4", "myList4");
Open vSwitch CI 940672
+    idltest_simple2_set_name(myRow, "String3");
Open vSwitch CI 940672
+    idltest_simple2_delete(myRow);
Open vSwitch CI 940672
+    ovsdb_idl_txn_commit_block(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_txn_destroy(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_get_initial_snapshot(idl);
Open vSwitch CI 940672
+    printf("%03d: After update smap and Delete element\n", step++);
Open vSwitch CI 940672
+    dump_simple2(idl, myRow, step++);
Open vSwitch CI 940672
+
Open vSwitch CI 940672
     ovsdb_idl_destroy(idl);
Open vSwitch CI 940672
     printf("%03d: End test\n", step);
Open vSwitch CI 940672
 }
Open vSwitch CI 940672
@@ -3118,6 +3141,21 @@ do_idl_partial_update_set_column(struct ovs_cmdl_context *ctx)
Open vSwitch CI 940672
     ovsdb_idl_get_initial_snapshot(idl);
Open vSwitch CI 940672
     printf("%03d: After add to other table + set of strong ref\n", step++);
Open vSwitch CI 940672
     dump_simple3(idl, myRow, step++);
Open vSwitch CI 940672
+
Open vSwitch CI 940672
+    /* create row, insert key, delete row */
Open vSwitch CI 940672
+    myTxn = ovsdb_idl_txn_create(idl);
Open vSwitch CI 940672
+    myRow = idltest_simple3_insert(myTxn);
Open vSwitch CI 940672
+    uuid_from_string(&uuid_to_add, "12345678-dd3f-4616-ab6a-83a490bb0991");
Open vSwitch CI 940672
+    idltest_simple3_update_uset_addvalue(myRow, uuid_to_add);
Open vSwitch CI 940672
+    idltest_simple3_set_name(myRow, "String2");
Open vSwitch CI 940672
+    idltest_simple3_delete(myRow);
Open vSwitch CI 940672
+    ovsdb_idl_txn_commit_block(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_txn_destroy(myTxn);
Open vSwitch CI 940672
+    ovsdb_idl_get_initial_snapshot(idl);
Open vSwitch CI 940672
+    printf("%03d: After Create element, update set and Delete element\n",
Open vSwitch CI 940672
+           step++);
Open vSwitch CI 940672
+    dump_simple3(idl, myRow, step++);
Open vSwitch CI 940672
+
Open vSwitch CI 940672
     ovsdb_idl_destroy(idl);
Open vSwitch CI 940672
     printf("%03d: End test\n", step);
Open vSwitch CI 940672
 }
Open vSwitch CI 940672
diff --git a/utilities/usdt-scripts/flow_reval_monitor.py b/utilities/usdt-scripts/flow_reval_monitor.py
Open vSwitch CI 940672
index 28479a5650..80c9c98bdb 100755
Open vSwitch CI 940672
--- a/utilities/usdt-scripts/flow_reval_monitor.py
Open vSwitch CI 940672
+++ b/utilities/usdt-scripts/flow_reval_monitor.py
Open vSwitch CI 940672
@@ -255,6 +255,7 @@ FdrReasons = IntEnum(
Open vSwitch CI 940672
         "FDR_TOO_EXPENSIVE",
Open vSwitch CI 940672
         "FDR_UPDATE_FAIL",
Open vSwitch CI 940672
         "FDR_XLATION_ERROR",
Open vSwitch CI 940672
+        "FDR_FLOW_MISSING_DP"
Open vSwitch CI 940672
     ],
Open vSwitch CI 940672
     start=0,
Open vSwitch CI 940672
 )
Open vSwitch CI 940672
@@ -270,7 +271,8 @@ FdrReasonStrings = {
Open vSwitch CI 940672
     FdrReasons.FDR_PURGE: "User requested flow deletion",
Open vSwitch CI 940672
     FdrReasons.FDR_TOO_EXPENSIVE: "Too expensive to revalidate",
Open vSwitch CI 940672
     FdrReasons.FDR_UPDATE_FAIL: "Datapath update failed",
Open vSwitch CI 940672
-    FdrReasons.FDR_XLATION_ERROR: "Flow translation error"
Open vSwitch CI 940672
+    FdrReasons.FDR_XLATION_ERROR: "Flow translation error",
Open vSwitch CI 940672
+    FdrReasons.FDR_FLOW_MISSING_DP: "Flow is missing from the datapath"
Open vSwitch CI 940672
 }
Open vSwitch CI 940672
 
Open vSwitch CI 940672