Commit 54704d05 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) fix for https://github.com/opnsense/core/issues/400, missing...

(legacy) fix for https://github.com/opnsense/core/issues/400, missing "Interface address" option in translation/target
parent 1b678658
...@@ -234,7 +234,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -234,7 +234,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
// target ip/net // target ip/net
if (!array_key_exists($pconfig['targetip'], formTranslateAddresses())) { if (empty($pconfig['targetip'])) {
// empty target "Interface address"
$natent['target'] = $pconfig['targetip'] ;
$natent['targetip_subnet'] = 0;
$natent['target'] = $pconfig['targetip'] ;
} elseif (!array_key_exists($pconfig['targetip'], formTranslateAddresses())) {
// a bit vague behaviour in "target" and "targetip", if a custom net is given // a bit vague behaviour in "target" and "targetip", if a custom net is given
// the backend code wants target to be filled with "other-subnet". // the backend code wants target to be filled with "other-subnet".
// if any other known net is given, target is used to provide the actual address.... // if any other known net is given, target is used to provide the actual address....
...@@ -564,6 +569,7 @@ include("head.inc"); ...@@ -564,6 +569,7 @@ include("head.inc");
<tr> <tr>
<td> <td>
<select name="targetip" id="targetip" class="selectpicker" data-live-search="true" data-size="5" data-width="auto"> <select name="targetip" id="targetip" class="selectpicker" data-live-search="true" data-size="5" data-width="auto">
<option data-other=true value="" <?= empty($pconfig['targetip']) ? "selected=\"selected\"" : "";?> > <?=gettext("Interface address");?> </option>
<option data-other=true value="<?=$pconfig['targetip'];?>" <?= !empty($pconfig['target']) && !array_key_exists($pconfig['targetip'], formTranslateAddresses() ) ? "selected=\"selected\"" : "";?>><?=gettext("Single host or Network"); ?></option> <option data-other=true value="<?=$pconfig['targetip'];?>" <?= !empty($pconfig['target']) && !array_key_exists($pconfig['targetip'], formTranslateAddresses() ) ? "selected=\"selected\"" : "";?>><?=gettext("Single host or Network"); ?></option>
<? foreach (formTranslateAddresses() as $optKey => $optValue): <? foreach (formTranslateAddresses() as $optKey => $optValue):
?> ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment