mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
interfaces, pass ifconfig details in dpinger+unbound, for https://github.com/opnsense/core/issues/3567
This commit is contained in:
parent
aa25ecf2ad
commit
1da07949b5
@ -101,7 +101,8 @@ function dpinger_configure_do($verbose = false, $gwname = null)
|
||||
@unlink($process['socket']);
|
||||
}
|
||||
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
$ifconfig_details = legacy_interfaces_details();
|
||||
$gateways = new \OPNsense\Routing\Gateways($ifconfig_details);
|
||||
$monitor_ips = array();
|
||||
|
||||
$dpinger_default = dpinger_defaults();
|
||||
@ -126,7 +127,7 @@ function dpinger_configure_do($verbose = false, $gwname = null)
|
||||
* $gateway['ipprotocol'] is the better option.
|
||||
*/
|
||||
if ($gateway['ipprotocol'] == "inet") { // This is an IPv4 gateway...
|
||||
$gwifip = find_interface_ip($gateway['if']);
|
||||
$gwifip = find_interface_ip($gateway['if'], $ifconfig_details);
|
||||
if (!is_ipaddrv4($gwifip)) {
|
||||
log_error(sprintf('The %s IPv4 gateway address is invalid, skipping.', $name));
|
||||
continue;
|
||||
@ -156,10 +157,10 @@ function dpinger_configure_do($verbose = false, $gwname = null)
|
||||
} elseif ($gateway['ipprotocol'] == "inet6") { // This is an IPv6 gateway...
|
||||
if (is_linklocal($gateway['monitor'])) {
|
||||
/* link local monitor needs a link local address for the "src" part */
|
||||
$gwifip = find_interface_ipv6_ll($gateway['if']);
|
||||
$gwifip = find_interface_ipv6_ll($gateway['if'], $ifconfig_details);
|
||||
} else {
|
||||
/* monitor is a routable address, so use a routable address for the "src" part */
|
||||
$gwifip = find_interface_ipv6($gateway['if']);
|
||||
$gwifip = find_interface_ipv6($gateway['if'], $ifconfig_details);
|
||||
}
|
||||
|
||||
if (!is_ipaddrv6($gwifip)) {
|
||||
|
||||
@ -171,15 +171,16 @@ EOF;
|
||||
}
|
||||
|
||||
$outgoingints = '';
|
||||
$ifconfig_details = legacy_interfaces_details();
|
||||
if (!empty($config['unbound']['outgoing_interface'])) {
|
||||
$outgoingints = "# Outgoing interfaces to be used\n";
|
||||
$outgoing_interfaces = explode(",", $config['unbound']['outgoing_interface']);
|
||||
foreach ($outgoing_interfaces as $outif) {
|
||||
$outip = get_interface_ip($outif);
|
||||
$outip = get_interface_ip($outif, $ifconfig_details);
|
||||
if (!empty($outip)) {
|
||||
$outgoingints .= "outgoing-interface: $outip\n";
|
||||
}
|
||||
$outip = get_interface_ipv6($outif);
|
||||
$outip = get_interface_ipv6($outif, $ifconfig_details);
|
||||
if (!empty($outip)) {
|
||||
$outgoingints .= "outgoing-interface: $outip\n";
|
||||
}
|
||||
@ -522,7 +523,7 @@ function unbound_add_host_entries()
|
||||
} else {
|
||||
$interfaces = array_keys(get_configured_interface_with_descr());
|
||||
}
|
||||
|
||||
$ifconfig_details = legacy_interfaces_details();
|
||||
foreach ($interfaces as $interface) {
|
||||
if ($interface == 'lo0' || substr($interface, 0, 4) == 'ovpn') {
|
||||
continue;
|
||||
@ -531,7 +532,7 @@ function unbound_add_host_entries()
|
||||
$realifv4 = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, 'inet6');
|
||||
|
||||
$laddr = find_interface_ip($realifv4);
|
||||
$laddr = find_interface_ip($realifv4, $ifconfig_details);
|
||||
if (is_ipaddrv4($laddr)) {
|
||||
$domain = $config['system']['domain'];
|
||||
if (isset($config['dhcpd'][$interface]['enable']) && !empty($config['dhcpd'][$interface]['domain'])) {
|
||||
@ -541,7 +542,7 @@ function unbound_add_host_entries()
|
||||
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$domain} A {$laddr}\"\n";
|
||||
$unbound_entries .= "local-data: \"{$config['system']['hostname']} A {$laddr}\"\n";
|
||||
}
|
||||
$laddr6 = find_interface_ipv6($realifv6);
|
||||
$laddr6 = find_interface_ipv6($realifv6, $ifconfig_details);
|
||||
if (is_ipaddrv6($laddr6)) {
|
||||
$domain = $config['system']['domain'];
|
||||
if (isset($config['dhcpdv6'][$interface]['enable']) && !empty($config['dhcpdv6'][$interface]['domain'])) {
|
||||
@ -552,7 +553,7 @@ function unbound_add_host_entries()
|
||||
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$laddr6}\"\n";
|
||||
}
|
||||
if (empty($config['unbound']['noreglladdr6'])) {
|
||||
$lladdr6 = find_interface_ipv6_ll($realifv6);
|
||||
$lladdr6 = find_interface_ipv6_ll($realifv6, $ifconfig_details);
|
||||
if (is_ipaddrv6($lladdr6)) {
|
||||
$domain = $config['system']['domain'];
|
||||
if (isset($config['dhcpdv6'][$interface]['enable']) && !empty($config['dhcpdv6'][$interface]['domain'])) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user