summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_label.h
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_label.h')
-rw-r--r--bgpd/bgp_label.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h
index b54403e..2ffd5b6 100644
--- a/bgpd/bgp_label.h
+++ b/bgpd/bgp_label.h
@@ -15,6 +15,26 @@ struct bgp_dest;
struct bgp_path_info;
struct peer;
+/* Maximum number of labels we can process or send with a prefix. We
+ * really do only 1 for MPLS (BGP-LU) but we can do 2 for EVPN-VxLAN.
+ */
+#define BGP_MAX_LABELS 2
+
+/* MPLS label(s) - VNI(s) for EVPN-VxLAN */
+struct bgp_labels {
+ mpls_label_t label[BGP_MAX_LABELS];
+ uint8_t num_labels;
+
+ unsigned long refcnt;
+};
+
+extern void bgp_labels_init(void);
+extern void bgp_labels_finish(void);
+extern struct bgp_labels *bgp_labels_intern(struct bgp_labels *labels);
+extern void bgp_labels_unintern(struct bgp_labels **plabels);
+extern bool bgp_labels_cmp(const struct bgp_labels *labels1,
+ const struct bgp_labels *labels2);
+
extern int bgp_reg_for_label_callback(mpls_label_t new_label, void *labelid,
bool allocated);
extern void bgp_reg_dereg_for_label(struct bgp_dest *dest,
@@ -27,9 +47,9 @@ extern mpls_label_t bgp_adv_label(struct bgp_dest *dest,
extern int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
struct bgp_nlri *packet);
extern bool bgp_labels_same(const mpls_label_t *tbl_a,
- const uint32_t num_labels_a,
+ const uint8_t num_labels_a,
const mpls_label_t *tbl_b,
- const uint32_t num_labels_b);
+ const uint8_t num_labels_b);
static inline int bgp_labeled_safi(safi_t safi)
{