[cmaster-next] [PATCH] ospf6d: fix broken indentation in "show ipv6 ospf6 neighbor"

Renato Westphal renato at opensourcerouting.org
Mon Dec 19 12:08:16 EST 2016


In the State/IfState column, we were reserving only 6 characters to
print the state of each neighbor, but this is not enough for cases like
"Loading" (7 characters) and "ExChange" (8 characters). Increase the
width of this field to 8 to fix the broken indendation.

ospf6d's output before this patch:
ubuntu# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime  State/IfState         Duration I/F[State]
2.2.2.2           1    00:00:35 ExChange/DR              00:01:15 rt1-eth0[BDR]
3.3.3.3           1    00:00:35 Loading/DR              00:01:15 rt1-eth1[BDR]
4.4.4.4           1    00:00:35   Full/DR              00:01:15 rt1-eth2[BDR]
5.5.5.5           1    00:00:35   None/DR              00:01:10 rt1-eth3[BDR]
6.6.6.6           1    00:00:35   Down/DR              00:01:15 rt1-eth4[BDR]
7.7.7.7           1    00:00:35 Attempt/DR              00:01:15 rt1-eth5[BDR]
8.8.8.8           1    00:00:35   Init/DR              00:01:10 rt1-eth6[BDR]
9.9.9.9           1    00:00:35 Twoway/DR              00:01:14 rt1-eth7[BDR]
10.10.10.10       1    00:00:35 ExStart/DR              00:01:10 rt1-eth8[BDR]

ospf6d's output with this patch:
ubuntu# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
2.2.2.2           1    00:00:36 ExChange/DR              00:00:44 rt1-eth0[BDR]
3.3.3.3           1    00:00:36  Loading/DR              00:00:39 rt1-eth1[BDR]
4.4.4.4           1    00:00:35     Full/DR              00:00:39 rt1-eth2[BDR]
5.5.5.5           1    00:00:36     None/DR              00:00:44 rt1-eth3[BDR]
6.6.6.6           1    00:00:36     Down/DR              00:00:39 rt1-eth4[BDR]
7.7.7.7           1    00:00:36  Attempt/DR              00:00:39 rt1-eth5[BDR]
8.8.8.8           1    00:00:36     Init/DR              00:00:39 rt1-eth6[BDR]
9.9.9.9           1    00:00:35   Twoway/DR              00:00:40 rt1-eth7[BDR]
10.10.10.10       1    00:00:36  ExStart/DR              00:00:39 rt1-eth8[BDR]

Signed-off-by: Renato Westphal <renato at opensourcerouting.org>
---
 ospf6d/ospf6_neighbor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index f24ee84..e9bb249 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -682,7 +682,7 @@ ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on)
            "I/F", "State", VNL);
   */
 
-  vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]%s",
+  vty_out (vty, "%-15s %3d %11s %8s/%-12s %11s %s[%s]%s",
            router_id, on->priority, deadtime,
            ospf6_neighbor_state_str[on->state], nstate, duration,
            on->ospf6_if->interface->name,
@@ -711,7 +711,7 @@ ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on)
   timersub (&now, &on->last_changed, &res);
   timerstring (&res, duration, sizeof (duration));
 
-  vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s",
+  vty_out (vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]%s",
            router_id, ospf6_neighbor_state_str[on->state],
            duration, drouter, bdrouter, on->ospf6_if->interface->name,
            ospf6_interface_state_str[on->ospf6_if->state],
@@ -856,11 +856,11 @@ DEFUN (show_ipv6_ospf6_neighbor,
     }
 
   if (showfunc == ospf6_neighbor_show)
-    vty_out (vty, "%-15s %3s %11s %6s/%-12s %11s %s[%s]%s",
+    vty_out (vty, "%-15s %3s %11s %8s/%-12s %11s %s[%s]%s",
              "Neighbor ID", "Pri", "DeadTime", "State", "IfState", "Duration",
              "I/F", "State", VNL);
   else if (showfunc == ospf6_neighbor_show_drchoice)
-    vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]%s",
+    vty_out (vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]%s",
              "RouterID", "State", "Duration", "DR", "BDR", "I/F",
              "State", VNL);
 
-- 
1.9.1





More information about the dev mailing list