mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-05 23:49:42 +00:00
bgpd: Only set bgp_labels in bgp_update if we have num_labels
In the interest of speeding up code, there is no point in attempting to see if a label is usable if the number of labels passed in is 0. Since that is a much much quicker test than the bgp_is_valid_label() call, let's test that first. Additionally, there is no point in walking the label[] array passed in unless we are in the if statement, so move it inside. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
852e6c327d
commit
d9fd4901f0
@ -4667,11 +4667,12 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
|
|||||||
bgp = peer->bgp;
|
bgp = peer->bgp;
|
||||||
dest = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
|
dest = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, prd);
|
||||||
|
|
||||||
if ((afi == AFI_L2VPN && safi == SAFI_EVPN) ||
|
if (num_labels &&
|
||||||
bgp_is_valid_label(&label[0]))
|
((afi == AFI_L2VPN && safi == SAFI_EVPN) || bgp_is_valid_label(&label[0]))) {
|
||||||
bgp_labels.num_labels = num_labels;
|
bgp_labels.num_labels = num_labels;
|
||||||
for (i = 0; i < bgp_labels.num_labels; i++)
|
for (i = 0; i < bgp_labels.num_labels; i++)
|
||||||
bgp_labels.label[i] = label[i];
|
bgp_labels.label[i] = label[i];
|
||||||
|
}
|
||||||
|
|
||||||
/* When peer's soft reconfiguration enabled. Record input packet in
|
/* When peer's soft reconfiguration enabled. Record input packet in
|
||||||
Adj-RIBs-In. */
|
Adj-RIBs-In. */
|
||||||
|
Loading…
Reference in New Issue
Block a user