Skip to content

Commit 57dcbe5

Browse files
committed
bpfilter: add systemd service file
Configure and install a systemd service file to manage the daemon.
1 parent 86ad019 commit 57dcbe5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/bpfilter/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
find_package(PkgConfig REQUIRED)
55
pkg_check_modules(nl REQUIRED IMPORTED_TARGET libnl-3.0)
66

7+
configure_file(
8+
${CMAKE_CURRENT_SOURCE_DIR}/bpfilter.service.in
9+
${CMAKE_BINARY_DIR}/output/usr/lib/systemd/system/bpfilter.service
10+
@ONLY
11+
)
12+
713
add_executable(bpfilter
814
${CMAKE_CURRENT_SOURCE_DIR}/main.c
915
${CMAKE_CURRENT_SOURCE_DIR}/cgen/cgen.h ${CMAKE_CURRENT_SOURCE_DIR}/cgen/cgen.c
@@ -53,3 +59,9 @@ target_link_libraries(bpfilter
5359
install(TARGETS bpfilter
5460
DESTINATION ${CMAKE_INSTALL_SBINDIR}
5561
)
62+
63+
message("${CMAKE_INSTALL_PREFIX}")
64+
install(
65+
FILES ${CMAKE_BINARY_DIR}/output/usr/lib/systemd/system/bpfilter.service
66+
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system
67+
)

src/bpfilter/bpfilter.service.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=BPF-based packet filtering framework
3+
4+
[Service]
5+
ExecStart=/usr/sbin/bpfilter --no-nftables --no-iptables
6+
Restart=on-failure
7+
8+
[Install]
9+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)