I'm trying to write some program to simulate the OSPF behavior under the situation of adjacency down or link down. As far as I know, once an OSPF router detects that a directly connected link goes down, the router would construct a new LSA to reflect the remaining adjacency. The LSA is propagated to update all LSDB across other OSPF routers. The SPF tree will be re-calculated, and the IP route table will be updated accordingly.
To better understand the OSPF operation, I set up a three-router topology in this way:
I made the link between R1 and R2 down. R2 would advertise an LSA that only includes the adjacency of R2-R3 to R3. The LSA previously advertised by R1 would be aged as usual and marked "Adv Router is not-reachable" in the LSDB of R2 and R3.
I wonder how do R2 and R3 determine that R1 is out of reach within such a short period between the link down and the SPF re-calculation. Obviously, R2 and R3 have no way receiving any new LSA from R1. Since R2 and R3 do not delete R1's LSA, R2 and R3 *somehow* need to exclude R1's LSA from the SPF re-calculation (by marking it as "Adv Router is not-reachable"?).
The event ordering that I could figure out is as follows:
1. R2 detects link down
2. R2 knows that there will be no path to R1 (How?? The current IP route table is already out-dated; IP table lookup doesn't make sense here), so R2 marked R1's LSA as "not-reachable"
3. R2 propagates an LSA that describes R2-R3 link only
4. R2 re-calculates the SPF by excluding the R1's LSA which is marked as "not-reachable"
Any insight is appreciated.