From 180fa58c413ef38a0c517a4f67046fe34203bcd9 Mon Sep 17 00:00:00 2001 From: jmachado Date: Sat, 1 Nov 2025 17:32:49 +0000 Subject: [PATCH 1/4] add bngblaster --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a8beeed..f065aa8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,39 @@ FROM alpine:3.18.6 AS builder RUN apk update && apk add --virtual .build-deps \ - build-base gcc wget - + build-base gcc wget cmake cunit-dev libpcap-dev \ + ncurses-dev openssl-dev jansson-dev numactl-dev \ + libbsd-dev linux-headers + +#Install bngblaster from source +RUN mkdir /bngblaster +WORKDIR /bngblaster +RUN wget https://github.com/rtbrick/libdict/archive/refs/tags/1.0.4.zip +RUN unzip 1.0.4.zip +RUN mkdir libdict-1.0.4/build +WORKDIR /bngblaster/libdict-1.0.4/build +RUN cmake .. +RUN make -j16 install +WORKDIR /bngblaster +RUN wget https://github.com/rtbrick/bngblaster/archive/refs/tags/0.9.26.zip +RUN unzip 0.9.26.zip +RUN mkdir bngblaster-0.9.26/build +WORKDIR /bngblaster/bngblaster-0.9.26/build +#remove redundant include to avoid preprocessor redirect warning and consequent compilation failure +RUN sed -i '/#include /d' ../code/lwip/contrib/ports/unix/port/netif/sio.c +#typedef for uint to avoid compilation error on alpine musl libc +RUN sed -i '$i typedef unsigned int uint;' ../code/common/src/common.h +# add include to support be32toh and htobe32 on alpine musl libc +RUN sed -i '/#include /i #include ' ../code/common/src/common.h +#replace __time_t with time_t to make it compatible with alpine musl libc +RUN find /bngblaster/bngblaster-0.9.26/code/ -type f \( -name "*.c" -o -name "*.h" \) -exec sed -i 's/\b__time_t\b/time_t/g' {} + +#Don't error on sequence-point errors to allow build to complete on musl libc. Ideally code should be fixed on upstream repo. +RUN sed -i 's/APPEND CMAKE_C_FLAGS "-pthread"/APPEND CMAKE_C_FLAGS "-pthread -Wno-error=sequence-point"/' ../code/bngblaster/CMakeLists.txt +RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=0.9.26 .. +RUN make install + +# Install mcjoin from source +WORKDIR / RUN wget https://github.com/troglobit/mcjoin/releases/download/v2.12/mcjoin-2.12.tar.gz RUN tar -xzf mcjoin-2.12.tar.gz WORKDIR /mcjoin-2.12 @@ -45,6 +76,12 @@ RUN tar -C /usr/local/gobgp -xzf gobgp_3.25.0_linux_amd64.tar.gz RUN cp /usr/local/gobgp/gobgp* /usr/bin/ COPY --from=builder /usr/local/bin/mcjoin /usr/local/bin/ +COPY --from=builder /usr/sbin/bngblaster-cli /usr/sbin/ +COPY --from=builder /usr/bin/bgpupdate /usr/bin/ +COPY --from=builder /usr/bin/ldpupdate /usr/bin/ +COPY --from=builder /usr/sbin/bngblaster /usr/sbin/ +COPY --from=builder /usr/sbin/lspgen /usr/sbin/ +RUN mkdir /run/lock RUN rm /etc/motd From 12eebe85894f7c0898daf8cdab85cc48e1ada0e9 Mon Sep 17 00:00:00 2001 From: jmachado Date: Sat, 1 Nov 2025 19:22:12 +0000 Subject: [PATCH 2/4] bngblaster dependencies --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f065aa8..40f6895 100644 --- a/Dockerfile +++ b/Dockerfile @@ -75,13 +75,16 @@ RUN mkdir -p /usr/local/gobgp RUN tar -C /usr/local/gobgp -xzf gobgp_3.25.0_linux_amd64.tar.gz RUN cp /usr/local/gobgp/gobgp* /usr/bin/ +# mcjoin binary COPY --from=builder /usr/local/bin/mcjoin /usr/local/bin/ +# bngblaster binaries and dependencies +RUN apk add ncurses openssl jansson +RUN mkdir /run/lock COPY --from=builder /usr/sbin/bngblaster-cli /usr/sbin/ COPY --from=builder /usr/bin/bgpupdate /usr/bin/ COPY --from=builder /usr/bin/ldpupdate /usr/bin/ COPY --from=builder /usr/sbin/bngblaster /usr/sbin/ COPY --from=builder /usr/sbin/lspgen /usr/sbin/ -RUN mkdir /run/lock RUN rm /etc/motd From 0406c65d6569cdc076ab1cac159664fe443d8d7e Mon Sep 17 00:00:00 2001 From: jmachado Date: Sun, 2 Nov 2025 10:17:11 +0000 Subject: [PATCH 3/4] bngblaster: move install steps to a script --- Dockerfile | 28 +++------------------------- install-bngblaster.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 install-bngblaster.sh diff --git a/Dockerfile b/Dockerfile index 40f6895..688c403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,31 +6,9 @@ RUN apk update && apk add --virtual .build-deps \ libbsd-dev linux-headers #Install bngblaster from source -RUN mkdir /bngblaster -WORKDIR /bngblaster -RUN wget https://github.com/rtbrick/libdict/archive/refs/tags/1.0.4.zip -RUN unzip 1.0.4.zip -RUN mkdir libdict-1.0.4/build -WORKDIR /bngblaster/libdict-1.0.4/build -RUN cmake .. -RUN make -j16 install -WORKDIR /bngblaster -RUN wget https://github.com/rtbrick/bngblaster/archive/refs/tags/0.9.26.zip -RUN unzip 0.9.26.zip -RUN mkdir bngblaster-0.9.26/build -WORKDIR /bngblaster/bngblaster-0.9.26/build -#remove redundant include to avoid preprocessor redirect warning and consequent compilation failure -RUN sed -i '/#include /d' ../code/lwip/contrib/ports/unix/port/netif/sio.c -#typedef for uint to avoid compilation error on alpine musl libc -RUN sed -i '$i typedef unsigned int uint;' ../code/common/src/common.h -# add include to support be32toh and htobe32 on alpine musl libc -RUN sed -i '/#include /i #include ' ../code/common/src/common.h -#replace __time_t with time_t to make it compatible with alpine musl libc -RUN find /bngblaster/bngblaster-0.9.26/code/ -type f \( -name "*.c" -o -name "*.h" \) -exec sed -i 's/\b__time_t\b/time_t/g' {} + -#Don't error on sequence-point errors to allow build to complete on musl libc. Ideally code should be fixed on upstream repo. -RUN sed -i 's/APPEND CMAKE_C_FLAGS "-pthread"/APPEND CMAKE_C_FLAGS "-pthread -Wno-error=sequence-point"/' ../code/bngblaster/CMakeLists.txt -RUN cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=0.9.26 .. -RUN make install +COPY install-bngblaster.sh / +RUN chmod +x /install-bngblaster.sh +RUN /install-bngblaster.sh # Install mcjoin from source WORKDIR / diff --git a/install-bngblaster.sh b/install-bngblaster.sh new file mode 100644 index 0000000..6b95b68 --- /dev/null +++ b/install-bngblaster.sh @@ -0,0 +1,26 @@ +#!/bin/sh +mkdir /bngblaster +cd /bngblaster +wget https://github.com/rtbrick/libdict/archive/refs/tags/1.0.4.zip +unzip 1.0.4.zip +mkdir libdict-1.0.4/build +cd /bngblaster/libdict-1.0.4/build +cmake .. +make -j16 install +cd /bngblaster +wget https://github.com/rtbrick/bngblaster/archive/refs/tags/0.9.26.zip +unzip 0.9.26.zip +mkdir bngblaster-0.9.26/build +cd /bngblaster/bngblaster-0.9.26/build +#remove redundant include to avoid preprocessor redirect warning and consequent compilation failure +sed -i '/#include /d' ../code/lwip/contrib/ports/unix/port/netif/sio.c +#typedef for uint to avoid compilation error on alpine musl libc +sed -i '$i typedef unsigned int uint;' ../code/common/src/common.h +# add include to support be32toh and htobe32 on alpine musl libc +sed -i '/#include /i #include ' ../code/common/src/common.h +#replace __time_t with time_t to make it compatible with alpine musl libc +find /bngblaster/bngblaster-0.9.26/code/ -type f \( -name "*.c" -o -name "*.h" \) -exec sed -i 's/\b__time_t\b/time_t/g' {} + +#Don't error on sequence-point errors to allow build to complete on musl libc. Ideally code should be fixed on upstream repo. +sed -i 's/APPEND CMAKE_C_FLAGS "-pthread"/APPEND CMAKE_C_FLAGS "-pthread -Wno-error=sequence-point"/' ../code/bngblaster/CMakeLists.txt +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=0.9.26 .. +make install \ No newline at end of file From b286f72084c7c8c38150e06d332406a6c84c429e Mon Sep 17 00:00:00 2001 From: jmachado Date: Mon, 3 Nov 2025 09:16:05 +0000 Subject: [PATCH 4/4] bngblaster-install: hold version in variable --- install-bngblaster.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/install-bngblaster.sh b/install-bngblaster.sh index 6b95b68..2d9b1c5 100644 --- a/install-bngblaster.sh +++ b/install-bngblaster.sh @@ -1,17 +1,19 @@ #!/bin/sh +LIBDICT_VERSION="1.0.4" +BNGBLASTER_VERSION="0.9.26" mkdir /bngblaster cd /bngblaster -wget https://github.com/rtbrick/libdict/archive/refs/tags/1.0.4.zip -unzip 1.0.4.zip -mkdir libdict-1.0.4/build -cd /bngblaster/libdict-1.0.4/build +wget https://github.com/rtbrick/libdict/archive/refs/tags/$LIBDICT_VERSION.zip +unzip $LIBDICT_VERSION.zip +mkdir libdict-$LIBDICT_VERSION/build +cd /bngblaster/libdict-$LIBDICT_VERSION/build cmake .. make -j16 install cd /bngblaster -wget https://github.com/rtbrick/bngblaster/archive/refs/tags/0.9.26.zip -unzip 0.9.26.zip -mkdir bngblaster-0.9.26/build -cd /bngblaster/bngblaster-0.9.26/build +wget https://github.com/rtbrick/bngblaster/archive/refs/tags/$BNGBLASTER_VERSION.zip +unzip $BNGBLASTER_VERSION.zip +mkdir bngblaster-$BNGBLASTER_VERSION/build +cd /bngblaster/bngblaster-$BNGBLASTER_VERSION/build #remove redundant include to avoid preprocessor redirect warning and consequent compilation failure sed -i '/#include /d' ../code/lwip/contrib/ports/unix/port/netif/sio.c #typedef for uint to avoid compilation error on alpine musl libc @@ -22,5 +24,5 @@ sed -i '/#include /i #include ' ../code/common/src/common.h find /bngblaster/bngblaster-0.9.26/code/ -type f \( -name "*.c" -o -name "*.h" \) -exec sed -i 's/\b__time_t\b/time_t/g' {} + #Don't error on sequence-point errors to allow build to complete on musl libc. Ideally code should be fixed on upstream repo. sed -i 's/APPEND CMAKE_C_FLAGS "-pthread"/APPEND CMAKE_C_FLAGS "-pthread -Wno-error=sequence-point"/' ../code/bngblaster/CMakeLists.txt -cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=0.9.26 .. +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=$BNGBLASTER_VERSION .. make install \ No newline at end of file