netifyd: support filter parameter
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Sun, 21 Mar 2021 00:05:58 +0000 (00:05 +0000)
committerRosen Penev <rosenp@gmail.com>
Sun, 4 Apr 2021 01:40:54 +0000 (18:40 -0700)
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>
net/netifyd/Makefile
net/netifyd/files/netifyd.config
net/netifyd/files/netifyd.init

index 025bf26fc8a63cb91030d423d91952a9dadfa5b2..e6307ca620a941e4f14b7c29fc58e8169893c4a1 100644 (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
 
index 49e1c23449ae1896eb6671aa6a12958bf50485fc..9d8d7a4881091e740e32ef9230163c831d9e33e0 100644 (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)'
index 1f7d9311a280477f3401e0e3600f0933fc02be7d..03ccc8cfd6f209b7a9b8d377163b242abaf0d90b 100644 (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