diff options
Diffstat (limited to 'lib/nexthop.h')
| -rw-r--r-- | lib/nexthop.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h index 8c9c801c91..e9d937f94b 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -81,8 +81,10 @@ struct nexthop * If the nexthop struct needs to be resolved recursively, * NEXTHOP_FLAG_RECURSIVE will be set in flags and the nexthops * obtained by recursive resolution will be added to `resolved'. - * Only one level of recursive resolution is currently supported. */ + */ struct nexthop *resolved; + /* Recursive parent */ + struct nexthop *rparent; /* Type of label(s), if any */ enum lsp_types_t nh_label_type; @@ -91,6 +93,17 @@ struct nexthop struct nexthop_label *nh_label; }; +/* The following for loop allows to iterate over the nexthop + * structure of routes. + * + * head: The pointer to the first nexthop in the chain. + * + * nexthop: The pointer to the current nexthop, either in the + * top-level chain or in a resolved chain. + */ +#define ALL_NEXTHOPS(head, nexthop) \ + (nexthop) = (head); (nexthop); (nexthop) = nexthop_next(nexthop) + extern int zebra_rnh_ip_default_route; extern int zebra_rnh_ipv6_default_route; @@ -107,7 +120,7 @@ nh_resolve_via_default(int family) struct nexthop *nexthop_new (void); void nexthop_add (struct nexthop **target, struct nexthop *nexthop); -void copy_nexthops (struct nexthop **tnh, struct nexthop *nh); +void copy_nexthops (struct nexthop **tnh, struct nexthop *nh, struct nexthop *rparent); void nexthop_free (struct nexthop *nexthop); void nexthops_free (struct nexthop *nexthop); @@ -119,4 +132,6 @@ extern int nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2 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 */ |
