From: Christian Franke Date: Wed, 12 Jul 2017 16:28:40 +0000 (+0200) Subject: zebra: prettier format for multilevel-recursive routes X-Git-Tag: reindent-master-before~8^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e3054ee94fc010095262caba2305e82ecbca7597;p=mirror%2Ffrr.git zebra: prettier format for multilevel-recursive routes Signed-off-by: Christian Franke --- diff --git a/lib/nexthop.c b/lib/nexthop.c index 9b5a3ee102..e9ffea0a0e 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -274,3 +274,14 @@ nexthop_next(struct nexthop *nexthop) return NULL; } + +unsigned int +nexthop_level(struct nexthop *nexthop) +{ + unsigned int rv = 0; + + for (struct nexthop *par = nexthop->rparent; par; par = par->rparent) + rv++; + + return rv; +} diff --git a/lib/nexthop.h b/lib/nexthop.h index 4d7f32f6f0..e9d937f94b 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -133,4 +133,5 @@ extern int nexthop_labels_match (struct nexthop *nh1, struct nexthop *nh2); extern const char * nexthop2str (struct nexthop *nexthop, char *str, int size); extern struct nexthop *nexthop_next(struct nexthop *nexthop); +extern unsigned int nexthop_level(struct nexthop *nexthop); #endif /*_LIB_NEXTHOP_H */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 7f4754fccc..3b138cba8b 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -985,7 +985,7 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct route_entry *r vty_out (vty, " %c%*c", CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ', - len - 3 + (2 * (nexthop->rparent ? 1 : 0)), ' '); + len - 3 + (2 * nexthop_level(nexthop)), ' '); switch (nexthop->type) {