2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

20494 Commits

Author SHA1 Message Date
Eelco Chaudron
ca9e67c801 daemon-unix: Handle potential negative values from sysconf().
Coverity reports that daemon_set_new_user() may receive a large
unsigned value from get_sysconf_buffer_size(), due to sysconf()
returning -1 and being cast to size_t.

Although this would likely lead to an allocation failure and abort,
it's better to handle the error in place.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-12 15:28:31 +02:00
Eelco Chaudron
99af7f3791 ovsdb: Fix Coverity leak warning by marking code as unreachable.
Coverity reports a memory leak on the 'error' variable in
ovsdb_trigger_try(). However, this code path is unreachable due to an
ovs_assert() in an earlier function call.

To make this clear to Coverity and silence the warning, the section is
explicitly marked as unreachable.

Acked-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-10 17:07:06 +02:00
Eelco Chaudron
2c634482f2 raft: Fix resource leak from ignored ovsdb_log_write_and_free() error.
The Raft codebase includes calls to ovsdb_log_write_and_free() that
are incorrectly wrapped in ignore(). This causes potential error
resources to be leaked.

These calls should be wrapped in ovsdb_error_destroy() instead, to
ensure that any returned error objects are properly freed and do not
result in memory leaks.

Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
Acked-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-10 17:05:37 +02:00
Eelco Chaudron
b90304bfe7 ovsdb-server: Fix potential memory leak in parse_options().
When duplicate --config-file command-line arguments are passed,
the resources for previously specified file path were not freed.

This fix ensures unused resources are properly freed while
preserving the existing behavior of using the last configuration
file path specified.

Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-10 17:04:49 +02:00
Eelco Chaudron
d1bd62dae5 ofproto-dpif-upcall: Check odp_tun_key_from_attr() return value.
In the IPFIX and flow sample upcall handling, check the validity
of the tunnel key returned by odp_tun_key_from_attr(). If the
tunnel key is invalid, return an error.

This was reported by Coverity, but the change also improves
robustness and avoids undefined behavior in the case of malformed
tunnel attributes.

Fixes: 8b7ea2d48033 ("Extend OVS IPFIX exporter to export tunnel headers")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2025-06-10 17:04:09 +02:00
Eelco Chaudron
88737f02ed ofproto-dpif-xlate: Fix memory leak in xlate_generic_encap_action().
This is not a real issue, as the initializer function,
rewrite_flow_push_nsh(), ensures it returns NULL on error.
However, cleaning this up improves code clarity and resolves
a Coverity warning about a potential memory leak.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-10 17:03:39 +02:00
Eelco Chaudron
8fca3f99cf lldp: Fix Coverity warning about resource leak in lldp test.
Coverity reported a potential resource leak in the LLDP test code.
While this condition should never occur in practice, since the test
would crash on out-of-memory, the warning is addressed by ensuring
the cleanup function is called on error paths.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-06-10 17:02:58 +02:00
Ales Musil
d283829477 sparse: Define new AVX10 includes added in GCC >= 15.
The GCC >=15 added new AVX10 header files, add defines for them as
sparse is not able to understand new types in those. This can be
seen with DPDK headers.

Tested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-06-03 18:48:45 +02:00
Ales Musil
0e419d1b4f sparse: Add workaround for OpenSSL configuration.
sparse fails to process OpenSSL configuration header file in recent
OpenSSL version (3.2.x). Add workaround header that will disable
the problematic macro.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-06-02 17:30:02 +02:00
Ilya Maximets
8224cd47f3 tests: tunnel-push-pop: Fix occasional failure of the drop test.
Datapath port zero is normally taken by the 'datapath interface', i.e.
the ovs-dummy interface.  This makes it not possible to allocate port
zero for the p0 interface.  So, it will race with p1 for the number 1.
If p0 happens to be created first, it will take the 1 and p1 will get
the port 2 and then the test passes.  However, if p1 is created first,
then it will take the 1 and p0 will take the 2.  In this case the
test fails as the port name in the trace will be different.

Use '--names' to avoid this problem, but also fix the port numbers and
use the 'add_of_ports' macro instead of plain-coding the port addition.
The macro would've made the issue more obvious in the first place.

Fixes: 1015b13f054d ("ofproto-dpif-xlate: Add a drop action for native tunnel failure.")
Acked-by: Eli Britstein <elibr@nvidia.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-06-02 16:03:58 +02:00
David Marchand
e99ce7d5df flow: Fix checksum offloads with simple match.
Packets with L4 partial status for a simple match flow would not get L4
checksums offloads applied.

This was not caught in unit tests, because packets from netdev-dummy
(calling miniflow_extract) would get Tx flags set early, before
parse_tcp_flags() got called during packet processing.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-30 18:00:56 +02:00
Kevin Traynor
48ce3a5a52 dpdk: Use DPDK 24.11.2 release.
Update the CI and docs to use DPDK 24.11.2.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 16:48:44 +01:00
Roi Dayan
b42f9fde4a netdev-dpdk: Fix possible memory leak in vhost stats.
On error condition need to release the allocated structs.

Reported by Coverity.

Fixes: 3b29286db1c5 ("netdev-dpdk: Add per virtqueue statistics.")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2025-05-30 14:22:23 +01:00
Eelco Chaudron
7e3a0b4961 AUTHORS: Add Yang Yang.
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 11:09:29 +02:00
Yang Yang
60a2193000 perf-counter: Enable exclude_guest by default.
This patch sets exclude_guest to true by default in perf-counter.
Since ovsdb-server typically does not need guest context events,
this change avoids collecting unnecessary data and improves profiling
accuracy on the host.

Co-authored-by: Rongqing Li <lirongqing@baidu.com>
Signed-off-by: Yang Yang <yangyang92@baidu.com>
Signed-off-by: Rongqing Li <lirongqing@baidu.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 11:09:29 +02:00
Roi Dayan
2df25f970a util: Remove include of itself.
This is a redundant include.

Fixes: ee89ea7b477b ("json: Move from lib to include/openvswitch.")
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 10:29:58 +02:00
Roi Dayan
37848e2188 util: Ignore return code from str_to_uint().
Reported by Coverity.
  lib/util.c:795 Unchecked return value (CHECKED_RETURN):

As it's not really bug, wrap it with ignore().

Fixes: 9551e80befc0 ("tests: Use environment variable for default timeout.")
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-30 10:28:53 +02:00
Ilya Maximets
e180c431b9 tests: classifier: Add a stress test for prefixes reconfiguration.
This test is reusing the benchmark infrastructure, but it has some
pre-defined parameters, so it's easier to run in the test suite.

The benchmark code is adjusted to start another thread that does
prefix updates continuously in a loop and the lookup threads are
updated to be able to enter quiescent state periodically, so the
reconfiguration can proceed.

This test is a reproducer for the crashes fixed in the previous
commit.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-26 17:38:52 +02:00
Ilya Maximets
6a61a70fcb classifier: Fix race for prefix tree configuration.
The thread fence in the classifier is supposed to ensure that when the
subtable->trie_plen is updated, the actual prefix tree is ready to be
used.  On the write side in trie_init(), the fence is between the
tree configuration and the 'trie_plen' update.  On the reader's side
however, the fence is at the beginning of the classifier_lookup__(),
and both reads of the 'trie_plen' and the accesses to the tree itself
are happening afterwards.  And since both types of the reads are on
the same side of the fence, the fence is kind of pointless and doesn't
guarantee any memory ordering.  So, readers can be accessing partially
initialized prefix trees.

Another problem with the configuration is that cls->n_tries is updated
without any synchronization as well.  The comment on the fence says
that it also synchronizes for the cls->n_tries, but that doesn't make
a lot of sense.  In practice, cls->n_tries is read multiple times
throughout the classifier_lookup__() and each of these reads may give
a different value if there is a concurrent update, causing the reader
to access trees that are not initialized or in the middle of being
destroyed, leading to OVS crashes while the user updates the flow
table prefixes.

First thing that needs to be fixed here is to only read cls->n_tries
once to avoid obvious crashes with access to uninitialized trie_ctx[]
entries.

The second thing is that we need a proper memory synchronization that
will guarantee that our prefix trees are fully initialized when
readers access them.  In the current logic we would need to issue
a thread fence after every read of a subtable->trie_plen value, i.e.,
we'd need a fence per subtable lookup.  This would be very expensive
and wasteful, considering the prefix tree configuration normally
happens only once somewhere at startup.

What we can do instead is to convert cls->n_tries into atomic and use
it as a synchronization point:

  Writer (classifier_set_prefix_fields):

  1. Before making any changes, set cls->n_tries to zero.  Relaxed
     memory order can be used here, because we'll have a full memory
     barrier at the next step.
  2. ovsrcu_synchronize() to wait for all threads to stop using tries.
  3. Update tries while nobody is using them.
  4. Set cls->n_tries to a new value with memory_order_release.

  Reader (classifier_lookup):

  1. Read the cls->n_tries with the memory_order_acquire.
  2. Use that once read value throughout.

RCU in this scenario will ensure that every thread no longer uses the
prefix trees when we're about to change them.  The acquire-release
semantics on the cls->n_tries just saves us from calling the
ovsrcu_synchronize() the second time once we're done with the whole
reconfiguration.  We're just updating the number and making all the
previous changes visible on CPUs that acquire it.

Alternative solution might be to go full RCU and make the array of
trees itself RCU-protected.  This way we would not need to do any
extra RCU synchronization or managing the memory ordering.  However,
that would mean having multiple layers of RCU with trees and rules
in them potentially surviving multiple grace periods, which I would
like to avoid, if possible.

Previous code was also trying to be smart and not disable prefix tree
lookups for prefixes that are not changing.  We're sacrificing this
functionality in the name of simpler code.  Attempt to make that work
would either require a full conversion to RCU or a per-subtable
synchronization.  Lookups can be done without the prefix match
optimizations for a brief period of time.  This doesn't affect
correctness of the resulted datapath flows.

In the actual implementation instead of dropping cls->n_tries to zero
at step one, we keep the access to the first N tries that are not
going to change by setting the cls->n_tries to the index of the first
trie that will be updated.  So, we'll not be disabling all the prefix
match optimizations completely.

There was an attempt to solve this problem already in commit:
  a6117059904b ("classifier: Prevent tries vs n_tries race leading to NULL dereference.")
But it was focused on one particular crash and didn't take into account
a wider issue with the memory ordering on these trees in general.  The
changes made in that commit are mostly reverted as not needed anymore.

Fixes: f358a2cb2e54 ("lib/classifier: RCUify prefix trie code.")
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2025-April/422765.html
Reported-by: Numan Siddique <numans@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-26 17:38:22 +02:00
Ilya Maximets
9234b9b40f tests: classifier: Fix the rule number check during trie verification.
Same rule can be in multiple prefix trees and so it is possible that
the total number of rules in all trees exceeds the total number of
rules in the classifier.  But the number of rules in a single prefix
tree still can't exceed the total number of rules in the classifier.
Move the check accordingly.

Note: checkpatch complains about usage of the assert(), but it is
everywhere in this file and so, not changing in just this one place.

Fixes: f358a2cb2e54 ("lib/classifier: RCUify prefix trie code.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-26 17:38:17 +02:00
Eelco Chaudron
f7711efc9d ovs-router: Fix potential resource leak in JSON output.
If we need to bail out of the JSON format loop, we do
not free the allocated resources. This fix moves the
allocation to after the check.

Fixes: d000ff1cd564 ("ovs-router: Add JSON output for 'ovs/route/show' command.")
Acked-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-26 08:55:32 +02:00
David Marchand
5603b869a8 netdev-linux: Fix offloads for IPv6 UDP packets.
Caught by code review, offloading checksum of IPv6 UDP packets was wrong
as the IPv6 header used for the pseudo header checksum was wrong.

Fixes: cb0cbffbe8fb ("netdev-linux: Favour inner packet for multi-encapsulated TSO.")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 23:52:54 +02:00
David Marchand
c852a8c767 netdev-native-tnl: Do not validate already checked checksum.
Bad packets were still being validated in software when decapsulating
a IP header. Trust decision taken wrt IP checksum offloading (checking
dp_packet_hwol_l3_csum_ipv4_ol()) and avoid revalidating a known
bad checksum.

While at it, add coverage counters so that checksum validation impact
can be monitored, and unit tests.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 23:45:51 +02:00
David Marchand
71f3dd3e9c conntrack: Fix embedded checksums in ICMP errors.
Helpers like packet_set_ipv4() resets IP csum flags.
Inspecting and natting embedded payload in an ICMP error is thus broken
if the "outer" IP header had some Rx checksum flags that made it
eligible to Tx IP checksum.
Reset temporarily any Tx checksum to force those helpers to resolve the
checksums.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 23:14:42 +02:00
David Marchand
4b00509ea1 conntrack: Do not validate already checked checksum.
Bad packets were still being validated in software when entering
conntrack.  Trust decision taken wrt IP checksum offloading (checking
dp_packet_hwol_l3_csum_ipv4_ol()) and avoid revalidating a known
bad checksum.

While at it, add coverage counters so that checksum validation impact
can be monitored, and unit tests.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 22:05:48 +02:00
David Marchand
8a7f1292d5 ipf: Consider checksum only for fragmented packets.
Currently, the fragment reassembly code marks any packets with bad
checksums as invalid and increments the ipf_l3csum_err counter.
This is confusing, because this happens even if these packets are not
fragmented.

Non-fragments should be ignored by the fragment reassembly engine and
be left for the main conntrack code.  It has its own logic for marking
packets with incorrect checksums and will increase the expected
conntrack_l3csum_err counter instead.

While at it, add coverage counters so that checksum validation impact
can be monitored.

Signed-off-by: David Marchand <david.marchand@redhat.com>
[i.maximets: re-worded the commit message]
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 20:58:29 +02:00
David Marchand
585c8088eb dpif-netdev: Enhance checksum coverage.
Enhance netdev-dummy:
- add debug log,
- split Rx and Tx aspects,
- add coverage for bad status,

Enhance unit tests:
- enable Tx offloads on the transmitting port,
- test L4 checksums for TCP and UDP (and partial status),
- test IPv6,

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 19:43:01 +02:00
David Marchand
d49994634e flow: Fix bad IP checksum flag.
flow_compose() can generate packets with bad IPv4 checksum, however the
associated Rx flags were not correctly set.
The usefulness of setting this metadata seems limited, yet fix this for
consistency.

Fixes: c62b4ac8f8da ("ovs-ofctl: Implement compose-packet --bare [--bad-csum].")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-21 19:08:36 +02:00
Roi Dayan
261f02ba32 ovs-ctl: Allow to set custom core file size for ovs daemons.
Allow to set custom core file size with --ulimit-core argument.
This argument can be set in ovs config file
in rhel can set OPTIONS in /etc/sysconfig/openvswitch
in debian can set OVS_CTL_OPTS in /etc/default/openvswitch-switch.

Acked-by: Gaetan Rivet <gaetanr@nvidia.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-21 17:56:57 +02:00
Dima Chumak
d000ff1cd5 ovs-router: Add JSON output for 'ovs/route/show' command.
The 'ovs/route/show' command now supports machine-readable JSON output
in addition to the plain-text output for humans.
Align the keys to match ip route output.

An example json output would be:

  ovs-appctl --format json --pretty ovs/route/show
  [
    {
      "dst": "::1",
      "local": false,
      "nexthops": [
        {
          "dev": "lo"}],
      "prefix": 128,
      "prefsrc": "::1",
      "priority": 128,
      "user": false},
    {
      "dst": "10.237.157.103",
      "local": true,
      "nexthops": [
        {
          "dev": "eth1"}],
      "prefix": 32,
      "prefsrc": "10.237.157.103",
      "priority": 192,
      "user": false},
    {
      "dst": "fe80::42:67ff:fe28:188",
      "local": true,
      "nexthops": [
        {
          "dev": "docker0"}],
      "prefix": 128,
      "prefsrc": "fe80::42:67ff:fe28:188",
      "priority": 192,
      "user": false},
    {
      "dst": "0.0.0.0",
      "local": false,
      "nexthops": [
        {
          "dev": "eth0",
          "gateway": "192.168.121.1"}],
      "prefix": 0,
      "prefsrc": "192.168.121.203",
      "priority": 96,
      "user": false}]

Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Dima Chumak <dchumak@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-21 17:55:29 +02:00
Ilya Maximets
6fc5221742 ipsec: libreswan: Fix premature reconciliation of just added tunnels.
Currently we're only tracking the last refresh time and perform
reconciliation of non-active connections on every refresh.  This is
causing issues in large clusters when tunnels are added sequentially.
Consider the following example:

 1. Tun-1 added -> refresh()
    -> Tun-1: adding 'in' and starting 'out'.

 2. Tun-2 added -> refresh()
    -> Tun-2: adding 'in' and starting 'out'.
    -> Tun-1: The other side didn't have time to initiate the 'in'
              connection yet, so it is not active.  But we see that
              it's not active and trying to start it.

 3. Tun-3 added -> refresh()
    -> Tun-3: adding 'in' and starting 'out'.
    -> Tun-2: The other side didn't have time to initiate the 'in'
              connection yet, so it is not active.  But we see that
              it's not active and trying to start it.
    -> Tun-1: The connection still had no time to become active, but
              we declare it 'defunct' and re-creating.

Behavior above is specific to Libreswan 4.  Libreswan 5 will report
UP connections as active in most cases, so they will not be marked
as defunct, but they will still be started quickly after addition
when it is not needed.

This creates unnecessary churn in the cluster and puts Libreswan into
an uncomfortable position where crossing stream issues (where both
sides are trying to establish the same connection at the same time)
are far more likely.

Fix that by specifically tracking time when we add or start each
connection instead of just the last time we refreshed for any reason.
This should make ovs-monitor-ipsec to actually wait for the
reconciliation interval before attempting to repair connections and
give Libreswan a decent amount of time to process the changes and try
to establish connections normally.

Note: even though we could precisely track 15 seconds for each
individual connection and wake up when exactly 15 seconds expire,
we're not doing that in this patch.  The reason is that we still
need to wake up every 15 seconds to check that all the previously
active connections are still active, and doing that allows for
refreshing many connections in the same run instead of waking up
every second just for one connection.

Fixes: 25a301822e0d ("ipsec: libreswan: Reconcile missing connections periodically.")
Reported-at: https://issues.redhat.com/browse/FDP-1364
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-16 23:29:52 +02:00
Ilya Maximets
1b2eff486f github: Add a permanent workaround for malformed /etc/hosts.
On two separate occasions GitHub added random garbage into the hosts
file breaking our tests.  This change adds a permanent workaround for
this kind of stuff.  It will remove everything that doesn't look like
a correct syntax from the file.

The regex is not perfect, but it should be sufficient for most cases.
It allows empty lines, comments and a valid 'IP NAME[ NAME]...' lines,
where 'IP' resembles an IP address and the 'NAME' consists of valid
DNS characters.  Under normal conditions the diff should always be
empty.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-05-13 17:04:33 +02:00
Eelco Chaudron
28064e9fa5 AUTHORS: Add Dmitry Porokh.
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-08 09:35:41 +02:00
Dmitry Porokh
421c94ee14 ovsdb: Introduce and use specialized uuid print functions.
According to profiling data, converting UUIDs to strings is a frequent
operation in some workloads. This typically results in a call to
xasprintf(), which internally calls vsnprintf() twice, first to
calculate the required buffer size, and then to format the string.

This patch introduces specialized functions for printing UUIDs, which
both reduces code duplication and improves performance.

For example, on my laptop, 10,000,000 calls to the new uuid_to_string()
function takes 1296 ms, while the same number of xasprintf() calls using
UUID_FMT take 2498 ms.

Signed-off-by: Dmitry Porokh <dporokh@nvidia.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-08 09:28:21 +02:00
Mike Pattrick
94500f9bb0 tests: Run IPv6 ct fragmentation tests in different zones.
Currently many of the IPv6 ct tests run in the same ct zone resulting in
the ct state from one test interacting with subsequent tests. This is
especially true with fragmented packets.

This interaction can be easily negated by running the tests in different
ct zones.

Reported-at: https://issues.redhat.com/browse/FDP-1339
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2025-05-08 09:27:43 +02:00
Simon Horman
8aa649c7b8 NEWS: Note that OOT kernel module documentation has been removed.
Note that most documentation of the OOT kernel module has now been
removed.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:33 +01:00
Simon Horman
6bd931716e docs: issues: Update for removal of OOT kernel module.
Rework the "I just upgraded and I see a performance drop.  Why?"
section to cover both earlier releases where the OOT module
was recommended and the current recommendation to use the
upstream Linux module.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:31 +01:00
Simon Horman
ef6cfc0a0b docs: configuration: Don't document OOT kernel module wrt connecting bridges.
The section on connecting bridges includes a paragraph
describing usage with Open vSwitch 1.9 and the OOT kernel module.

Remove this paragraph as that release is very old;
Support for the OOT module was removed in the v3.0 release of Open vSwitch;
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:27 +01:00
Simon Horman
aea939b24a docs: faucet: Remove references to OOT kernel module.
Remove documentation relating to OOT kernel module.

It is out-of-tree (OOT) with respect to the upstream kernel.
But in this document referred to as in-tree, with respect
to the Open vSwitch tree.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:25 +01:00
Simon Horman
89e8c12499 docs: general: Remove references to kernel module.
Remove documentation relating to OOT kernel module.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:21 +01:00
Simon Horman
68d742e84e debian: Remove documentation of OOT kernel module.
Remove documentation relating to the OOT kernel module as this no longer
seems useful.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:20 +01:00
Simon Horman
2b9aca4776 docs: debian: Remove references to installing kernel module.
Remove documentation relating to kernel module installation options for
Debian as the only option should now be to use the module supplied
by the Linux kernel.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:18 +01:00
Simon Horman
e03ccbce6f docs: backporting-patches: Remove documentation of OOT kernel module.
Remove documentation relating to backporting upstream changes to the OOT
kernel module. This turns out to be most of the documentation for kernel
changes. And I have reworked the remaining kernel datapath in the
interest of readability.

Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:12 +01:00
Simon Horman
e0c07a8a71 docs: release: Remove documentation of OOT kernel module.
Remove documentation relating to the OOT kernel module.
Support for the OOT module was removed in the v3.0 release of Open vSwitch.
And is now no longer supported by any maintained versions of Open vSwitch.

I have left the following text referring to the OOT module,
to document that is is no longer supported.

  Q: What Linux kernel versions does each Open vSwitch release work with?

    A: ...

    Building the Linux kernel module from the Open vSwitch source tree was
    deprecated starting with Open vSwitch 2.15.  And the kernel module
    source code was completely removed from the Open vSwitch source tree in
    3.0 release.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2025-05-06 11:56:08 +01:00
Eli Britstein
1015b13f05 ofproto-dpif-xlate: Add a drop action for native tunnel failure.
Upon tunnel output failure, due to routing failure for example, add an
explicit drop action, so it will appear in the dp-flows for better
visibility for that case.
For those, add additional drop reasons.

Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-30 22:41:19 +02:00
Max Lamprecht
a53d67bf93 python: idl: Clear rows without losing indexes.
Previously the complete table.rows object was recreated,
which caused the loss of custom indexes.

This behavior is now consistent with the C implementation.
See discussion [0] for more details.

[0] https://patchwork.ozlabs.org/project/openvswitch/patch/Z64R_bZhCDcYsHom@SIT-SDELAP1634.int.lidl.net/

Fixes: 13973bc41524 ("Add multi-column index support for the Python IDL")
Signed-off-by: Max Lamprecht <max.lamprecht@stackit.cloud>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-30 22:26:44 +02:00
Ilya Maximets
f1f214e5c3 ipsec: libreswan: Fix detection of loaded IPv6 connections.
The regex for loaded connections is matching on \d as a first symbol,
expecting an IP address.  But that doesn't work for IPv6 addresses
as there are likely hex symbols and not just digits.  This is causing
ovs-monitor-ipsec daemon to periodically remove established IPv6
connections thinking they are not properly loaded:

  851 | INFO | ovn-e629de-0-in-1 is half-loaded, removing
  853 | INFO | ovn-e629de-0-out-1 is half-loaded, removing
  855 | INFO | Adding ipsec connection ovn-e629de-0-in-1
  857 | INFO | Starting ipsec connection ovn-e629de-0-out-1

Fix the regex to include all the hex characters.  This is still not
great that we rely on string parsing for this, but there is currently
no better interface.

Fixes: 25a301822e0d ("ipsec: libreswan: Reconcile missing connections periodically.")
Reported-at: https://issues.redhat.com/browse/FDP-1328
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-28 10:05:09 +02:00
Stephen Finucane
e017142d1b python: Add example usage section to README.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-25 21:29:10 +02:00
Stephen Finucane
79be51b9c4 python: Populate README with minimal context.
This is very basic, but it should give enough pointers to get started.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-25 21:29:10 +02:00
Stephen Finucane
816f30b062 python: Add 'long_description' to 'setup.py'.
This means we get a nicer description on pypi.org [1]. See [2] for more
info.

[1] https://pypi.org/project/ovs/
[2] https://packaging.python.org/en/latest/guides/making-a-pypi-friendly-readme/

Signed-off-by: Stephen Finucane <stephen@that.guru>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2025-04-25 21:29:10 +02:00