Revision 21e14611
Added by Viktor Gurov about 4 years ago
src/usr/local/www/widgets/widgets/ipsec.widget.php | ||
---|---|---|
74 | 74 |
$ikeid = "con{$ph1ent['ikeid']}00000"; |
75 | 75 |
} |
76 | 76 |
} else { |
77 |
if (isset($ikenum[$ph1ent['ikeid']])) { |
|
78 |
continue; |
|
79 |
} |
|
80 |
|
|
81 | 77 |
if (get_ipsecifnum($ph1ent['ikeid'], 0)) { |
82 | 78 |
$ikeid = "con" . get_ipsecifnum($ph1ent['ikeid'], 0); |
83 | 79 |
} else { |
... | ... | |
86 | 82 |
$ikenum[$ph1ent['ikeid']] = true; |
87 | 83 |
} |
88 | 84 |
|
85 |
if (!is_array($ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]) || |
|
86 |
($ph1ent['iketype'] == 'ikev1') || isset($ph1ent['splitconn'])) { |
|
87 |
$allow_count = true; |
|
88 |
} else { |
|
89 |
$allow_count = false; |
|
90 |
} |
|
91 |
|
|
89 | 92 |
$found = false; |
90 |
if (is_array($ipsec_status) && !empty($ipsec_status)) {
|
|
93 |
if (is_array($ipsec_status) && !empty($ipsec_status) && $allow_count) {
|
|
91 | 94 |
foreach ($ipsec_status as $id => $ikesa) { |
92 | 95 |
if (isset($ikesa['child-sas'])) { |
93 | 96 |
foreach ($ikesa['child-sas'] as $childid => $childsa) { |
... | ... | |
116 | 119 |
} |
117 | 120 |
} |
118 | 121 |
|
119 |
if ($found === false) {
|
|
122 |
if (($found == false) && $allow_count) {
|
|
120 | 123 |
/* tunnel is down */ |
121 | 124 |
$iconfn = "false"; |
122 | 125 |
$inactivecounter++; |
123 | 126 |
} |
124 | 127 |
|
125 |
$ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']), |
|
128 |
if (!is_array($ipsec_detail_array[$ikenum[$ph1ent['ikeid']]])) { |
|
129 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]] = array( |
|
130 |
'src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']), |
|
131 |
'local-subnet' => array(), |
|
126 | 132 |
'dest' => $ph1ent['remote-gateway'], |
127 |
'remote-subnet' => ipsec_idinfo_to_text($ph2ent['remoteid']),
|
|
133 |
'remote-subnet' => array(),
|
|
128 | 134 |
'descr' => $ph2ent['descr'], |
135 |
'total-subnets' => 0, |
|
129 | 136 |
'status' => $iconfn); |
137 |
} |
|
138 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['total-subnets'] += 1; |
|
139 |
if ($ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['total-subnets'] < 6) { |
|
140 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['local-subnet'][] = |
|
141 |
ipsec_idinfo_to_text($ph2ent['localid']); |
|
142 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['remote-subnet'][] = |
|
143 |
ipsec_idinfo_to_text($ph2ent['remoteid']); |
|
144 |
} else { |
|
145 |
$others = $ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['total-subnets'] - 4; |
|
146 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['local-subnet'][4] = "+ {$others} others"; |
|
147 |
$ipsec_detail_array[$ikenum[$ph1ent['ikeid']]]['remote-subnet'][4] = "+ {$others} others"; |
|
148 |
} |
|
130 | 149 |
} |
131 | 150 |
} |
132 | 151 |
unset($ikenum); |
... | ... | |
150 | 169 |
if (is_array($ipsec_detail_array) && !empty($ipsec_detail_array)) { |
151 | 170 |
foreach ($ipsec_detail_array as $ipsec) { |
152 | 171 |
$data->tunnel .= "<tr>"; |
153 |
$data->tunnel .= "<td>" . htmlspecialchars($ipsec['src']) . "</td>";
|
|
154 |
$data->tunnel .= "<td>" . $ipsec['remote-subnet'] . "<br />(" . htmlspecialchars($ipsec['dest']) . ")</td>";
|
|
172 |
$data->tunnel .= "<td>" . implode('<br/>', $ipsec['local-subnet']) . "<br />(" . htmlspecialchars($ipsec['src']) . ")</td>";
|
|
173 |
$data->tunnel .= "<td>" . implode('<br/>', $ipsec['remote-subnet']) . "<br />(" . htmlspecialchars($ipsec['dest']) . ")</td>";
|
|
155 | 174 |
$data->tunnel .= "<td>" . htmlspecialchars($ipsec['descr']) . "</td>"; |
156 | 175 |
if ($ipsec['status'] == "true") { |
157 | 176 |
$data->tunnel .= '<td><i class="fa fa-arrow-up text-success"></i></td>'; |
Also available in: Unified diff
IPsec Dashboard widget improvement. Fixes #11893