netifyd: support filter parameter

netifyd supports a '-F' filter option in 'bpf' notation to filter
packets from its consideration.

Add support for a uci 'filter' option. eg. filter to exclude SSDP
multicasts from a particularly noisy device:

option filter 'not (udp and dst 239.255.255.250 and dst port 1900 and src 192.168.1.5)'

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
This commit is contained in:
Kevin Darbyshire-Bryant 2021-03-21 00:05:58 +00:00 committed by Rosen Penev
parent 6c9627b45d
commit f1d2136024
3 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifyd
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_MAINTAINER:=Darryl Sokoloski <darryl@egloo.ca>
PKG_LICENSE:=GPL-3.0-or-later

View File

@ -3,3 +3,4 @@ config netifyd
option autoconfig 1
# option internal_if 'eth0'
# option external_if 'eth1'
# option filter 'not (udp and dst 239.255.255.250 and dst port 1900 and src 192.168.1.5)'

View File

@ -21,6 +21,7 @@ start_netifyd() {
[ ! -d /var/run/netifyd ] && mkdir -p /var/run/netifyd
config_get_bool autoconfig "$instance" autoconfig 1
config_get filter "$instance" filter
if [ "$autoconfig" -gt 0 ] ; then
source /usr/share/netifyd/functions.sh
@ -33,8 +34,10 @@ start_netifyd() {
NETIFYD_OPTS="-E $external_if -I $internal_if"
fi
procd_open_instance
procd_set_param command $PROG -R $NETIFYD_OPTS
[ -n "$filter" ] && procd_append_param command -F "$filter"
procd_set_param file /etc/netifyd.conf
procd_set_param respawn
procd_close_instance