refactor(PingServices): refine interface selection logic for ping operations, accommodating home routers without gateways
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m38s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m38s
This commit is contained in:
@@ -309,6 +309,7 @@ async function runPingViaRouter(serverId, gatewayIp, target, count = 5, interfac
|
|||||||
}
|
}
|
||||||
const client = createRosClient(creds);
|
const client = createRosClient(creds);
|
||||||
let ifaceName = interfaceName || null;
|
let ifaceName = interfaceName || null;
|
||||||
|
const isHomeNoGateway = server.type === 'home' && !gatewayIp && !interfaceName;
|
||||||
|
|
||||||
if (!ifaceName && gatewayIp) {
|
if (!ifaceName && gatewayIp) {
|
||||||
const config = await loadNetworkConfig();
|
const config = await loadNetworkConfig();
|
||||||
@@ -387,10 +388,9 @@ async function runPingViaRouter(serverId, gatewayIp, target, count = 5, interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4) Последний фоллбек: если ifaceName до сих пор не определён,
|
// 4) Последний фоллбек (только для jumphost или home с указанным шлюзом): ether1/ether2.
|
||||||
// пробуем взять первый физический порт ether1/ether2 (если есть),
|
// Для home без шлюза интерфейс не задаём — пинг идёт по маршруту по умолчанию.
|
||||||
// иначе любой интерфейс с префиксом "ether".
|
if (!ifaceName && !isHomeNoGateway) {
|
||||||
if (!ifaceName) {
|
|
||||||
try {
|
try {
|
||||||
const ifRes = await client.command('interface/print', {
|
const ifRes = await client.command('interface/print', {
|
||||||
'.proplist': ['name'],
|
'.proplist': ['name'],
|
||||||
|
|||||||
Reference in New Issue
Block a user