diff mbox series

[ovs-dev] northd: Do not incrementally proccess changes for disabled LR.

Message ID 20240419145740.1338793-1-amusil@redhat.com
State Accepted
Delegated to: Dumitru Ceara
Headers show
Series [ovs-dev] northd: Do not incrementally proccess changes for disabled LR. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Ales Musil April 19, 2024, 2:57 p.m. UTC
When the logical router is disabled it is not populated in the datapaths
and is not internally available to I-P engine in the hmap. This could
lead to a crash during I-P processing:

To fix that make sure we process incrementally only LR that are enabled.

Reported-at: https://issues.redhat.com/browse/FDP-571
Signed-off-by: Ales Musil <amusil@redhat.com>
---
 northd/northd.c     | 5 +++++
 tests/ovn-northd.at | 7 +++++++
 2 files changed, 12 insertions(+)

Comments

Dumitru Ceara April 22, 2024, 9:40 p.m. UTC | #1
On 4/19/24 16:57, Ales Musil wrote:
> When the logical router is disabled it is not populated in the datapaths
> and is not internally available to I-P engine in the hmap. This could
> lead to a crash during I-P processing:
> 
> To fix that make sure we process incrementally only LR that are enabled.
> 
> Reported-at: https://issues.redhat.com/browse/FDP-571
> Signed-off-by: Ales Musil <amusil@redhat.com>
> ---

Great catch!  Applied to main, 24.03 and 23.09.

Regards,
Dumitru
diff mbox series

Patch

diff --git a/northd/northd.c b/northd/northd.c
index 37f443e70..b834f1274 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -4689,6 +4689,11 @@  fail:
 static bool
 lr_changes_can_be_handled(const struct nbrec_logical_router *lr)
 {
+    /* We can't do I-P processing when the router is disabled. */
+    if (!lrouter_is_enabled(lr)) {
+        return false;
+    }
+
     /* Check if the columns are changed in this row. */
     enum nbrec_logical_router_column_id col;
     for (col = 0; col < NBREC_LOGICAL_ROUTER_N_COLUMNS; col++) {
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index be006fb32..4f59a64db 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -11452,6 +11452,13 @@  check_engine_stats lflow recompute nocompute
 check_engine_stats sync_to_sb_lb recompute compute
 CHECK_NO_CHANGE_AFTER_RECOMPUTE
 
+check ovn-nbctl --wait=sb lr-add lr2 -- set logical_router lr2 enabled=false
+check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
+check ovn-nbctl --wait=sb lb-add lb4 10.0.0.40:4040 10.0.40.40:4050 \
+    -- lr-lb-add lr2 lb4
+check_engine_stats northd recompute nocompute
+CHECK_NO_CHANGE_AFTER_RECOMPUTE
+
 AT_CLEANUP
 ])