Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mDNS Repeater plugin: Enable blocklist parameter in the gui to allow blocking subnets. #4362

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion net/mdns-repeater/Makefile
Original file line number Diff line number Diff line change
@@ -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= [email protected]
Expand Down
5 changes: 5 additions & 0 deletions net/mdns-repeater/pkg-descr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ It can be used to bridge zeroconf devices to work properly across the two subnet
Plugin Changelog
================

1.2

* blacklist support (contributed by Kodehyrden)


1.1

* CARP support (contributed by Markus Reiter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
<type>select_multiple</type>
<help>At least 2 interfaces must be selected. The maximum number of supported interfaces by the daemon is 5.</help>
</field>
</form>
<field>
<id>mdnsrepeater.blacklist</id>
<label>Black List</label>
<type>select_multiple</type>
<style>tokenize</style>
<allownew>true</allownew>
<help>Enter up to 16 client IPv4 addresses including subnet or networks to be exluded.</help>
</field>
</form>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<model>
<mount>//OPNsense/MDNSRepeater</mount>
<version>1.0.1</version>
<mount>//OPNsense/MDNSRepeater</mount> <version>1.0.1</version>
<description>mdns-repeater settings</description>
<items>
<enabled type="BooleanField">
Expand All @@ -16,5 +15,17 @@
<Required>Y</Required>
<Multiple>Y</Multiple>
</interfaces>
<blacklist type="NetworkField">
<Default></Default>
<Required>N</Required>
<ValidationMessage>Only valid IPv4 networks or individual addresses including subnet are allowed.</ValidationMessage>
<NetMaskRequired>Y</NetMaskRequired>
<NetMaskAllowed>Y</NetMaskAllowed>
<AddressFamily>ipv4</AddressFamily>
<FieldSeparator>,</FieldSeparator>
<WildcardEnabled>N</WildcardEnabled>
<AsList>Y</AsList>
<Strict>N</Strict>
</blacklist>
</items>
</model>
</model>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ 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 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"
{% endif %}