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 6 commits into
base: master
Choose a base branch
from

Conversation

Kodehyrden
Copy link

This pull request should mitigate the problem described in this forum post:
https://forum.opnsense.org/index.php?topic=44083.0

It will allow the user to add a subnet to be blocked by the mDNS Repeater. The parameter is already available in the program itself.

This is my very first commit to this repository. Comments are very much welcome. FYI I have also mailed Franz Fabian, maintainer of the mDNS Repeater plugin for OPNsense.

@Kodehyrden Kodehyrden changed the title Enable blocklist parameter in the gui to allow blocking subnets. mDNS Repeater plugin: Enable blocklist parameter in the gui to allow blocking subnets. Nov 21, 2024
Copy link
Member

@Monviech Monviech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your first submission, I have left some general feedback.

@Monviech
Copy link
Member

https://github.com/geekman/mdns-repeater/releases/tag/1.11

It says here that it supports 16 addresses in a blocklist. Why is it limited to 1 in the PR?

<Default></Default>
<Required>N</Required>
</interfaces>
<ValidationMessage>Add entire subnets in CIDR notation, e.g. 192.168.1.0/24. Only one IPv4 subnet is allowed. <ValidationMessage>
<Mask>^((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])$<Mask>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using regex here. The network field has validation for IP addresses, is it not enough?

Copy link
Member

@Monviech Monviech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to know why you aren't using the code examples I gave you earlier.

It would allow for multiple networks in the same input field, with the tokenizer separating them cleanly, and commas being automatically added.

Right now I think you expect the user to input their own comma separated list?

Please improve on this concept.

<Default></Default>
<Required>N</Required>
<ValidationMessage>Please enter one or more valid IPv4 networks or individual addresses in CIDR notation.<ValidationMessage>
<NetMaskRequired>Y<NetMaskRequired>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you testing what you implement here? The xml is wrong. A few / are missing.

Please test what you do.

root@opn-ce-01:/src/git/opnsense_plugins/net/mdns-repeater # make lint
/src/git/opnsense_plugins/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml:27: parser error : Opening and ending tag mismatch: AsList line 26 and blocklist
    </blocklist>
                ^
/src/git/opnsense_plugins/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml:28: parser error : Opening and ending tag mismatch: AsList line 26 and items
  </items>
          ^
/src/git/opnsense_plugins/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml:29: parser error : Opening and ending tag mismatch: AddressFamily line 25 and model
</model>
        ^
/src/git/opnsense_plugins/net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml:30: parser error : Premature end of data in tag AddressFamily line 25

^
*** Error code 1

Stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants