?> </td> <td> <?php echo htmlspecialchars($rfc2136['server']); ?> </td> <td> <?php echo htmlspecialchars($rfc2136['host']); ?> </td> <td> <?php $filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; $if = get_failover_interface($rfc2136['interface']); if (file_exists($filename)) { print 'IPv4: '; if (isset($rfc2136['usepublicip'])) { $ipaddr = dyndnsCheckIP($if); } else { $ipaddr = get_interface_ip($if); } $cached_ip_s = explode("|", file_get_contents($filename)); $cached_ip = $cached_ip_s[0]; if ($ipaddr != $cached_ip) { print '<span class="text-danger">'; } else { print '<span class="text-success">'; } print htmlspecialchars($cached_ip);
list($entered_local_network, $entered_local_mask) = explode('/', $entered_localid_data); $entered_remote = array(); $entered_remote['type'] = $pconfig['remoteid_type']; if (isset($pconfig['remoteid_address'])) { $entered_remote['address'] = $pconfig['remoteid_address']; } if (isset($pconfig['remoteid_netbits'])) { $entered_remote['netbits'] = $pconfig['remoteid_netbits']; } $entered_remoteid_data = ipsec_idinfo_to_cidr($entered_remote, false, $pconfig['mode']); list($entered_remote_network, $entered_remote_mask) = explode('/', $entered_remoteid_data); if ($phase1['protocol'] == "inet6") { $if = get_failover_interface($phase1['interface'], "inet6"); $interfaceip = get_interface_ipv6($if); } else { $if = get_failover_interface($phase1['interface']); $interfaceip = get_interface_ip($if); } /* skip validation for hostnames, they're subject to change anyway */ if (is_ipaddr($phase1['remote-gateway'])) { if ($pconfig['mode'] == "tunnel") { if (check_subnets_overlap($interfaceip, 32, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 32, $entered_remote_network, $entered_remote_mask)) { $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1."); break; } } else { if ($pconfig['mode'] == "tunnel6") { if (check_subnetsv6_overlap($interfaceip, 128, $entered_local_network, $entered_local_mask) && check_subnets_overlap($phase1['remote-gateway'], 128, $entered_remote_network, $entered_remote_mask)) { $input_errors[] = gettext("The local and remote networks of a phase 2 entry cannot overlap the outside of the tunnel (interface and remote gateway) configured in its phase 1."); break; }
$cache_sep = ":"; if ($dyndns['type'] == "namecheap") { $hostname = $dyndns['host'] . "." . $dyndns['domainname']; } elseif (empty($dyndns['type'])) { /* RFC2136, add some dummy values */ $dyndns['type'] = '_rfc2136_'; $dyndns['id'] = '_' . $dyndns['server']; $hostname = $dyndns['host']; $cache_sep = "|"; } else { $hostname = $dyndns['host']; } $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($hostname) . "{$dyndns['id']}.cache"; if (file_exists($filename)) { if ($dyndns['type'] == '_rfc2136_' && !isset($dyndns['usepublicip'])) { $ipaddr = get_interface_ip(get_failover_interface($dyndns['interface'])); } else { $ipaddr = dyndnsCheckIP($dyndns['interface']); } $cached_ip_s = explode($cache_sep, file_get_contents($filename)); $cached_ip = $cached_ip_s[0]; if (trim($ipaddr) != trim($cached_ip)) { print '<span class="text-danger">'; } else { print '<span class="text-success">'; } print htmlspecialchars($cached_ip); print '</span>'; } else { print 'N/A ' . date("H:i:s"); }