From f1d2136024f1614f55cea76aecb67ea974379e49 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Sun, 21 Mar 2021 00:05:58 +0000 Subject: [PATCH] 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 --- net/netifyd/Makefile | 2 +- net/netifyd/files/netifyd.config | 1 + net/netifyd/files/netifyd.init | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/net/netifyd/Makefile b/net/netifyd/Makefile index 025bf26fc..e6307ca62 100644 --- a/net/netifyd/Makefile +++ b/net/netifyd/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=netifyd -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=Darryl Sokoloski PKG_LICENSE:=GPL-3.0-or-later diff --git a/net/netifyd/files/netifyd.config b/net/netifyd/files/netifyd.config index 49e1c2344..9d8d7a488 100644 --- a/net/netifyd/files/netifyd.config +++ b/net/netifyd/files/netifyd.config @@ -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)' diff --git a/net/netifyd/files/netifyd.init b/net/netifyd/files/netifyd.init index 1f7d9311a..03ccc8cfd 100644 --- a/net/netifyd/files/netifyd.init +++ b/net/netifyd/files/netifyd.init @@ -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