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);
|
||||
let ifaceName = interfaceName || null;
|
||||
const isHomeNoGateway = server.type === 'home' && !gatewayIp && !interfaceName;
|
||||
|
||||
if (!ifaceName && gatewayIp) {
|
||||
const config = await loadNetworkConfig();
|
||||
@@ -387,10 +388,9 @@ async function runPingViaRouter(serverId, gatewayIp, target, count = 5, interfac
|
||||
}
|
||||
}
|
||||
|
||||
// 4) Последний фоллбек: если ifaceName до сих пор не определён,
|
||||
// пробуем взять первый физический порт ether1/ether2 (если есть),
|
||||
// иначе любой интерфейс с префиксом "ether".
|
||||
if (!ifaceName) {
|
||||
// 4) Последний фоллбек (только для jumphost или home с указанным шлюзом): ether1/ether2.
|
||||
// Для home без шлюза интерфейс не задаём — пинг идёт по маршруту по умолчанию.
|
||||
if (!ifaceName && !isHomeNoGateway) {
|
||||
try {
|
||||
const ifRes = await client.command('interface/print', {
|
||||
'.proplist': ['name'],
|
||||
|
||||
Reference in New Issue
Block a user