mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
interfaes: move magic /tmp/devX_pdinfo handling away from GUI page
While here separate between IPv4 and IPv6 reload (again?) and rename the PINFO variable to PDINFO for consistency.
This commit is contained in:
parent
b62ba73968
commit
feba63b664
@ -3002,10 +3002,10 @@ function interface_dhcpv6_prepare($interface = 'wan', $wancfg, $linkdownevent =
|
||||
}
|
||||
|
||||
$dhcp6cscript = "#!/bin/sh\n";
|
||||
$dhcp6cscript .= "if [ -z \"\${PINFO}\" ]; then\n";
|
||||
$dhcp6cscript .= "if [ -z \"\${PDINFO}\" ]; then\n";
|
||||
$dhcp6cscript .= "\trm -f /tmp/{$wanif}_pdinfo\n";
|
||||
$dhcp6cscript .= "else\n";
|
||||
$dhcp6cscript .= "\techo \${PINFO} > /tmp/{$wanif}_pdinfo\n";
|
||||
$dhcp6cscript .= "\techo \${PDINFO} > /tmp/{$wanif}_pdinfo\n";
|
||||
$dhcp6cscript .= "fi\n";
|
||||
$dhcp6cscript .= "if [ -n '" . (!empty($syscfg['dhcp6_debug']) ? 'debug' : '') . "' ]; then\n";
|
||||
$dhcp6cscript .= "\t/usr/bin/logger -t dhcp6c \"dhcp6c \$REASON on {$wanif}\"\n";
|
||||
@ -4154,20 +4154,25 @@ function interfaces_staticarp_configure($if)
|
||||
}
|
||||
}
|
||||
|
||||
//returns interface information
|
||||
function get_interfaces_info()
|
||||
{
|
||||
global $config;
|
||||
$result = array();
|
||||
|
||||
$all_intf_details = legacy_interfaces_details();
|
||||
$all_intf_stats = legacy_interface_stats();
|
||||
$gateways = new \OPNsense\Routing\Gateways($all_intf_details);
|
||||
$ifup = legacy_interface_listget('up');
|
||||
$all_intf_stats = legacy_interface_stats();
|
||||
foreach (legacy_config_get_interfaces(array("virtual" => false)) as $ifdescr => $ifcnf) {
|
||||
$result = array();
|
||||
|
||||
foreach (legacy_config_get_interfaces(array('virtual' => false)) as $ifdescr => $ifcnf) {
|
||||
$ifinfo = array();
|
||||
/* XXX apparently we ignore a different IPv6 realif completely... */
|
||||
|
||||
$ifinfo['if'] = get_real_interface($ifdescr);
|
||||
$ifinfo['ifv6'] = get_real_interface($ifdescr, 'inet6');
|
||||
|
||||
$ifinfo['status'] = (is_array($ifup) && in_array($ifinfo['if'], $ifup)) ? 'up' : 'down';
|
||||
$ifinfo['statusv6'] = (is_array($ifup) && in_array($ifinfo['ifv6'], $ifup)) ? 'up' : 'down';
|
||||
|
||||
if (!empty($all_intf_details[$ifinfo['if']])) {
|
||||
if (
|
||||
isset($all_intf_details[$ifinfo['if']]['status']) &&
|
||||
@ -4178,6 +4183,7 @@ function get_interfaces_info()
|
||||
$ifinfo = array_merge($ifinfo, $all_intf_details[$ifinfo['if']]);
|
||||
}
|
||||
|
||||
/* XXX apparently we ignore a different IPv6 realif completely... */
|
||||
if (!empty($ifinfo['ipv6'])) {
|
||||
/* XXX ... so avoid intermediate breakage by using IPv4 realif here */
|
||||
list ($primary6, $unused, $subnet6) = interfaces_primary_address6($ifdescr, $ifinfo['if'], $all_intf_details);
|
||||
@ -4194,11 +4200,18 @@ function get_interfaces_info()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($ifinfo['ipv4'])) {
|
||||
$ifinfo['ipaddr'] = $ifinfo['ipv4'][0]['ipaddr'];
|
||||
$ifinfo['subnet'] = $ifinfo['ipv4'][0]['subnetbits'];
|
||||
}
|
||||
|
||||
/* XXX there are more magic files */
|
||||
$aux = @file_get_contents("/tmp/{$ifinfo['ifv6']}_pdinfo");
|
||||
if (!empty($aux)) {
|
||||
$ifinfo['pdinfo'] = $aux;
|
||||
}
|
||||
|
||||
$ifinfotmp = $all_intf_stats[$ifinfo['if']];
|
||||
$ifinfo['inerrs'] = $ifinfotmp['input errors'];
|
||||
$ifinfo['outerrs'] = $ifinfotmp['output errors'];
|
||||
|
||||
@ -45,7 +45,7 @@ if (file_exists('/var/run/booting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_error("IP renewal is starting on '{$argument}'");
|
||||
log_error("IPv4 renewal is starting on '{$argument}'");
|
||||
|
||||
if (empty($argument)) {
|
||||
$interface = 'wan';
|
||||
|
||||
@ -45,7 +45,7 @@ if (file_exists('/var/run/booting')) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_error("IP renewal is starting on '{$argument}'");
|
||||
log_error("IPv6 renewal is starting on '{$argument}'");
|
||||
|
||||
if (empty($argument)) {
|
||||
$interface = 'wan';
|
||||
|
||||
@ -339,10 +339,10 @@ include("head.inc");
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<?php if (file_exists("/tmp/{$ifinfo['if']}_pdinfo")): /* XXX move to interface stats, possible IPv6 device mismatch */ ?>
|
||||
<?php if (array_key_exists('pdinfo', $ifinfo)): ?>
|
||||
<tr>
|
||||
<td><?= gettext('Delegated prefix') ?></td>
|
||||
<td><?= file_get_contents("/tmp/{$ifinfo['if']}_pdinfo") ?></td>
|
||||
<td><?= $ifinfo['pdinfo'] ?></td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<?php if (!empty($ifinfo['gatewayv6'])): ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user