159 |
159 |
|
160 |
160 |
/* Interface ip is needed since apinger will bind a socket to it. */
|
161 |
161 |
if (is_ipaddrv4($gateway['gateway'])) {
|
162 |
|
$gwifip = find_interface_ip($gateway['interface'], true);
|
|
162 |
if (is_ipaddrv4($gateway['srcip'])) {
|
|
163 |
$gwifip = $gateway['srcip'];
|
|
164 |
} else {
|
|
165 |
$gwifip = find_interface_ip($gateway['interface'], true);
|
|
166 |
}
|
163 |
167 |
if (!is_ipaddrv4($gwifip))
|
164 |
168 |
continue; //Skip this target
|
165 |
169 |
|
... | ... | |
176 |
180 |
}
|
177 |
181 |
} else if (is_ipaddrv6($gateway['gateway'])) {
|
178 |
182 |
/* link locals really need a different src ip */
|
179 |
|
if(is_linklocal($gateway['gateway'])) {
|
|
183 |
if (is_ipaddrv6($gateway['srcip'])) {
|
|
184 |
$gwifip = $gateway['srcip'];
|
|
185 |
} else if(is_linklocal($gateway['gateway'])) {
|
180 |
186 |
$gwifip = find_interface_ipv6_ll($gateway['interface'], true);
|
181 |
187 |
} else {
|
182 |
188 |
$gwifip = find_interface_ipv6($gateway['interface'], true);
|
... | ... | |
327 |
333 |
$tgtip = get_interface_gateway($realif);
|
328 |
334 |
if (!is_ipaddr($tgtip))
|
329 |
335 |
$tgtip = "none";
|
330 |
|
$srcip = find_interface_ip($realif);
|
|
336 |
if (is_ipaddr($gwitem['srcip'])) {
|
|
337 |
$srcip = $gwitem['srcip'];
|
|
338 |
} else {
|
|
339 |
$srcip = find_interface_ip($realif);
|
|
340 |
}
|
331 |
341 |
} else {
|
332 |
342 |
$tgtip = $gwitem['monitorip'];
|
333 |
|
$srcip = find_interface_ip($realif);
|
|
343 |
if (is_ipaddr($gwitem['srcip'])) {
|
|
344 |
$srcip = $gwitem['srcip'];
|
|
345 |
} else {
|
|
346 |
$srcip = find_interface_ip($realif);
|
|
347 |
}
|
334 |
348 |
}
|
335 |
349 |
if($byname == true)
|
336 |
350 |
$target = $gwitem['name'];
|