-
Notifications
You must be signed in to change notification settings - Fork 759
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
RFC2136 RecordType Option #1457
Conversation
Ported from 'pfsense/pfsense#1578', contributed by Robert Nelson.
Ported from 'pfsense/pfsense#1578', contributed by Robert Nelson.
|
I will try to change the overview of all RFC2136 update tasks! |
|
One should keep it as simple as possible. In order to follow this idea I have added an extra check so only ip address types which should be updated are displayed in the overview table. |
src/www/services_rfc2136_edit.php
Outdated
| @@ -58,6 +58,9 @@ | |||
| $pconfig['usetcp'] = isset($a_rfc2136[$id]['usetcp']); | |||
| $pconfig['usepublicip'] = isset($a_rfc2136[$id]['usepublicip']); | |||
|
|
|||
| $pconfig['recordtype'] = $a_rfc2136[$id]['recordtype']; | |||
| if (!$pconfig['recordtype']) $pconfig['recordtype'] = "both"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For compatibility the record type should remain empty in the case of "both".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, if I did not get the point but if there is no recordtype set, you are currently updating A and AAAA records which is reflected by "both".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. the config semantics are changed here so this imposes a silent migration only when the entry is edited. we cannot guarantee this won't be problematic in the future so we need to keep the empty value as default. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will change it! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. If you need anything or have questions I'm happy to help. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fichtner I want to test my changes but there is a problem: opnsense/tools#46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a working OPNsense VM you can install the repository and upgrade from there:
# opnsense-code -a wevcode opnsense-core
# cd /usr/opnsense-core
# git checkout rfc2136-recordtype-option
# opnsense-update -t opnsense-devel
# make upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fichtner I cannot find this in the tools repository as a documentation, please add this tip for other contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of it is in the handbook: https://docs.opnsense.org/development/workflow.html
But it needs some updates on the refined tools :)
src/www/services_rfc2136_edit.php
Outdated
| <td class="vtable"> | ||
| <input name="recordtype" type="radio" value="A" <?php if ($pconfig['recordtype'] == "A") echo "checked=\"checked\""; ?> /> <?=gettext("A (IPv4)");?> | ||
| <input name="recordtype" type="radio" value="AAAA" <?php if ($pconfig['recordtype'] == "AAAA") echo "checked=\"checked\""; ?> /> <?=gettext("AAAA (IPv6)");?> | ||
| <input name="recordtype" type="radio" value="both" <?php if ($pconfig['recordtype'] == "both") echo "checked=\"checked\""; ?> /> <?=gettext("Both");?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value="" and empty($pconfig['recordtype']) is better, also the default selection should be the first in the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will remove the "values", for the second change please read my comment above.
src/etc/inc/services.inc
Outdated
| @@ -1748,7 +1748,7 @@ EOD; | |||
| $need_update = false; | |||
|
|
|||
| /* Update IPv4 if we have it. */ | |||
| if (is_ipaddrv4($wanip)) { | |||
| if (is_ipaddrv4($wanip) && $dnsupdate['recordtype'] != "AAAA") { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic works, but may not be resilient against broadening recordtype to other types, maybe:
is_ipaddrv4($wanip) && (empty($dnsupdate['recordtype']) || $dnsupdate['recordtype'] == 'A')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I see yout point. Do you think, we should rename "both" to "ALL" which represents all normal DNS records as A, AAAA (and maybe AAAAAAAA in some years)?
Any other record type has to be set by an extra configuration option as MX, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the idea, exactly. And indeed "All" sounds best for future use.
|
And BTW: thanks for working on this 👍 |
|
OpenSource: Everyone can use it, but you should also try to give something back! 👍 |
In order to provide support for additional recorytypes, 'both' is changed to 'all', which is represented by an empty value.
To provide support for additional recordtypes all checks had to be changed.
|
@fichtner Updated branch; I will test it now. 🏁 |
src/www/services_rfc2136_edit.php
Outdated
| @@ -58,6 +58,8 @@ | |||
| $pconfig['usetcp'] = isset($a_rfc2136[$id]['usetcp']); | |||
| $pconfig['usepublicip'] = isset($a_rfc2136[$id]['usepublicip']); | |||
|
|
|||
| $pconfig['recordtype'] = $a_rfc2136[$id]['recordtype']; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs something like:
$pconfig['server'] = isset($id) &&!empty($a_rfc2136[$id]['server']) ? $a_rfc2136[$id]['server'] : null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I will change it!
src/www/services_rfc2136.php
Outdated
| @@ -140,7 +140,7 @@ | |||
| <td> | |||
| <?php | |||
| $filename = "/conf/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; | |||
| if (file_exists($filename) && !empty($rfc2136['enable'])) { | |||
| if (file_exists($filename) && !empty($rfc2136['enable']) && $rfc2136['recordtype'] != "AAAA") { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same logic as in services.inc should be used here. We cannot expect it to be set, it would probably produce a warning now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that, sorry.
|
@fichtner Should be fixed! :) |
|
@fichtner Also added a help text to undestand the new 'all' option. |
|
Ready for review. |
|
Merged, thanks! |
|
Two small follow-ups committed. I think this will land in 17.1.3 next week. Thanks again. |
As explained in #1456 this PR makes it possible to control whether A, AAAA or both record types are changed when updating using RFC2136.
Tasks
Open Questions
pfSense do not changed their table overview template, so you cannot see which record types are updated. Should we add this in OPNsense as it might be useful because you do not have to open the edit page for each update task? (see discussion)