diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-05-02 18:36:45 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-02 18:36:45 +0300 |
| commit | 99a1ab0b2150ae82f0e831dc37d1b91da763318d (patch) | |
| tree | 7d7b940739d53db7d37205b6a6782f703635c510 /bgpd/bgp_labelpool.h | |
| parent | d0053da26b49166353c5f48c11fb11f6bea691d0 (diff) | |
| parent | dab2df8dc0d8a83edb796c2205491d7e6664c2dc (diff) | |
Merge pull request #12646 from pguibert6WIND/mpls_alloc_per_nh
MPLS allocation mode per next hop
Diffstat (limited to 'bgpd/bgp_labelpool.h')
| -rw-r--r-- | bgpd/bgp_labelpool.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/bgpd/bgp_labelpool.h b/bgpd/bgp_labelpool.h index 9526cba0ce..b33527186e 100644 --- a/bgpd/bgp_labelpool.h +++ b/bgpd/bgp_labelpool.h @@ -17,6 +17,7 @@ */ #define LP_TYPE_VRF 0x00000001 #define LP_TYPE_BGP_LU 0x00000002 +#define LP_TYPE_NEXTHOP 0x00000003 PREDECL_LIST(lp_fifo); @@ -41,4 +42,55 @@ extern void bgp_lp_event_zebra_down(void); extern void bgp_lp_event_zebra_up(void); extern void bgp_lp_vty_init(void); +struct bgp_label_per_nexthop_cache; +PREDECL_RBTREE_UNIQ(bgp_label_per_nexthop_cache); + +extern int +bgp_label_per_nexthop_cache_cmp(const struct bgp_label_per_nexthop_cache *a, + const struct bgp_label_per_nexthop_cache *b); + +struct bgp_label_per_nexthop_cache { + + /* RB-tree entry. */ + struct bgp_label_per_nexthop_cache_item entry; + + /* the nexthop is the key of the list */ + struct prefix nexthop; + + /* calculated label */ + mpls_label_t label; + + /* number of path_vrfs */ + unsigned int path_count; + + /* back pointer to bgp instance */ + struct bgp *to_bgp; + + /* copy a nexthop resolution from bgp nexthop tracking + * used to extract the interface nexthop + */ + struct nexthop *nh; + + /* list of path_vrfs using it */ + LIST_HEAD(path_lists, bgp_path_info) paths; + + time_t last_update; + + /* Back pointer to the cache tree this entry belongs to. */ + struct bgp_label_per_nexthop_cache_head *tree; +}; + +DECLARE_RBTREE_UNIQ(bgp_label_per_nexthop_cache, + struct bgp_label_per_nexthop_cache, entry, + bgp_label_per_nexthop_cache_cmp); + +void bgp_label_per_nexthop_free(struct bgp_label_per_nexthop_cache *blnc); + +struct bgp_label_per_nexthop_cache * +bgp_label_per_nexthop_new(struct bgp_label_per_nexthop_cache_head *tree, + struct prefix *nexthop); +struct bgp_label_per_nexthop_cache * +bgp_label_per_nexthop_find(struct bgp_label_per_nexthop_cache_head *tree, + struct prefix *nexthop); +void bgp_label_per_nexthop_init(void); #endif /* _FRR_BGP_LABELPOOL_H */ |
