summaryrefslogtreecommitdiff
path: root/ospfd/ospf_packet.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2021-10-07 23:45:31 -0300
committerRenato Westphal <renato@opensourcerouting.org>2021-10-08 09:13:37 -0300
commitab6edbfeef365c7d598e5c171bfcc63687979129 (patch)
treeed508be066e945548ec0f042c26662de1b6eac3f /ospfd/ospf_packet.c
parent1c50c7243fee32d18b9f5fd0ab2380f850e3debc (diff)
ospfd: preserve DR status across graceful restarts
RFC 3623 says: "If the restarting router determines that it was the Designated Router on a given segment prior to the restart, it elects itself as the Designated Router again. The restarting router knows that it was the Designated Router if, while the associated interface is in Waiting state, a Hello packet is received from a neighbor listing the router as the Designated Router". Implement that logic when processing Hello messages to ensure DR interfaces will preserve their DR status across a graceful restart. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_packet.c')
-rw-r--r--ospfd/ospf_packet.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 1efdfee3b4..aa576d1452 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -1134,6 +1134,21 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
nbr->priority = hello->priority;
nbr->d_router = hello->d_router;
nbr->bd_router = hello->bd_router;
+
+ /*
+ * RFC 3623 - Section 2:
+ * "If the restarting router determines that it was the Designated
+ * Router on a given segment prior to the restart, it elects
+ * itself as the Designated Router again. The restarting router
+ * knows that it was the Designated Router if, while the
+ * associated interface is in Waiting state, a Hello packet is
+ * received from a neighbor listing the router as the Designated
+ * Router".
+ */
+ if (oi->area->ospf->gr_info.restart_in_progress
+ && oi->state == ISM_Waiting
+ && IPV4_ADDR_SAME(&hello->d_router, &oi->address->u.prefix4))
+ DR(oi) = hello->d_router;
}
/* Save DD flags/options/Seqnum received. */