From 45a9295d87b71c3e3a0d7694333cef88cc64bafc Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 31 Oct 2024 11:37:49 +0200 Subject: [PATCH 1/2] ospfd: Add a hidden command for old `no router-id` A new command is `ospf router-id ...`, but the old one is also valid. Just a no form was missed. Signed-off-by: Donatas Abraitis (cherry picked from commit 80bfe6784fa945640251ae5c907899eb9d77cc0a) --- ospfd/ospf_vty.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 6dddd69067..6c5b03f087 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -339,6 +339,12 @@ DEFPY (no_ospf_router_id, return CMD_SUCCESS; } +ALIAS_HIDDEN (no_ospf_router_id, + no_router_id_cmd, + "no router-id [A.B.C.D]", + NO_STR + "router-id for the OSPF process\n" + "OSPF router-id in IP address format\n") static void ospf_passive_interface_default_update(struct ospf *ospf, uint8_t newval) @@ -13655,6 +13661,7 @@ void ospf_vty_init(void) install_element(OSPF_NODE, &ospf_router_id_cmd); install_element(OSPF_NODE, &ospf_router_id_old_cmd); install_element(OSPF_NODE, &no_ospf_router_id_cmd); + install_element(OSPF_NODE, &no_router_id_cmd); /* "passive-interface" commands. */ install_element(OSPF_NODE, &ospf_passive_interface_default_cmd); From a5fe2ec138385098f9ecc70349d170ce80428937 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 31 Oct 2024 11:38:40 +0200 Subject: [PATCH 2/2] ospfd: Use router_id what Zebra has if we remove a static router_id If we set router-id, e.g. `router-id x.x.x.x`, then we have: ``` pc.donatas.net# show ip ospf | include Router ID OSPF Routing Process, Router ID: x.x.x.x ``` But once we remove it (`no router-id x.x.x.x`), the old router-id remains. This is kinda OK, but to be consistent with OSPFv3 we should use what Zebra already has, instead of retaining the old one. Signed-off-by: Donatas Abraitis (cherry picked from commit 1073e0f9b39b2810a114dea03f2d1e0b14e414d4) --- ospfd/ospfd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 4c4666db52..411f3a0440 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -147,15 +147,10 @@ void ospf_process_refresh_data(struct ospf *ospf, bool reset) /* Select the router ID based on these priorities: 1. Statically assigned router ID is always the first choice. - 2. If there is no statically assigned router ID, then try to stick - with the most recent value, since changing router ID's is very - disruptive. - 3. Last choice: just go with whatever the zebra daemon recommends. + 2. Just go with whatever the zebra daemon recommends. */ if (ospf->router_id_static.s_addr != INADDR_ANY) router_id = ospf->router_id_static; - else if (ospf->router_id.s_addr != INADDR_ANY) - router_id = ospf->router_id; else router_id = ospf->router_id_zebra;