softflowd: add traffic capture filter
authorJesus Fernandez Manzano <jesus.manzano@galgus.net>
Tue, 26 Apr 2022 10:10:23 +0000 (12:10 +0200)
committerRosen Penev <rosenp@gmail.com>
Tue, 17 May 2022 02:32:09 +0000 (19:32 -0700)
softflowd can filter the traffic with an optional bpf program,
specified on the command-line as a BPF expression

Signed-off-by: Jesus Fernandez Manzano <jesus.manzano@galgus.net>
net/softflowd/Makefile
net/softflowd/files/softflowd.config
net/softflowd/files/softflowd.init

index 3e966e4956178e4df104b4a19882594666eca358..347e0b744b68ba2b6b0376d778c5b719bc9eec92 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=softflowd
 PKG_VERSION:=1.0.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/irino/softflowd/tar.gz/softflowd-$(PKG_VERSION)?
index 61a2ee4609573067a609e4de85f6427363d268e9..87dbf1369a1e5cb7f4c17ca0dc7696c46d1bcce1 100644 (file)
@@ -12,3 +12,4 @@ config softflowd
        option tracking_level 'full'
        option track_ipv6     '0'
        option sampling_rate  '100'
+       option filter         ''
index 3f1c5f8aa36fd28e1a735b7e637c721eea047b6d..1fdd9ae30303482a0e0eb6abf985721e8f9044f8 100755 (executable)
@@ -29,6 +29,7 @@ start_instance() {
        [ "$enabled" -gt 0 ] || return 1
 
        config_get pid_file "$section" 'pid_file'
+       config_get filter "$section" 'filter'
 
        args=""
        append_string "$section" 'interface' '-i'
@@ -45,7 +46,7 @@ start_instance() {
        append_bool "$section" track_ipv6 '-6'
 
        procd_open_instance
-       procd_set_param command /usr/sbin/softflowd -d $args${pid_file:+ -p $pid_file}
+       procd_set_param command /usr/sbin/softflowd -d $args${pid_file:+ -p $pid_file} "$filter"
        procd_set_param respawn
        procd_close_instance
 }