vrf: Clones VPN paths with different RD and matched RTs #1656
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When VPN routes are shared between different VPNs (or VRFs) for example, the RDs assigned for each VRF can differ from others, but the same RT should be used. In this case, the duplicated IP unicast routes can be selected as the best path because VPN prefix ":" is different and GoBGP calculates the best path on the global table context. For example,
The both of the above VRF routes are selected as the best path unexpectedly.
This patch clones the received VPN path before installing the global table and overwrites the RD of the cloned paths by the RD of the matched VRFs. Also filters out the duplicated path on each VRF.
Note: This feature only takes effect for only MPLS VPNv4/v6 routes and does not have any for other address families which have RD on its NLRI (e.g., EVPN, FlowSpec for VPN).