if (!pi)
return;
- blnc = pi->label_nexthop_cache;
+ if (!CHECK_FLAG(pi->flags, BGP_PATH_MPLSVPN_LABEL_NH))
+ return;
+
+ blnc = pi->mplsvpn.blnc.label_nexthop_cache;
if (!blnc)
return;
- LIST_REMOVE(pi, label_nh_thread);
- pi->label_nexthop_cache->path_count--;
- pi->label_nexthop_cache = NULL;
+ LIST_REMOVE(pi, mplsvpn.blnc.label_nh_thread);
+ pi->mplsvpn.blnc.label_nexthop_cache->path_count--;
+ pi->mplsvpn.blnc.label_nexthop_cache = NULL;
+ UNSET_FLAG(pi->flags, BGP_PATH_MPLSVPN_LABEL_NH);
if (LIST_EMPTY(&(blnc->paths)))
bgp_label_per_nexthop_free(blnc);
ZEBRA_MPLS_LABELS_ADD, blnc->label, blnc->nh->ifindex,
blnc->nh->vrf_id, ZEBRA_LSP_BGP, &blnc->nexthop);
- LIST_FOREACH (pi, &(blnc->paths), label_nh_thread) {
+ LIST_FOREACH (pi, &(blnc->paths), mplsvpn.blnc.label_nh_thread) {
if (!pi->net)
continue;
table = bgp_dest_table(pi->net);
bgp_mplsvpn_get_label_per_nexthop_cb);
}
- if (pi->label_nexthop_cache == blnc)
+ if (pi->mplsvpn.blnc.label_nexthop_cache == blnc)
/* no change */
return blnc->label;
bgp_mplsvpn_path_nh_label_unlink(pi);
/* updates NHT pi list reference */
- LIST_INSERT_HEAD(&(blnc->paths), pi, label_nh_thread);
- pi->label_nexthop_cache = blnc;
- pi->label_nexthop_cache->path_count++;
+ LIST_INSERT_HEAD(&(blnc->paths), pi, mplsvpn.blnc.label_nh_thread);
+ pi->mplsvpn.blnc.label_nexthop_cache = blnc;
+ pi->mplsvpn.blnc.label_nexthop_cache->path_count++;
+ SET_FLAG(pi->flags, BGP_PATH_MPLSVPN_LABEL_NH);
blnc->last_update = monotime(NULL);
/* then add or update the selected nexthop */
struct bgp_path_mh_info *mh_info;
};
+struct bgp_mplsvpn_label_nh {
+ /* For nexthop per label linked list */
+ LIST_ENTRY(bgp_path_info) label_nh_thread;
+
+ /* Back pointer to the bgp label per nexthop structure */
+ struct bgp_label_per_nexthop_cache *label_nexthop_cache;
+};
+
struct bgp_path_info {
/* For linked list. */
struct bgp_path_info *next;
#define BGP_PATH_ANNC_NH_SELF (1 << 14)
#define BGP_PATH_LINK_BW_CHG (1 << 15)
#define BGP_PATH_ACCEPT_OWN (1 << 16)
+#define BGP_PATH_MPLSVPN_LABEL_NH (1 << 17)
/* BGP route type. This can be static, RIP, OSPF, BGP etc. */
uint8_t type;
uint32_t addpath_rx_id;
struct bgp_addpath_info_data tx_addpath;
- /* For nexthop per label linked list */
- LIST_ENTRY(bgp_path_info) label_nh_thread;
-
- /* Back pointer to the bgp label per nexthop structure */
- struct bgp_label_per_nexthop_cache *label_nexthop_cache;
+ union {
+ struct bgp_mplsvpn_label_nh blnc;
+ } mplsvpn;
};
/* Structure used in BGP path selection */