The cb_bt pointer was pointing to different struct and might
have been NULL at this point. Make sure we are using the correct
pointer in the strcmp() and sbrec_bfd_set_chassis_name() call.

At the same time make sure we are actually running all tests that
do require the BFD beacon, as it was skipped in all CI stages. The
OpenBFDD project is not available as rpm, so we need to compile it
from source.

Fixes: 4885e337f929 ("rbac: Only allow relevant chassis to update BFD.")
Signed-off-by: Ales Musil <amu...@redhat.com>
---
 northd/northd.c                        |  5 ++--
 utilities/automake.mk                  |  1 +
 utilities/containers/fedora/Dockerfile | 18 ++++++++++++
 utilities/containers/openbfdd.patch    | 39 ++++++++++++++++++++++++++
 utilities/containers/ubuntu/Dockerfile | 18 ++++++++++++
 5 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 utilities/containers/openbfdd.patch

diff --git a/northd/northd.c b/northd/northd.c
index 4b39137e7..1839b7d8b 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -9804,8 +9804,9 @@ build_bfd_table(struct ovsdb_idl_txn *ovnsb_txn,
             }
             build_bfd_update_sb_conf(nb_bt, bfd_e->sb_bt);
             if (op && op->sb && op->sb->chassis &&
-                strcmp(op->sb->chassis->name, sb_bt->chassis_name)) {
-                sbrec_bfd_set_chassis_name(sb_bt, op->sb->chassis->name);
+                strcmp(op->sb->chassis->name, bfd_e->sb_bt->chassis_name)) {
+                sbrec_bfd_set_chassis_name(bfd_e->sb_bt,
+                                           op->sb->chassis->name);
             }
 
             hmap_remove(&sb_only, &bfd_e->hmap_node);
diff --git a/utilities/automake.mk b/utilities/automake.mk
index c44563c26..ebb74ec34 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -38,6 +38,7 @@ EXTRA_DIST += \
     utilities/ovndb-servers.ocf \
     utilities/checkpatch.py \
     utilities/containers/Makefile \
+    utilities/containers/openbfdd.patch \
     utilities/containers/py-requirements.txt \
     utilities/containers/fedora/Dockerfile \
     utilities/containers/ubuntu/Dockerfile \
diff --git a/utilities/containers/fedora/Dockerfile 
b/utilities/containers/fedora/Dockerfile
index 4058d7f5b..bf3c293fc 100755
--- a/utilities/containers/fedora/Dockerfile
+++ b/utilities/containers/fedora/Dockerfile
@@ -52,6 +52,24 @@ RUN git clone 
git://git.kernel.org/pub/scm/devel/sparse/sparse.git \
     && \
     make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install
 
+# Compile OpenBFDD from source
+WORKDIR /workspace/OpenBFDD
+
+COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch
+
+RUN git clone https://github.com/dyninc/OpenBFDD.git \
+    /workspace/OpenBFDD \
+    && \
+    git apply /tmp/openbfdd.patch \
+    && \
+    ./autogen.sh \
+    && \
+    ./configure --enable-silent-rules \
+    && \
+    make \
+    && \
+    make install
+
 WORKDIR /workspace
 
 COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt
diff --git a/utilities/containers/openbfdd.patch 
b/utilities/containers/openbfdd.patch
new file mode 100644
index 000000000..96e8095d9
--- /dev/null
+++ b/utilities/containers/openbfdd.patch
@@ -0,0 +1,39 @@
+diff --git a/Logger.cpp b/Logger.cpp
+index f375b20..e72afba 100755
+--- a/Logger.cpp
++++ b/Logger.cpp
+@@ -11,6 +11,8 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <time.h>
++#include <pthread.h>
+ 
+ const size_t Logger::MaxMessageLen;
+ 
+diff --git a/SchedulerBase.cpp b/SchedulerBase.cpp
+index 3eab298..c1dffc4 100755
+--- a/SchedulerBase.cpp
++++ b/SchedulerBase.cpp
+@@ -11,6 +11,8 @@
+ #include <fcntl.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <time.h>
++#include <pthread.h>
+ 
+ using namespace std;
+ 
+diff --git a/utils.cpp b/utils.cpp
+index 79c7b68..f846459 100755
+--- a/utils.cpp
++++ b/utils.cpp
+@@ -13,6 +13,8 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
++#include <time.h>
++#include <pthread.h>
+ 
+ using namespace std;
+ 
diff --git a/utilities/containers/ubuntu/Dockerfile 
b/utilities/containers/ubuntu/Dockerfile
index 5d5bedbd9..1371b3f70 100755
--- a/utilities/containers/ubuntu/Dockerfile
+++ b/utilities/containers/ubuntu/Dockerfile
@@ -51,6 +51,24 @@ RUN git clone 
git://git.kernel.org/pub/scm/devel/sparse/sparse.git \
     && \
     make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install
 
+# Compile OpenBFDD from source
+WORKDIR /workspace/OpenBFDD
+
+COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch
+
+RUN git clone https://github.com/dyninc/OpenBFDD.git \
+    /workspace/OpenBFDD \
+    && \
+    git apply /tmp/openbfdd.patch \
+    && \
+    ./autogen.sh \
+    && \
+    ./configure --enable-silent-rules \
+    && \
+    make \
+    && \
+    make install
+
 WORKDIR /workspace
 
 COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt
-- 
2.44.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to