From 2cb591d10249e3ad6e0539438105535e05b21b78 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Thu, 31 Oct 2024 04:52:23 +0000 Subject: [PATCH] base: compile OpenBFDD locally Signed-off-by: zhangzujian --- dist/images/Dockerfile.base | 23 +++++++++++++----- dist/images/OpenBFDD-compile.patch | 39 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 dist/images/OpenBFDD-compile.patch diff --git a/dist/images/Dockerfile.base b/dist/images/Dockerfile.base index 64b28d142a0..d8d91aebda8 100644 --- a/dist/images/Dockerfile.base +++ b/dist/images/Dockerfile.base @@ -82,7 +82,22 @@ RUN cd /usr/src/ovn && \ if [ "$ARCH" = "amd64" ] && [ "$LEGACY" != "true" ]; then CONFIGURE_OPTS="--with-ovs-build=/usr/src/ovs/_debian CFLAGS='-O2 -g -msse4.2 -mpopcnt -fPIC'"; fi && \ OVSDIR=/usr/src/ovs EXTRA_CONFIGURE_OPTS=$CONFIGURE_OPTS DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary +RUN mkdir -p /usr/src/openbfdd && \ + curl -sSf -L --retry 5 https://github.com/dyninc/OpenBFDD/archive/e35f43ad8d2b3f084e96a84c392528a90d05a287.tar.gz | \ + tar -xz -C /usr/src/openbfdd --strip-components=1 + +ADD OpenBFDD-compile.patch /usr/src/ + +RUN cd /usr/src/openbfdd && \ + rm -vf missing && \ + git apply --no-apply /usr/src/OpenBFDD-compile.patch && \ + autoupdate && \ + ./autogen.sh && \ + ./configure --enable-silent-rules && \ + make + RUN mkdir /packages/ && \ + mv /usr/src/openbfdd/bfdd-beacon /usr/src/openbfdd/bfdd-control /packages/ && \ cp /usr/src/openvswitch-*deb /packages && \ cp /usr/src/python3-openvswitch*deb /packages && \ cp /usr/src/ovn-*deb /packages && \ @@ -143,12 +158,6 @@ ARG DUMB_INIT_VERSION="1.2.5" RUN curl -sSf -L --retry 5 -o /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_$(arch) && \ chmod +x /usr/bin/dumb-init -ARG BFDD_VERSION="v0.5.5" -RUN curl -sSf -L --retry 3 -o /usr/local/bin/bfdd-control https://github.com/bobz965/bfd-binary-for-kube-ovn-cni/releases/download/${BFDD_VERSION}/bfdd-control-linux-$(arch) && \ - curl -sSf -L --retry 3 -o /usr/local/bin/bfdd-beacon https://github.com/bobz965/bfd-binary-for-kube-ovn-cni/releases/download/${BFDD_VERSION}/bfdd-beacon-linux-$(arch) && \ - chmod +x /usr/local/bin/bfdd-control /usr/local/bin/bfdd-beacon && \ - setcap CAP_NET_BIND_SERVICE+eip $(readlink -f $(which bfdd-beacon)) - RUN --mount=type=bind,target=/godeps,from=go-deps,source=/godeps \ cp /godeps/loopback /godeps/portmap /godeps/macvlan ./ && \ cp /godeps/kubectl /godeps/gobgp /usr/bin/ @@ -156,6 +165,8 @@ RUN --mount=type=bind,target=/godeps,from=go-deps,source=/godeps \ ARG DEBUG=false RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \ + cp /packages/bfdd-beacon /packages/bfdd-control /usr/bin/ && \ + setcap CAP_NET_BIND_SERVICE+eip /usr/bin/bfdd-beacon && \ dpkg -i /packages/openvswitch-*.deb /packages/python3-openvswitch*.deb && \ dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb && \ rm -rf /var/lib/openvswitch/pki/ && \ diff --git a/dist/images/OpenBFDD-compile.patch b/dist/images/OpenBFDD-compile.patch new file mode 100644 index 00000000000..96e8095d940 --- /dev/null +++ b/dist/images/OpenBFDD-compile.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 + #include + #include ++#include ++#include + + 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 + #include + #include ++#include ++#include + + 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 + #include + #include ++#include ++#include + + using namespace std; +