diff options
| author | Christian Franke <chris@opensourcerouting.org> | 2017-07-12 18:28:40 +0200 |
|---|---|---|
| committer | Christian Franke <chris@opensourcerouting.org> | 2017-07-12 18:28:40 +0200 |
| commit | e3054ee94fc010095262caba2305e82ecbca7597 (patch) | |
| tree | 78770d783a06a4b6d8d435aafc384c9e954474d7 /lib | |
| parent | 80507207886f119001ea7e835b59890877e50e10 (diff) | |
zebra: prettier format for multilevel-recursive routes
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nexthop.c | 11 | ||||
| -rw-r--r-- | lib/nexthop.h | 1 |
2 files changed, 12 insertions, 0 deletions
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 */ |
