Skip to content

Commit

Permalink
unbound: also pick up link-local IPv6 and remove localhost
Browse files Browse the repository at this point in the history
The other code does more or less the same, but it seems that
a lot needs to be cleaned up still...

PR: https://forum.opnsense.org/index.php?topic=3311.0
  • Loading branch information
fichtner committed Aug 5, 2016
1 parent 49e364b commit 0dca6ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/etc/inc/system.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ function system_arp_wrong_if()
));
}

function get_possible_listen_ips($include_ipv6_link_local=false) {
function get_possible_listen_ips($include_ipv6_link_local = false, $include_loopback = true) {
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
$listenips = array();
Expand All @@ -1796,9 +1796,11 @@ function get_possible_listen_ips($include_ipv6_link_local=false) {
}
}
}
$tmp["name"] = "Localhost";
$tmp["value"] = "lo0";
$listenips[] = $tmp;
if ($include_loopback) {
$tmp["name"] = "Localhost";
$tmp["value"] = "lo0";
$listenips[] = $tmp;
}
return $listenips;
}

Expand Down
5 changes: 5 additions & 0 deletions src/etc/inc/unbound.inc
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ function unbound_add_host_entries()
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} AAAA {$laddr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$laddr6}\"\n";
}
$lladdr6 = find_interface_ipv6_ll($if);
if (is_ipaddrv6($lladdr6)) {
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} AAAA {$lladdr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$lladdr6}\"\n";
}
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/www/services_unbound.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,8 @@
<select name="active_interface[]" multiple="multiple" size="3" class="selectpicker" data-live-search="true">
<option value="" <?=empty($pconfig['active_interface'][0]) ? 'selected="selected"' : ""; ?>><?=gettext("All");?></option>
<?php
foreach (get_possible_listen_ips(true) as $laddr):?>
<option value="<?=$laddr['value'];?>" <?=in_array($laddr['value'], $pconfig['active_interface']) ? 'selected="selected"' : "";?>>
<?=htmlspecialchars($laddr['name']);?>
</option>
foreach (get_possible_listen_ips(false, false) as $laddr):?>
<option value="<?=$laddr['value'];?>" <?=in_array($laddr['value'], $pconfig['active_interface']) ? 'selected="selected"' : "";?>><?=htmlspecialchars($laddr['name']);?></option>
<?php
endforeach; ?>
</select>
Expand Down

0 comments on commit 0dca6ed

Please sign in to comment.