ospf6d: reset areas and redistribution at router-id modification

The ospf6 router-id is provided by order of preference by:

 ospf6d itself if the "ospf6 router-id X.X.X.X" command is set.
- zebra. If the "ip router-id X.X.X.X" zebra command is set, the
  configured IP is provided as the ID or alternatively the highest
  loopback IPv4 address or else the highest interface IPv4 address.

The running ospf6 router-id is stored in ospf6->router-id.

ospf6->router-id can change in the following conditions:

- A configuration change provides a new router-id value according to
  the above rules. ospf6->router-id is updated to the new value if
  there is no adjacency in FULL state. Otherwise, the ospf6d process
  must be restarted to take the new router-id into account.
- On startup of both zebra and ospf6d, if ospf6d has not yet received a
  valid router-id, ospf6d->router-id is set to 0 (i.e. 0.0.0.0). Then,
  zebra notifies ospf6d that the router-id is available.

At ospf6->router-id, the current behavior of ospf6d is the following:

- The self generated LSAs that refer to the previous router-id as the
  advertising router are kept.
- Self generated LSAs are created with router-id value.
- LSAs from the redistribution that refer to the previous router-id are
  kept and no new redistribution LSAs are created.

As a consequence, the routers in the ospf6 areas will get incorrect
LSAs and might not be able to install prefixes of those LSAs into their
RIB.

This fix solves this issue by resetting the areas and the redistribution
when ospf6->router-id updated.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
Louis Scalbert 2021-06-10 11:30:05 +02:00
parent a30494760f
commit 078f609212

View File

@ -743,8 +743,6 @@ static void ospf6_process_reset(struct ospf6 *ospf6)
ospf6->inst_shutdown = 0;
ospf6_db_clear(ospf6);
ospf6_router_id_update(ospf6, true);
ospf6_asbr_redistribute_reset(ospf6);
FOR_ALL_INTERFACES (vrf, ifp)
ospf6_interface_clear(ifp);
@ -766,10 +764,12 @@ DEFPY (clear_router_ospf6,
vrf_name = name;
ospf6 = ospf6_lookup_by_vrf_name(vrf_name);
if (ospf6 == NULL)
if (ospf6 == NULL) {
vty_out(vty, "OSPFv3 is not configured\n");
else
} else {
ospf6_router_id_update(ospf6, true);
ospf6_process_reset(ospf6);
}
return CMD_SUCCESS;
}
@ -799,7 +799,9 @@ DEFUN(ospf6_router_id,
o->router_id_static = router_id;
if (!ospf6_router_id_update(o, false, vty)
if (ospf6_router_id_update(o, false))
ospf6_process_reset(o);
else
vty_out(vty,
"For this router-id change to take effect run the \"clear ipv6 ospf6 process\" command\n");
@ -817,7 +819,10 @@ DEFUN(no_ospf6_router_id,
o->router_id_static = 0;
if (!ospf6_router_id_update(o, false, vty)
if (ospf6_router_id_update(o, false))
ospf6_process_reset(o);
else
vty_out(vty,
"For this router-id change to take effect run the \"clear ipv6 ospf6 process\" command\n");