diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2022-02-01 11:28:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 11:28:44 +0100 |
commit | 8ccce7500984635adb5efe470bf45310ad2786af (patch) | |
tree | 2df27d992f519a1dbfb25d5b2bf8c9fc784e084a /ospf6d | |
parent | Merge pull request #10459 from ckishimo/ospfd_distance (diff) | |
parent | ospf6d: print administrative distance in show ipv6 ospf (diff) | |
download | frr-8ccce7500984635adb5efe470bf45310ad2786af.tar.xz frr-8ccce7500984635adb5efe470bf45310ad2786af.zip |
Merge pull request #10435 from ckishimo/ospf6d_distance
ospf6d: fix distance not applied
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_top.c | 22 | ||||
-rw-r--r-- | ospf6d/ospf6_top.h | 1 |
2 files changed, 19 insertions, 4 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 2e9e32f2e..b9e3e5b97 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, diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 77156f961..d49b28e89 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -251,6 +251,7 @@ extern void install_element_ospf6_clear_process(void); extern void ospf6_top_init(void); extern void ospf6_delete(struct ospf6 *o); extern bool ospf6_router_id_update(struct ospf6 *ospf6, bool init); +void ospf6_restart_spf(struct ospf6 *ospf6); extern void ospf6_maxage_remove(struct ospf6 *o); extern struct ospf6 *ospf6_instance_create(const char *name); |