From 21c5a3c63fc637d5373c494a470dca35d2544147 Mon Sep 17 00:00:00 2001 From: Nimlas Date: Wed, 20 Nov 2024 20:38:03 +0100 Subject: [PATCH 01/12] Enable blocklist in the gui and to be transferred to the command line. --- net/mdns-repeater/Makefile | 2 +- net/mdns-repeater/pkg-descr | 5 +++++ .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 6 ++++++ .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 4 ++++ .../service/templates/OPNsense/MDNSRepeater/mdnsrepeater | 3 +++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/net/mdns-repeater/Makefile b/net/mdns-repeater/Makefile index 8fc5683f4a..c2d785a2de 100644 --- a/net/mdns-repeater/Makefile +++ b/net/mdns-repeater/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= mdns-repeater -PLUGIN_VERSION= 1.1 +PLUGIN_VERSION= 1.2 PLUGIN_REVISION= 1 PLUGIN_COMMENT= Proxy multicast DNS between networks PLUGIN_MAINTAINER= franz.fabian.94@gmail.com diff --git a/net/mdns-repeater/pkg-descr b/net/mdns-repeater/pkg-descr index a5ed7facd2..c02bb39a80 100644 --- a/net/mdns-repeater/pkg-descr +++ b/net/mdns-repeater/pkg-descr @@ -7,6 +7,11 @@ It can be used to bridge zeroconf devices to work properly across the two subnet Plugin Changelog ================ +1.2 + +* Blocklist support (contributed by Kodehyrden) + + 1.1 * CARP support (contributed by Markus Reiter) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index 7a565757fe..b842c50c7f 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -17,4 +17,10 @@ select_multiple At least 2 interfaces must be selected. The maximum number of supported interfaces by the daemon is 5. + + mdnsrepeater.bloklist + + text + Optionally to blacklist an entire subnet, (eg. 192.168.1.1/24). + diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 85015e3d67..3ae39f7dfa 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -16,5 +16,9 @@ Y Y + + + N + diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index 7ca779ca55..2011cdf032 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -10,6 +10,9 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% do interface_list.append(physical_interface(i)) %} {% endfor %} mdns_repeater_interfaces="{{ interface_list | join(' ') }}" +{% if helpers.exists('OPNsense.MDNSRepeater.bloklist') and OPNsense.MDNSRepeater.bloklist != '' %} +mdns_repeater_blocklist="-b " + OPNsense.MDNSRepeater.bloklist +{% endif %} {% else %} mdns_repeater_enable="NO" {% endif %} From 17bb245fc7d202810c9c431513568240797180a0 Mon Sep 17 00:00:00 2001 From: Niels Harre Date: Thu, 21 Nov 2024 20:53:40 +0000 Subject: [PATCH 02/12] Sorry for typo's. I am bit rusty in regex, but I believe this should work. --- .../OPNsense/MDNSRepeater/forms/general.xml | 2 +- .../app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 11 +++++++++-- .../templates/OPNsense/MDNSRepeater/mdnsrepeater | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index b842c50c7f..26b8207f84 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -18,7 +18,7 @@ At least 2 interfaces must be selected. The maximum number of supported interfaces by the daemon is 5. - mdnsrepeater.bloklist + mdnsrepeater.blocklist text Optionally to blacklist an entire subnet, (eg. 192.168.1.1/24). diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 3ae39f7dfa..a52b1972f3 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -16,9 +16,16 @@ Y Y - + N - + Add entire subnets in CIDR notation, e.g. 192.168.1.0/24. Only one IPv4 subnet is allowed. + ^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/([0-9]|[12][0-9]|3[0-2])$ + Y + Y + ipv4 + N + Y + diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index 2011cdf032..616d4cfc0c 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -10,8 +10,8 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% do interface_list.append(physical_interface(i)) %} {% endfor %} mdns_repeater_interfaces="{{ interface_list | join(' ') }}" -{% if helpers.exists('OPNsense.MDNSRepeater.bloklist') and OPNsense.MDNSRepeater.bloklist != '' %} -mdns_repeater_blocklist="-b " + OPNsense.MDNSRepeater.bloklist +{% if helpers.exists('OPNsense.MDNSRepeater.blocklist') and OPNsense.MDNSRepeater.blocklist != '' %} +mdns_repeater_blocklist="-b " + OPNsense.MDNSRepeater.blocklist {% endif %} {% else %} mdns_repeater_enable="NO" From 707febeee5d7540fcbe44afc999584c983461592 Mon Sep 17 00:00:00 2001 From: Niels Harre Date: Fri, 22 Nov 2024 07:54:57 +0000 Subject: [PATCH 03/12] Now supporting more subnets or individual addresses --- .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 2 +- .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 6 ++---- .../service/templates/OPNsense/MDNSRepeater/mdnsrepeater | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index 26b8207f84..e4487caec0 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -21,6 +21,6 @@ mdnsrepeater.blocklist text - Optionally to blacklist an entire subnet, (eg. 192.168.1.1/24). + Optionally to blacklist an entire subnet, (eg. 192.168.1.0/24) or individual addresses. Up to 16 subnets are supported and IPv4 subnets only. diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index a52b1972f3..9bc393fe6a 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -19,13 +19,11 @@ N - Add entire subnets in CIDR notation, e.g. 192.168.1.0/24. Only one IPv4 subnet is allowed. - ^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/([0-9]|[12][0-9]|3[0-2])$ + Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. Y Y ipv4 - N - Y + Y diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index 616d4cfc0c..dbb4f67762 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -11,7 +11,8 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% endfor %} mdns_repeater_interfaces="{{ interface_list | join(' ') }}" {% if helpers.exists('OPNsense.MDNSRepeater.blocklist') and OPNsense.MDNSRepeater.blocklist != '' %} -mdns_repeater_blocklist="-b " + OPNsense.MDNSRepeater.blocklist +{% set networkstobeblocked = "-b " + OPNsense.MDNSRepeater.blocklist.split(',') | join(' -b ') %} +mdns_repeater_blocklist="{{ networkstobeblocked }}" {% endif %} {% else %} mdns_repeater_enable="NO" From fe06b3beef6e26c73999e40d3ccfa5b46ffda7a0 Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Fri, 22 Nov 2024 17:44:17 +0100 Subject: [PATCH 04/12] Update end tag - embarrasing --- .../app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 9bc393fe6a..791bd0c8ac 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -19,11 +19,11 @@ N - Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. - Y - Y - ipv4 - Y + Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. + Y + Y + ipv4 + Y From 3a24c8e953b5f3351a484adf172d49b0f09e33f8 Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Fri, 22 Nov 2024 18:09:30 +0100 Subject: [PATCH 05/12] Added a field separator --- .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 791bd0c8ac..954db6d1a9 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -19,7 +19,8 @@ N - Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. + Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. + , Y Y ipv4 From a6cdab354459fa70f22c931ce558c07fda26ce96 Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Sun, 24 Nov 2024 08:19:56 +0100 Subject: [PATCH 06/12] Updated model and form as suggested --- .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 6 ++++-- .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index e4487caec0..709e99cd4a 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -20,7 +20,9 @@ mdnsrepeater.blocklist - text - Optionally to blacklist an entire subnet, (eg. 192.168.1.0/24) or individual addresses. Up to 16 subnets are supported and IPv4 subnets only. + select_multiple + + true + diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 954db6d1a9..383e576cb5 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -20,9 +20,7 @@ N Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. - , Y - Y ipv4 Y From e016bfee076e621c72de5ec338d70b08ba8d6d23 Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Sun, 24 Nov 2024 08:37:44 +0100 Subject: [PATCH 07/12] Remove multiple select, help text updated --- .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 4 ++-- .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index 709e99cd4a..8c07c6e3ed 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -20,9 +20,9 @@ mdnsrepeater.blocklist - select_multiple + true - + diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 383e576cb5..45c0d65fab 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -19,7 +19,7 @@ N - Please enter one or more valid IPv4 networks or individual addresses in CIDR notation. + Please enter one or more valid IPv4 networks or individual addresses including subnet. Y ipv4 Y From dffc583a7c0efa931cc00c2a4ab5c063545c52c2 Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Sun, 24 Nov 2024 08:47:41 +0100 Subject: [PATCH 08/12] More adjustments --- .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 4 ++-- .../mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index 8c07c6e3ed..8a6588fb68 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -20,8 +20,8 @@ mdnsrepeater.blocklist - - + select_multiple + true diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 45c0d65fab..189d81d034 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -22,7 +22,7 @@ Please enter one or more valid IPv4 networks or individual addresses including subnet. Y ipv4 - Y + N From 55d2b19efcd674f88c0d6caff420be0aa297f53f Mon Sep 17 00:00:00 2001 From: Kodehyrden Date: Sun, 24 Nov 2024 10:10:04 +0100 Subject: [PATCH 09/12] Form updated --- .../app/controllers/OPNsense/MDNSRepeater/forms/general.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index 8a6588fb68..f3aa4e45e9 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -21,8 +21,8 @@ mdnsrepeater.blocklist select_multiple - + true - + Enter up to 16 client IPv4 addresses including subnet or networks to be blocked. From c63d794352da66c5934b1375b0096ba75ba1923d Mon Sep 17 00:00:00 2001 From: Nimlas Date: Sun, 24 Nov 2024 15:17:39 +0100 Subject: [PATCH 10/12] Adjusted model and controller according to feedback. Changed name to blacklist to match the name used in the mdns-repeatet port --- net/mdns-repeater/pkg-descr | 2 +- .../OPNsense/MDNSRepeater/forms/general.xml | 14 +++++++------- .../OPNsense/MDNSRepeater/MDNSRepeater.xml | 17 ++++++++++------- .../OPNsense/MDNSRepeater/mdnsrepeater | 6 +++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/net/mdns-repeater/pkg-descr b/net/mdns-repeater/pkg-descr index c02bb39a80..809b066181 100644 --- a/net/mdns-repeater/pkg-descr +++ b/net/mdns-repeater/pkg-descr @@ -9,7 +9,7 @@ Plugin Changelog 1.2 -* Blocklist support (contributed by Kodehyrden) +* blacklist support (contributed by Kodehyrden) 1.1 diff --git a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml index f3aa4e45e9..4c733818b8 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml @@ -18,11 +18,11 @@ At least 2 interfaces must be selected. The maximum number of supported interfaces by the daemon is 5. - mdnsrepeater.blocklist - - select_multiple - - true - Enter up to 16 client IPv4 addresses including subnet or networks to be blocked. + mdnsrepeater.blacklist + + select_multiple + + true + Enter up to 16 client IPv4 addresses including subnet or networks to be exluded. - + \ No newline at end of file diff --git a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml index 189d81d034..4bbbcafe88 100644 --- a/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml +++ b/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml @@ -1,6 +1,5 @@ - //OPNsense/MDNSRepeater - 1.0.1 + //OPNsense/MDNSRepeater 1.0.1 mdns-repeater settings @@ -16,13 +15,17 @@ Y Y - + N - Please enter one or more valid IPv4 networks or individual addresses including subnet. + Only valid IPv4 networks or individual addresses including subnet are allowed. Y + Y ipv4 - N - + , + N + Y + N + - + \ No newline at end of file diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index dbb4f67762..8117b51714 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -10,9 +10,9 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% do interface_list.append(physical_interface(i)) %} {% endfor %} mdns_repeater_interfaces="{{ interface_list | join(' ') }}" -{% if helpers.exists('OPNsense.MDNSRepeater.blocklist') and OPNsense.MDNSRepeater.blocklist != '' %} -{% set networkstobeblocked = "-b " + OPNsense.MDNSRepeater.blocklist.split(',') | join(' -b ') %} -mdns_repeater_blocklist="{{ networkstobeblocked }}" +{% if helpers.exists('OPNsense.MDNSRepeater.blacklist') and OPNsense.MDNSRepeater.blacklist != '' %} +{% set networkstobeblocked = "-b " + OPNsense.MDNSRepeater.blacklist.split(',') | join(' -b ') %} +mdns_repeater_blacklist="{{ networkstobeblocked }}" {% endif %} {% else %} mdns_repeater_enable="NO" From 3006c9c47ac7fecf562b2d730fcecb4e55b9b35f Mon Sep 17 00:00:00 2001 From: Nimlas Date: Mon, 25 Nov 2024 09:08:16 +0100 Subject: [PATCH 11/12] Work around using existing environment variables to support blacklist. --- .../templates/OPNsense/MDNSRepeater/mdnsrepeater | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index 8117b51714..57b37e6544 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -9,10 +9,14 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% for i in osifnames %} {% do interface_list.append(physical_interface(i)) %} {% endfor %} -mdns_repeater_interfaces="{{ interface_list | join(' ') }}" +{% set repeater_interfaces = interface_list | join(' ') %} +# This is a hack to support blacklist. Ideally it should be handled in the opnsense ports collection +# but since the ports collection is pulled from other sources it would take looong and hard time to get through. {% if helpers.exists('OPNsense.MDNSRepeater.blacklist') and OPNsense.MDNSRepeater.blacklist != '' %} -{% set networkstobeblocked = "-b " + OPNsense.MDNSRepeater.blacklist.split(',') | join(' -b ') %} -mdns_repeater_blacklist="{{ networkstobeblocked }}" +{% set blacklist_and_repeater_interfaces = "-b " + OPNsense.MDNSRepeater.blacklist.split(',') | join(' -b ') + " " + repeater_interfaces %} +mdns_repeater_interfaces="{{ blacklist_and_repeater_interfaces }}" +{% else %} +mdns_repeater_interfaces="{{ repeater_interfaces }}" {% endif %} {% else %} mdns_repeater_enable="NO" From 06c5cd2a7dd689b060c19ab696dd2e1cbefe9359 Mon Sep 17 00:00:00 2001 From: Niels Harre Date: Mon, 25 Nov 2024 12:26:04 +0000 Subject: [PATCH 12/12] Removed comments - they ware being passed to the conf file... not relevant there. --- .../service/templates/OPNsense/MDNSRepeater/mdnsrepeater | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater index 57b37e6544..cada947968 100644 --- a/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater +++ b/net/mdns-repeater/src/opnsense/service/templates/OPNsense/MDNSRepeater/mdnsrepeater @@ -10,8 +10,6 @@ required_files="/var/run/mdns-repeater.CARP_MASTER" {% do interface_list.append(physical_interface(i)) %} {% endfor %} {% set repeater_interfaces = interface_list | join(' ') %} -# This is a hack to support blacklist. Ideally it should be handled in the opnsense ports collection -# but since the ports collection is pulled from other sources it would take looong and hard time to get through. {% if helpers.exists('OPNsense.MDNSRepeater.blacklist') and OPNsense.MDNSRepeater.blacklist != '' %} {% set blacklist_and_repeater_interfaces = "-b " + OPNsense.MDNSRepeater.blacklist.split(',') | join(' -b ') + " " + repeater_interfaces %} mdns_repeater_interfaces="{{ blacklist_and_repeater_interfaces }}"