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

This commit is contained in:
2026-02-16 23:53:54 +07:00
parent c0d35c2e51
commit 21bd829979
+4 -4
View File
@@ -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'],