]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: show ip ospf interface only shows BDR info, Added DR info. 7789/head
authorrgirada <rgirada@vmware.com>
Wed, 23 Dec 2020 09:13:17 +0000 (01:13 -0800)
committerrgirada <rgirada@vmware.com>
Thu, 29 Apr 2021 11:20:14 +0000 (04:20 -0700)
Description:
DR information is missing under "show ip ospf interface [json]".
Added DR infomation to display in "show ip ospf interface".

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
ospfd/ospf_vty.c
tests/topotests/all-protocol-startup/r1/show_ip_ospf_interface.ref

index 69a3e45878ba5b3c0aff779231c2a56affec1179..57ef6029addc32f51f474eb8f17062e80cc58deb 100644 (file)
@@ -3737,6 +3737,31 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
                                vty_out(vty,
                                        "  No backup designated router on this network\n");
                } else {
+                       nbr = ospf_nbr_lookup_by_addr(oi->nbrs, &DR(oi));
+                       if (nbr) {
+                               if (use_json) {
+                                       json_object_string_add(
+                                               json_interface_sub, "drId",
+                                               inet_ntop(AF_INET,
+                                                         &nbr->router_id, buf,
+                                                         sizeof(buf)));
+                                       json_object_string_add(
+                                               json_interface_sub, "drAddress",
+                                               inet_ntop(
+                                                       AF_INET,
+                                                       &nbr->address.u.prefix4,
+                                                       buf, sizeof(buf)));
+                               } else {
+                                       vty_out(vty,
+                                               "  Designated Router (ID) %pI4",
+                                               &nbr->router_id);
+                                       vty_out(vty,
+                                               " Interface Address %pFX\n",
+                                               &nbr->address);
+                               }
+                       }
+                       nbr = NULL;
+
                        nbr = ospf_nbr_lookup_by_addr(oi->nbrs, &BDR(oi));
                        if (nbr == NULL) {
                                if (!use_json)
index 1e8f67f3f9a6d6e2749eee21c6a601497cc2a03b..ff856792568af02dbd2fc9cbe30e9f4a4319a9ec 100644 (file)
@@ -4,6 +4,7 @@ r1-eth0 is up
   MTU mismatch detection: enabled
   Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
   Transmit Delay is 1 sec, State DR, Priority 1
+  Designated Router (ID) 192.168.0.1 Interface Address 192.168.0.1/24
   No backup designated router on this network
   Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
   Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
@@ -15,6 +16,7 @@ r1-eth3 is up
   MTU mismatch detection: enabled
   Router ID 192.168.0.1, Network Type BROADCAST, Cost: 10
   Transmit Delay is 1 sec, State DR, Priority 1
+  Designated Router (ID) 192.168.0.1 Interface Address 192.168.3.1/26
   No backup designated router on this network
   Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
   Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5