]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Added missing fields to "show ip ospf neighbor detail"
authorPooja Jagadeesh Doijode <pdoijode@nvidia.com>
Wed, 18 Jan 2023 20:26:01 +0000 (12:26 -0800)
committerPooja Jagadeesh Doijode <pdoijode@nvidia.com>
Mon, 6 Feb 2023 23:41:44 +0000 (15:41 -0800)
"role" and "local interface address" fields were missing in
"show ip ospf neighbor detail" command.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
ospfd/ospf_vty.c

index 469e9955e91b296a10b33359f0e6d529495a0c9f..db5c5c1c1f3d648d8e722a9bc00ac5b4298fa278 100644 (file)
@@ -5138,19 +5138,36 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
                json_object_string_add(json_neigh, "areaId",
                                       ospf_area_desc_string(oi->area));
                json_object_string_add(json_neigh, "ifaceName", oi->ifp->name);
-       } else
-               vty_out(vty, "    In the area %s via interface %s\n",
+               if (oi->address)
+                       json_object_string_addf(json_neigh, "localIfaceAddress",
+                                               "%pI4",
+                                               &oi->address->u.prefix4);
+       } else {
+               vty_out(vty, "    In the area %s via interface %s",
                        ospf_area_desc_string(oi->area), oi->ifp->name);
+               if (oi->address)
+                       vty_out(vty, " local interface IP %pI4\n",
+                               &oi->address->u.prefix4);
+               else
+                       vty_out(vty, "\n");
+       }
 
        /* Show neighbor priority and state. */
        ospf_nbr_ism_state_message(nbr, neigh_state, sizeof(neigh_state));
        if (use_json) {
                json_object_int_add(json_neigh, "nbrPriority", nbr->priority);
                json_object_string_add(json_neigh, "nbrState", neigh_state);
-       } else
-               vty_out(vty, "    Neighbor priority is %d, State is %s,",
-                       nbr->priority, neigh_state);
-
+               json_object_string_add(json_neigh, "role",
+                                      lookup_msg(ospf_ism_state_msg,
+                                                 ospf_nbr_ism_state(nbr),
+                                                 NULL));
+       } else {
+               vty_out(vty,
+                       "    Neighbor priority is %d, State is %s, Role is %s,",
+                       nbr->priority, neigh_state,
+                       lookup_msg(ospf_ism_state_msg, ospf_nbr_ism_state(nbr),
+                                  NULL));
+       }
        /* Show state changes. */
        if (use_json)
                json_object_int_add(json_neigh, "stateChangeCounter",