fix(ospf): сопоставлять IPv6 адреса и исключать неоднозначный BFD
This commit is contained in:
1 parent
1b63e3ec43
commit
e1617f1472
11 files changed
+201
-19
No files matched your search
@@ -29,3 +29,20 @@ test("topology does not infer Down from missing or transitional evidence", () =>
|
||||
assert.equal(ospfNodeState(["2-Way", "Down"]), "2-Way")
|
||||
assert.equal(ospfNodeState(["Full", "Unknown"]), "Full")
|
||||
})
|
||||
|
||||
test("BFD correlation compares IPv6 addresses canonically within their interface scope", () => {
|
||||
const neighbor = { localRouter: "1", localIface: "gre-own", neighborAddress: "FE80:0000:0000:0000:0000:0000:0000:0002%gre-own", state: "Full" as const }
|
||||
const iface = { serverId: "1", interfaceName: "gre-own", active: true, useBfd: true }
|
||||
const session = { serverId: "1", iface: "gre-own", remoteAddr: "fe80::2", state: "Down" as const, multihop: false }
|
||||
assert.deepEqual(ospfBfdConflicts([neighbor], [iface], [session]), [neighbor])
|
||||
for (const remoteAddr of ["fe80::3", "fe80::2%other", "fe80::2%", "fe80::2%gre-own%extra"]) assert.deepEqual(ospfBfdConflicts([neighbor], [iface], [{ ...session, remoteAddr }]), [])
|
||||
for (const neighborAddress of ["fe80::2%other", "fe80::2%", "fe80::2%gre-own%extra"]) assert.deepEqual(ospfBfdConflicts([{ ...neighbor, neighborAddress }], [iface], [session]), [])
|
||||
})
|
||||
|
||||
test("invalid peer strings and stale duplicate sessions cannot prove an OSPF/BFD conflict", () => {
|
||||
const neighbor = { localRouter: "1", localIface: "gre-own", neighborAddress: "198.18.153.2", state: "Full" as const }
|
||||
const iface = { serverId: "1", interfaceName: "gre-own", active: true, useBfd: true }
|
||||
const session = { serverId: "1", iface: "gre-own", remoteAddr: neighbor.neighborAddress, state: "Down" as const, multihop: false }
|
||||
assert.deepEqual(ospfBfdConflicts([neighbor], [iface], [session, { ...session, dataUnknown: true }]), [])
|
||||
for (const address of ["peer.example", "999.18.153.2", "0198.18.153.2", "fe80::invalid", ":::", "fe80::2/64", ""]) assert.deepEqual(ospfBfdConflicts([{ ...neighbor, neighborAddress: address }], [iface], [{ ...session, remoteAddr: address }]), [])
|
||||
})
|
||||
Reference in new issue
Block a user