thread_add_read(master, ospf6_receive, ospf6, ospf6->fd,
&ospf6->t_ospf6_receive);
- ospf6_router_id_update(ospf6, true);
+ ospf6_router_id_update(ospf6, true, NULL);
}
}
if (DFLT_OSPF6_LOG_ADJACENCY_CHANGES)
SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
if (ospf6->router_id == 0)
- ospf6_router_id_update(ospf6, true);
+ ospf6_router_id_update(ospf6, true, NULL);
ospf6_add(ospf6);
if (ospf6->vrf_id != VRF_UNKNOWN) {
vrf = vrf_lookup_by_id(ospf6->vrf_id);
&o->maxage_remover);
}
-void ospf6_router_id_update(struct ospf6 *ospf6, bool init)
+void ospf6_router_id_update(struct ospf6 *ospf6, bool init, struct vty *vty)
{
in_addr_t new_router_id;
struct listnode *node;
if (ospf6->router_id_static != 0)
new_router_id = ospf6->router_id_static;
else
- new_router_id = ospf6->zebra_router_id;
+ new_router_id = ospf6->router_id_zebra;
if (ospf6->router_id == new_router_id)
return;
if (!init)
for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, node, oa)) {
if (oa->full_nbrs) {
- zlog_err(
- "%s: cannot update router-id. Save config and restart ospf6d\n",
- __func__);
+ if (vty)
+ vty_out(vty,
+ "For this router-id change to take effect,"
+ " run the \"clear ipv6 ospf6 process\" command\n");
+ else
+ zlog_err(
+ "%s: cannot update router-id."
+ " Run the \"clear ipv6 ospf6 process\" command\n",
+ __func__);
return;
}
}
ospf6->inst_shutdown = 0;
ospf6_db_clear(ospf6);
- ospf6_router_id_update(ospf6, true);
+ ospf6_router_id_update(ospf6, true, NULL);
ospf6_asbr_redistribute_reset(ospf6);
FOR_ALL_INTERFACES (vrf, ifp)
int ret;
const char *router_id_str;
uint32_t router_id;
- struct ospf6_area *oa;
- struct listnode *node;
argv_find(argv, argc, "A.B.C.D", &idx);
router_id_str = argv[idx]->arg;
o->router_id_static = router_id;
- for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
- if (oa->full_nbrs) {
- vty_out(vty,
- "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n");
- return CMD_SUCCESS;
- }
- }
-
- o->router_id = router_id;
+ ospf6_router_id_update(o, false, vty);
return CMD_SUCCESS;
}
V4NOTATION_STR)
{
VTY_DECLVAR_CONTEXT(ospf6, o);
- struct ospf6_area *oa;
- struct listnode *node;
o->router_id_static = 0;
- for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) {
- if (oa->full_nbrs) {
- vty_out(vty,
- "For this router-id change to take effect, run the \"clear ipv6 ospf6 process\" command\n");
- return CMD_SUCCESS;
- }
- }
- o->router_id = 0;
- if (o->router_id_zebra)
- o->router_id = o->router_id_zebra;
+ ospf6_router_id_update(o, false, vty);
return CMD_SUCCESS;
}