From 7fcd5ea8bb2e7c9c94e1f38008fc3da440eb14e8 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 3 Nov 2015 09:22:37 -0200 Subject: [PATCH] Retire ipsec_smp_dump_status() --- src/etc/inc/ipsec.inc | 101 ------------------------------------------ 1 file changed, 101 deletions(-) diff --git a/src/etc/inc/ipsec.inc b/src/etc/inc/ipsec.inc index 6654166e89..911f0f4110 100644 --- a/src/etc/inc/ipsec.inc +++ b/src/etc/inc/ipsec.inc @@ -426,107 +426,6 @@ function ipsec_phase2_status(&$ipsec_status, &$phase2) { return false; } -function ipsec_smp_dump_status() { - global $config, $g, $custom_listtags; - - if (isset($config['ipsec']['enable'])) { - if (!file_exists("{$g['varrun_path']}/charon.xml")) { - log_error("IPsec daemon not running or has a problem!"); - return; - } - } else { - return; - } - - $fd = @fsockopen("unix://{$g['varrun_path']}/charon.xml"); - if (!$fd) { - log_error("Could not read status from IPsec"); - return; - } - $query = ''; - $query .= ''; - - @fwrite($fd, $query); - $response = ""; - while (!strstr($sread, "")) { - $sread = fgets($fd); - if ($sread === false) { - break; - } - $response .= $sread; - } - fclose($fd); - - if ($sread === false) { - log_error("Error during reading of status from IPsec"); - return; - } - - @file_put_contents("{$g['tmp_path']}/smp_status.xml", $response); - unset($response, $sread); - - $custom_listtags = array('ikesa', 'childsa', 'network', 'auth'); - $response = parse_xml_config("{$g['tmp_path']}/smp_status.xml", "message"); - @unlink("{$g['tmp_path']}/smp_status.xml"); - unset($custom_listtags); - - return $response; -} - -/* - * Return dump of SPD table - */ -function ipsec_dump_spd() { - $fd = @popen("/sbin/setkey -DP", "r"); - $spd = array(); - if ($fd) { - while (!feof($fd)) { - $line = chop(fgets($fd)); - if (!$line) { - continue; - } - if ($line == "No SPD entries.") { - break; - } - if ($line[0] != "\t") { - if (is_array($cursp)) { - $spd[] = $cursp; - } - $cursp = array(); - $linea = explode(" ", $line); - $cursp['srcid'] = substr($linea[0], 0, strpos($linea[0], "[")); - $cursp['dstid'] = substr($linea[1], 0, strpos($linea[1], "[")); - $i = 0; - } else if (is_array($cursp)) { - $line = trim($line, "\t\r\n "); - $linea = explode(" ", $line); - switch ($i) { - case 1: - if ($linea[1] == "none") /* don't show default anti-lockout rule */ { - unset($cursp); - } else { - $cursp['dir'] = $linea[0]; - } - break; - case 2: - $upperspec = explode("/", $linea[0]); - $cursp['proto'] = $upperspec[0]; - list($cursp['src'], $cursp['dst']) = explode("-", $upperspec[2]); - $cursp['reqid'] = substr($upperspec[3], strpos($upperspec[3], "#")+1); - break; - } - } - $i++; - } - if (is_array($cursp) && count($cursp)) { - $spd[] = $cursp; - } - pclose($fd); - } - - return $spd; -} - /* * Return dump of SAD table */