summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_top.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2022-02-01 13:28:44 +0300
committerGitHub <noreply@github.com>2022-02-01 13:28:44 +0300
commit8ccce7500984635adb5efe470bf45310ad2786af (patch)
tree2df27d992f519a1dbfb25d5b2bf8c9fc784e084a /ospf6d/ospf6_top.c
parent914ce787b83fb96df969867639ddefabd6e2eb85 (diff)
parent94c78d3b6d620a4d584dd7a4c080bf6818db227d (diff)
Merge pull request #10435 from ckishimo/ospf6d_distance
ospf6d: fix distance not applied
Diffstat (limited to 'ospf6d/ospf6_top.c')
-rw-r--r--ospf6d/ospf6_top.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 2e9e32f2e0..b9e3e5b97c 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -970,8 +970,13 @@ DEFUN (ospf6_distance,
"OSPF6 Administrative distance\n")
{
VTY_DECLVAR_CONTEXT(ospf6, o);
+ uint8_t distance;
- o->distance_all = atoi(argv[1]->arg);
+ distance = atoi(argv[1]->arg);
+ if (o->distance_all != distance) {
+ o->distance_all = distance;
+ ospf6_restart_spf(o);
+ }
return CMD_SUCCESS;
}
@@ -985,8 +990,10 @@ DEFUN (no_ospf6_distance,
{
VTY_DECLVAR_CONTEXT(ospf6, o);
- o->distance_all = 0;
-
+ if (o->distance_all) {
+ o->distance_all = 0;
+ ospf6_restart_spf(o);
+ }
return CMD_SUCCESS;
}
@@ -1236,7 +1243,7 @@ DEFUN (no_ospf6_stub_router_admin,
}
/* Restart OSPF SPF algorithm*/
-static void ospf6_restart_spf(struct ospf6 *ospf6)
+void ospf6_restart_spf(struct ospf6 *ospf6)
{
ospf6_route_remove_all(ospf6->route_table);
ospf6_route_remove_all(ospf6->brouter_table);
@@ -1329,6 +1336,10 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json,
o->spf_hold_multiplier);
json_object_int_add(json, "maximumPaths", o->max_multipath);
+ json_object_int_add(json, "preference",
+ o->distance_all
+ ? o->distance_all
+ : ZEBRA_OSPF6_DISTANCE_DEFAULT);
if (o->ts_spf.tv_sec || o->ts_spf.tv_usec) {
timersub(&now, &o->ts_spf, &result);
@@ -1412,6 +1423,9 @@ static void ospf6_show(struct vty *vty, struct ospf6 *o, json_object *json,
o->lsa_minarrival);
vty_out(vty, " Maximum-paths %u\n", o->max_multipath);
+ vty_out(vty, " Administrative distance %u\n",
+ o->distance_all ? o->distance_all
+ : ZEBRA_OSPF6_DISTANCE_DEFAULT);
/* Show SPF parameters */
vty_out(vty,