return BGP_NLRI_PARSE_OK;
}
+
+bool bgp_labels_same(const mpls_label_t *tbl_a, const uint32_t num_labels_a,
+ const mpls_label_t *tbl_b, const uint32_t num_labels_b)
+{
+ uint32_t i;
+
+ if (num_labels_a != num_labels_b)
+ return false;
+ if (num_labels_a == 0)
+ return true;
+
+ for (i = 0; i < num_labels_a; i++) {
+ if (tbl_a[i] != tbl_b[i])
+ return false;
+ }
+ return true;
+}
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 mpls_label_t *tbl_b,
+ const uint32_t num_labels_b);
static inline int bgp_labeled_safi(safi_t safi)
{
static bool labels_same(struct bgp_path_info *bpi, mpls_label_t *label,
uint32_t n)
{
- uint32_t i;
-
if (!bpi->extra) {
if (!n)
return true;
return false;
}
- if (n != bpi->extra->num_labels)
- return false;
-
- for (i = 0; i < n; ++i) {
- if (label[i] != bpi->extra->label[i])
- return false;
- }
- return true;
+ return bgp_labels_same((const mpls_label_t *)bpi->extra->label,
+ bpi->extra->num_labels,
+ (const mpls_label_t *)label, n);
}
/*