Skip to content

Commit 8aed006

Browse files
committed
Update FreeBSD port
* Fix style * Fix github handling * Add LICENSE * Fix boost dependency * Add rc.d script * Install config file, handle with @sample * Install documentation * Fix hardcoded PREFIX/LOCALBASE references and other paths * Write files into /var/run/fastnetmon and /var/log/fastnetmon subdirectories, as /var/run and /var/log cannot be made writable by dedicated user This does not yet support dedicated user yet, as it would require modification of /usr/ports/{UIDs,GIDs}. This will be added when the port is committed to FreeBSD ports tree.
1 parent 86b6750 commit 8aed006

File tree

6 files changed

+116
-24
lines changed

6 files changed

+116
-24
lines changed

src/FreeBSD_port/Makefile

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
11
# $FreeBSD$
22

3-
# Created by: Pavel Odintsov pavel.odintsov@gmail.com
4-
# For fast install use pkg for boost: pkg install -y boost-all
3+
PORTNAME= fastnetmon
4+
PORTVERSION= 1.1.2
5+
DISTVERSIONPREFIX= v
6+
CATEGORIES= net-mgmt
57

6-
PORTNAME= fastnetmon
8+
MAINTAINER= pavel.odintsov@gmail.com
9+
COMMENT= Very fast DDoS analyzer with sFlow/NetFLow/IPFIX/SPAN/mirror support
710

8-
# production
9-
#PORTVERSION= 1.1.1
11+
LICENSE= GPLv2
12+
LICENSE_FILE= ${WRKSRC}/LICENSE
1013

11-
# Testing
12-
PORTVERSION= master
13-
CATEGORIES= net-mgmt
14+
LIB_DEPENDS= liblog4cpp.so:${PORTSDIR}/devel/log4cpp \
15+
libboost_regex.so:${PORTSDIR}/devel/boost-libs
1416

15-
# Testing
16-
MASTER_SITES= https://github.com/FastVPSEestiOu/fastnetmon/archive/
17-
DISTFILES= master.zip
17+
USE_GITHUB= yes
18+
GH_ACCOUNT= FastVPSEestiOu
1819

19-
# Production
20-
#MASTER_SITES= https://github.com/FastVPSEestiOu/fastnetmon/archive/
21-
#DISTFILES= v1.1.1.tar.gz
20+
# TODO: enable this after updating /usr/ports/{UIDs,GIDs}
21+
#USERS= fastnetmon
22+
#GROUPS= fastnetmon
2223

23-
MAINTAINER= Pavel Odintsov pavel.odintsov@gmail.com
24-
COMMENT= Very fast DDoS analyzer with sFlow/NetFLow/IPFIX/SPAN/mirror support
24+
USES= cmake
25+
CMAKE_SOURCE_PATH=${WRKSRC}/src
2526

26-
USES= cmake
27-
CMAKE_SOURCE_PATH= ${WRKSRC}/src
27+
USE_RC_SUBR= fastnetmon
2828

29-
LIB_DEPENDS= liblog4cpp.so:${PORTSDIR}/devel/log4cpp libboost_regex.so:${PORTSDIR}/devel/boost-all
29+
PORTDOCS= *
3030

31-
# distsum generated by call: make makesum
31+
OPTIONS_DEFINE= DOCS
32+
33+
post-patch:
34+
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/src/CMakeLists.txt
35+
@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \
36+
s|/var/run|&/fastnetmon|g; s|/var/log|&/fastnetmon|g; \
37+
s|"/etc/|"${PREFIX}/etc/|g; s|/root/fastnetmon|${DATADIR}|g' \
38+
${WRKSRC}/src/fastnetmon.conf ${WRKSRC}/src/fastnetmon.cpp
39+
40+
post-install:
41+
${MV} ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf \
42+
${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample
43+
cd ${WRKSRC} && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR}
44+
${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon
3245

3346
.include <bsd.port.mk>

src/FreeBSD_port/distinfo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SHA256 (FastVPSEestiOu-fastnetmon-v1.1.2_GH0.tar.gz) = f2c554aa402e608b9837132b17da79b49f1b998c17934344779ddc9a397261b4
2+
SIZE (FastVPSEestiOu-fastnetmon-v1.1.2_GH0.tar.gz) = 6072730
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
# PROVIDE: fastnetmon
4+
# REQUIRE: NETWORKING SERVERS LOGIN
5+
# BEFORE: securelevel
6+
# KEYWORD: shutdown
7+
8+
# Add the following line to /etc/rc.conf to enable `fastnetmon':
9+
#
10+
# fastnetmon_enable="YES"
11+
#
12+
13+
. /etc/rc.subr
14+
15+
name="fastnetmon"
16+
rcvar="${name}_enable"
17+
18+
command="%%PREFIX%%/bin/fastnetmon"
19+
pidfile="/var/run/fastnetmon/$name.pid"
20+
21+
load_rc_config "$name"
22+
23+
: ${fastnetmon_enable:="NO"}
24+
# TODO: enable this after updating /usr/ports/{UIDs,GIDs}
25+
#: ${fastnetmon_user:="fastnetmon"}
26+
: ${fastnetmon_flags:="--daemonize"}
27+
28+
run_rc_command "$1"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--- src/CMakeLists.txt.orig 2015-06-02 16:43:16 UTC
2+
+++ src/CMakeLists.txt
3+
@@ -14,8 +14,8 @@ set (Tutorial_VERSION_MAJOR 1)
4+
set (Tutorial_VERSION_MINOR 1)
5+
6+
# It's pretty safe and provide big speedup for our packet processor and patricia code
7+
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 ")
8+
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
9+
+set(CMAKE_C_FLAGS_RELEASE "-O2")
10+
+set(CMAKE_CXX_FLAGS_RELEASE "-O2")
11+
12+
set(FASTNETMON_PROFILER OFF)
13+
14+
@@ -91,11 +91,13 @@ target_link_libraries(netflow_plugin ipf
15+
add_library(pcap_plugin STATIC pcap_plugin/pcap_collector.cpp)
16+
target_link_libraries(pcap_plugin pcap)
17+
18+
+find_package(Threads)
19+
+
20+
if (ENABLE_PFRING_SUPPORT)
21+
add_library(pfring_plugin STATIC pfring_plugin/pfring_collector.cpp)
22+
target_link_libraries(pfring_plugin ${PFRING_LIBRARIES})
23+
target_link_libraries(pfring_plugin numa)
24+
- target_link_libraries(pfring_plugin pthread)
25+
+ target_link_libraries(pfring_plugin ${CMAKE_THREAD_LIBS_INIT})
26+
endif()
27+
28+
# example plugin
29+
@@ -169,7 +171,7 @@ endif()
30+
31+
target_link_libraries(fastnetmon ${LOG4CPP_LIBRARY_PATH})
32+
33+
-target_link_libraries(fastnetmon pthread)
34+
+target_link_libraries(fastnetmon ${CMAKE_THREAD_LIBS_INIT})
35+
36+
# Our libs
37+
target_link_libraries(fastnetmon patricia)
38+
@@ -217,6 +219,8 @@ endif()
39+
install(TARGETS fastnetmon DESTINATION bin)
40+
install(TARGETS fastnetmon_client DESTINATION bin)
41+
42+
+install(FILES fastnetmon.conf DESTINATION etc)
43+
+
44+
# Configure cpack package builder
45+
# Run it with: cd build; cpack -G DEB ..
46+
set(CPACK_PACKAGE_NAME "fastnetmon")

src/FreeBSD_port/pkg-descr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FastNetMon - A high performance DoS/DDoS load analyzer built on top of multiple packet capture engines (NetFlow, IPFIX, sFLOW, netmap, PF_RING, PCAP).
1+
FastNetMon - A high performance DoS/DDoS load analyzer built on top
2+
of multiple packet capture engines (NetFlow, IPFIX, sFLOW, netmap,
3+
PF_RING, PCAP).
24

3-
Author: Pavel Odintsov pavel.odintsov@gmail.com
4-
Company: FastVPS Eesti OU http://fastvps.host
5-
Site: https://github.com/FastVPSEestiOu/fastnetmon
5+
WWW: https://github.com/FastVPSEestiOu/fastnetmon

src/FreeBSD_port/pkg-plist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
bin/fastnetmon
22
bin/fastnetmon_client
3+
@sample etc/fastnetmon.conf.sample
4+
@dir /var/run/fastnetmon
5+
@dir /var/log/fastnetmon

0 commit comments

Comments
 (0)