A conntrack flush that matches on mark, labels or a partial tuple stops
at the first entry that is gone by the time it is deleted, or that has
a protocol that netlink-conntrack cannot put in a delete request, and
leaves the rest in the connection tracker.  Whatever goes wrong, the
controller that asked for the flush is not told.

v3 fixes the build of patch 2 with sparse, which the CI caught in
v2 [2] (a missing include in the new test), and adds patch 4.
Patches 1 and 3 are the same as in v2.

Patch 4 is there because of what I found after v2 went out.

A system that runs v1 [1] logged a flush that failed with EOPNOTSUPP
on a GRE entry: netlink-conntrack only builds a delete request for
ICMP, ICMPv6, TCP, UDP and SCTP.  v1 carried on after that error.  v2
ends the flush there, as asked in the review of v1 and as the code
does today, so with v2 alone that flush is cut short again.

Patch 4 does not go back on that.  Any error but ENOENT still ends
the flush.  It lets netlink-conntrack build the delete request for
any protocol, so that the error does not happen.

Patch 1 rate limits the "Tuple not found" log of the userspace
connection tracker, which the flush loop could repeat for every
connection once it no longer stops at the first one.  It comes before
the fix, as a patch of its own, so that no point of the series can
flood the log.

Patch 2 is the fix for an entry that is gone.  Only ENOENT keeps the
flush going.  The patch adds a test.  Neither datapath can lose an
entry between the dump and the delete on demand, so the test has a
small datapath of its own.

Patch 3 reports the result of NXT_CT_FLUSH and NXT_CT_FLUSH_ZONE to
the controller.  Two things in it are choices that I would like
opinions on:

 - It adds two errors, NXCTF_NOT_SUPPORTED and NXCTF_FAILED, and does
   not reuse an existing one.  The commit message has the reasons.

 - A controller now gets an error reply where it got nothing.
   ovn-controller logs an OpenFlow error that it does not expect at
   info level and reconnects to the switch (ofctrl_recv(), since OVN
   commit 82b90fa5c006 "controller: Handle OpenFlow errors.").  With
   this series the cases that happen in normal operation produce no
   error: an entry that is already gone, a 5-tuple that matches
   nothing and, with patch 4, an entry of another protocol.  What is
   left is a datapath that fails the flush, like ENOBUFS, or that
   cannot do it.  If a reconnect is too much for those, OVN can
   handle the two new errors on its side.

Patch 4 is the fix for an entry of another protocol.  It has a system
test that fails with the kernel datapath without the change.

Built with --enable-Werror and with --enable-sparse.  Tested with
"make check" and with the conntrack tests of
"make check-kernel" and "make check-system-userspace".  Two of the
kernel ones, "limit by zone" and "Flush many conntrack entries by
port", fail here with and without patch 4: my environment cannot
reload the kernel module between tests, so the zone limit of the
former stays.  The rest was checked by hand with the kernel datapath
(details in patches 2 to 4).

[1] 
https://patchwork.ozlabs.org/project/openvswitch/patch/5b59ff8835fb53d08003393ac72180401c6636cf.1795359264.git.forq...@iteasy.co.kr/
[2] 
https://patchwork.ozlabs.org/project/openvswitch/cover/[email protected]/

Bekei Park (4):
  conntrack: Rate limit the log for a tuple that is not found.
  ct-dpif: Do not stop a partial match flush on ENOENT.
  ofproto: Report a failed conntrack flush to the controller.
  netlink-conntrack: Delete entries of any L4 protocol.

 NEWS                             |   4 +
 include/openvswitch/ofp-errors.h |  14 +++
 lib/conntrack.c                  |   4 +-
 lib/ct-dpif.c                    |   6 +-
 lib/netlink-conntrack.c          |  12 +-
 ofproto/ofproto-dpif.c           |   4 +-
 ofproto/ofproto-provider.h       |  10 +-
 ofproto/ofproto.c                |  42 ++++---
 tests/automake.mk                |   1 +
 tests/library.at                 |  12 ++
 tests/ofp-errors.at              |  35 ++++++
 tests/system-traffic.at          |  47 ++++++++
 tests/test-ct-dpif.c             | 196 +++++++++++++++++++++++++++++++
 13 files changed, 359 insertions(+), 28 deletions(-)
 create mode 100644 tests/test-ct-dpif.c


base-commit: e77c3bac93f5f62234e5e586b6b02488a43e4557
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to