Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master: Restore label distribution for VPN safi #527

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bgpd/bgp_label.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ extern int bgp_nlri_parse_label (struct peer *peer, struct attr *attr,
static inline int
bgp_labeled_safi (safi_t safi)
{
if ((safi == SAFI_LABELED_UNICAST) || (safi == SAFI_MPLS_VPN))
if ((safi == SAFI_LABELED_UNICAST) || (safi == SAFI_MPLS_VPN) ||
(safi == SAFI_EVPN))
return 1;
return 0;
}
Expand Down
27 changes: 21 additions & 6 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ subgroup_announce_check (struct bgp_node *rn, struct bgp_info *ri,
}

/* If it's labeled safi, make sure the route has a valid label. */
if (bgp_labeled_safi(safi))
if (safi == SAFI_LABELED_UNICAST)
{
u_char *tag = bgp_adv_label(rn, ri, peer, afi, safi);
if (!bgp_is_valid_label(tag))
Expand Down Expand Up @@ -1941,9 +1941,9 @@ bgp_process_main (struct work_queue *wq, void *data)
* Right now, since we only deal with per-prefix labels, it is not necessary
* to do this upon changes to best path except of the label index changes.
*/
bgp_table_lock (bgp_node_table (rn));
if (bgp_labeled_safi (safi))
if (safi == SAFI_LABELED_UNICAST)
{
bgp_table_lock (bgp_node_table (rn));
if (new_select)
{
if (!old_select ||
Expand Down Expand Up @@ -2848,7 +2848,7 @@ bgp_update (struct peer *peer, struct prefix *p, u_int32_t addpath_id,
new = info_make(type, sub_type, 0, peer, attr_new, rn);

/* Update MPLS tag. */
if (bgp_labeled_safi(safi) || safi == SAFI_EVPN)
if (bgp_labeled_safi(safi))
memcpy ((bgp_info_extra_get (new))->tag, tag, 3);

/* Update Overlay Index */
Expand Down Expand Up @@ -4462,6 +4462,8 @@ bgp_static_redo_import_check (struct bgp *bgp)
afi_t afi;
safi_t safi;
struct bgp_node *rn;
struct bgp_node *rm;
struct bgp_table *table;
struct bgp_static *bgp_static;

/* Use this flag to force reprocessing of the route */
Expand All @@ -4471,8 +4473,21 @@ bgp_static_redo_import_check (struct bgp *bgp)
for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn))
if (rn->info != NULL)
{
bgp_static = rn->info;
bgp_static_update (bgp, &rn->p, bgp_static, afi, safi);
if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) || (safi == SAFI_EVPN))
{
table = rn->info;

for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
{
bgp_static = rm->info;
bgp_static_update_safi (bgp, &rm->p, bgp_static, afi, safi);
}
}
else
{
bgp_static = rn->info;
bgp_static_update (bgp, &rn->p, bgp_static, afi, safi);
}
}
bgp_flag_unset(bgp, BGP_FLAG_FORCE_STATIC_PROCESS);
}
Expand Down
13 changes: 2 additions & 11 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

static struct peer_group *
listen_range_exists (struct bgp *bgp, struct prefix *range, int exact);
#if 0
#define INSTALL_CMD_ON_AF_NODES(cmd) \
install_element(BGP_IPV4_NODE, cmd); \
install_element(BGP_IPV4M_NODE, cmd); \
install_element(BGP_IPV4L_NODE, cmd); \
install_element(BGP_IPV6_NODE, cmd); \
install_element(BGP_IPV6M_NODE, cmd); \
install_element(BGP_IPV6L_NODE, cmd); \
install_element(BGP_VPNV4_NODE, cmd);
#endif

static enum node_type
bgp_node_type (afi_t afi, safi_t safi)
{
Expand Down Expand Up @@ -111,7 +102,7 @@ bgp_node_type (afi_t afi, safi_t safi)
return BGP_VPNV6_NODE;
break;
case SAFI_ENCAP:
return BGP_ENCAP_NODE;
return BGP_ENCAPV6_NODE;
break;
}
break;
Expand Down
1 change: 1 addition & 0 deletions bgpd/rfapi/rfapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ add_vnc_route (
bgp, prd, table, p, new);
}
bgp_unlock_node (prn);
encode_label (label_val, bn->local_label);
}

bgp_unlock_node (bn);
Expand Down