Skip to content

Commit 68103ba

Browse files
committed
[firewall] build the nftables backend in CI
Nothing in CI configured -DOTBR_NFTABLES=ON, so the libnftnl/libmnl backend was never compiled there. Only the FirewallManager policy layer and its tests were covered, because those targets are built unconditionally; nftables_impl.cpp was not. Add a check job that builds with the backend enabled and runs the test suite, so the netlink code is compiled and the firewall tests run in the configuration they describe. script/bootstrap already installs libnftnl/libmnl, so no bootstrap change is needed. Assisted-By: Claude Opus 4.8
1 parent 1d1e5a4 commit 68103ba

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,32 @@ jobs:
9898
- name: Codecov
9999
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
100100

101+
nftables-check:
102+
runs-on: ubuntu-22.04
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
build_type: ["Debug", "Release"]
107+
env:
108+
BUILD_TARGET: check
109+
OTBR_BUILD_TYPE: ${{ matrix.build_type }}
110+
OTBR_MDNS: openthread
111+
OTBR_OPTIONS: "-DOTBR_NFTABLES=ON -DOT_FIREWALL=OFF -DBUILD_TESTING=ON"
112+
steps:
113+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
114+
with:
115+
submodules: recursive
116+
- name: Bootstrap
117+
run: tests/scripts/bootstrap.sh
118+
# Build only: this compiles nftables_impl.cpp, which no other job does.
119+
- name: Build
120+
run: script/test build
121+
# The firewall unit tests mock the backend, so they need no privileges. The
122+
# rest of the suite launches otbr-agent, which cannot install nftables rules
123+
# without CAP_NET_ADMIN and a usable nf_tables, so it is not run here.
124+
- name: Firewall unit tests
125+
run: CTEST_OUTPUT_ON_FAILURE=1 ctest --test-dir build/otbr -R Firewall
126+
101127
script-check:
102128
runs-on: ubuntu-22.04
103129
env:

tests/scripts/bootstrap.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ install_common_dependencies()
6363
coreutils \
6464
git \
6565
libprotobuf-dev \
66-
protobuf-compiler
66+
protobuf-compiler \
67+
libnftnl-dev \
68+
libmnl-dev
6769
}
6870

6971
install_openthread_binraries()

0 commit comments

Comments
 (0)