diff options
| author | ßingen <bingen@voltanet.io> | 2017-06-27 12:49:49 +0200 | 
|---|---|---|
| committer | ßingen <bingen@voltanet.io> | 2017-06-28 21:32:18 +0200 | 
| commit | f9e1b38e1a48b72cac7caaded16b9355c80d7899 (patch) | |
| tree | 78ad561127d3cf9e3ba6d58972c21cc40a87d326 /lib | |
| parent | 3d07d27345fe5832045632d292ac6cdfabbc75e0 (diff) | |
Allow for more than 1 NH recursion level
Before, only one level of recursive resolution was supported.
Signed-off-by: ßingen <bingen@voltanet.io>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nexthop.c | 7 | ||||
| -rw-r--r-- | lib/nexthop.h | 6 | 
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 725b52c052..948baca198 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -135,7 +135,7 @@ nexthop_add (struct nexthop **target, struct nexthop *nexthop)  }  void -copy_nexthops (struct nexthop **tnh, struct nexthop *nh) +copy_nexthops (struct nexthop **tnh, struct nexthop *nh, struct nexthop *rparent)  {    struct nexthop *nexthop;    struct nexthop *nh1; @@ -150,11 +150,12 @@ copy_nexthops (struct nexthop **tnh, struct nexthop *nh)        memcpy(&(nexthop->src), &(nh->src), sizeof(union g_addr));        if (nh->nh_label)          nexthop_add_labels (nexthop, nh->nh_label_type, -			    nh->nh_label->num_labels, &nh->nh_label->label[0]); +                nh->nh_label->num_labels, &nh->nh_label->label[0]); +      nexthop->rparent = rparent;        nexthop_add(tnh, nexthop);        if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE)) -	copy_nexthops(&nexthop->resolved, nh1->resolved); +        copy_nexthops(&nexthop->resolved, nh1->resolved, nexthop);      }  } diff --git a/lib/nexthop.h b/lib/nexthop.h index 8c9c801c91..f48c41dc55 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; @@ -107,7 +109,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);  | 
