fix(network): выбрать IPv6-команду в экспорте GRE

This commit is contained in:
Denozordec committed 2026-10-13 22:01:46 +07:00
1 parent 1be4a490b5
commit 0c5d7d3207
15 files changed
+204 -10

No files matched your search

+4
View File
@@ -28,3 +28,7 @@ console.log('gre-export: hidden configured PSK produces an explicitly labelled t
const incompatible = generateGreRsc({ ...tunnel, allowFastPath: true }, {})
assert.ok(incompatible.includes("allow-fast-path=<ALLOW_FAST_PATH>"))
assert.ok(incompatible.includes("IPsec несовместим с FastPath"))
const ipv6 = generateGreRsc({ ...tunnel, ipsec: null, localInnerIp: "fd00:213::1/64" }, {})
assert.ok(ipv6.includes('/ipv6/address/add address="fd00:213::1/64" interface=' + quoteRosString(tunnel.name) + " advertise=no"))
assert.ok(!ipv6.includes("/ip/address/add"))
assert.ok(ipv6.includes("pool/EUI-64 и остальные адреса не включены"))
+5 -1
View File
@@ -33,7 +33,11 @@ export function generateGreRsc(t: GreTunnel, servers: Record<string, Server>): s
args.push("ipsec-secret=" + quoteRosString(t.ipsec.secret || "<IPSEC_PSK>"))
}
lines.push("/interface/gre/add " + args.join(" "))
if (t.localInnerIp) lines.push("/ip/address/add address=" + quoteRosString(t.localInnerIp) + " interface=" + quoteRosString(t.name))
if (t.localInnerIp) {
const ipv6 = t.localInnerIp.includes(":")
if (ipv6) lines.push("# IPv6: новый статический адрес без объявления префикса; pool/EUI-64 и остальные адреса не включены")
lines.push((ipv6 ? "/ipv6/address/add" : "/ip/address/add") + " address=" + quoteRosString(t.localInnerIp) + " interface=" + quoteRosString(t.name) + (ipv6 ? " advertise=no" : ""))
}
if (t.ipsec) lines.push("# Peer/policy создаёт RouterOS по ipsec-secret; ручные объекты IPsec не экспортируются")
if (t.ipsec && t.allowFastPath) lines.push("# В снимке включён FastPath: для GRE с IPsec документация RouterOS требует allow-fast-path=no")
return lines.join("\n") + "\n"