dns/bind: allow to specify primaryip's port for secondary zone
Closes: #4444
Notes on proposed solution
Bind/Domain.xml:
- change field type to CSVListField, adopted from net/haproxy HAProxy.xml to allow port specification
Bind/named.conf
- adjust jinja2 template instead of introducing new fields to avoid have to deal with config migrations of previous opnsense versions
- if specifying a port for a ipv6 address the following notion has to be used: [address]:port (https://en.wikipedia.org/wiki/IPv6#Address_representation)
- using negative lookbehind in regular expression to avoid matching ipv6 addresses without port
- using multiple lookbehind regular expressions since quantifiers are not allowed and ipv6 addresses can be shortened
As discussed... https://github.com/opnsense/core/commit/153d3cc267
@loopway do you know if you'll get time to re-evaluate your PR?
I'll be happy to re-evaluate my PR. I would just need a hint from @fichtner what to use instead of the regex_replace (https://github.com/opnsense/plugins/issues/4444#issuecomment-3112540194).
It's more or less the reverse of https://github.com/opnsense/core/commit/8db4d8dc330 which is about to be added, but I think the use case is too narrow for this as most support the format supplied by IPPortField. If you update the PR with the model change I'll take a look what the templating could do. For testing the regex is fine now.
I've changed the field type to IPPortField and rebased my branch.
@loopway Could you add the same changes to forwardserver?
I think we're almost there but the inplace regex_replace() should not be there. We can unwind using local variables for better readability/maintainability.
Cheers, Franco