function output_ipsec_tunnel_status($tunnel) { global $g, $config, $sad; $if = "WAN"; $interfaceip = get_ipsec_tunnel_src($tunnel); $foundsrc = false; $founddst = false; if (!is_ipaddr($tunnel['remote-gateway'])) { $tunnel['remote-gateway'] = resolve_retry($tunnel['remote-gateway']); } foreach ($sad as $sa) { if ($sa['src'] == $interfaceip) { $foundsrc = true; } if ($sa['dst'] == $tunnel['remote-gateway']) { $founddst = true; } } if ($foundsrc && $founddst) { /* tunnel is up */ $iconfn = "pass"; } else { /* tunnel is down */ $iconfn = "reject"; } echo "<img src ='/themes/{$g['theme']}/images/icons/icon_{$iconfn}.gif'>"; }
function output_ipsec_tunnel_status($tunnel) { global $g, $config, $sad; $if = "WAN"; $interfaceip = get_ipsec_tunnel_src($tunnel); $foundsrc = false; $founddst = false; if (!is_array($sad)) { /* we have no sad array, bail */ return false; } foreach ($sad as $sa) { if ($sa['src'] == $interfaceip) { $foundsrc = true; } if ($sa['dst'] == $tunnel['remote-gateway']) { $founddst = true; } } if ($foundsrc && $founddst) { /* tunnel is up */ $iconfn = "pass"; return true; } else { /* tunnel is down */ $iconfn = "reject"; return false; } }