mirror_frr/bgpd
Philippe Guibert 577be36a41 bgpd: add support for l3vpn per-nexthop label
This commit introduces a new method to associate a label to
prefixes to export to a VPNv4 backbone. All the methods to
associate a label to a BGP update is documented in rfc4364,
chapter 4.3.2. Initially, the "single label for an entire
VRF" method was available. This commit adds "single label
for each attachment circuit" method.

The change impacts the control-plane, because each BGP update
is checked to know if the nexthop has reachability in the VRF
or not. If this is the case, then a unique label for a given
destination IP in the VRF will be picked up. This label will
be reused for an other BGP update that will have the same
nexthop IP address.

The change impacts the data-plane, because the MPLs pop
mechanism applied to incoming labelled packets changes: the
MPLS label is popped, and the packet is directly sent to the
connected nexthop described in the previous outgoing BGP VPN
update.

By default per-vrf mode is done, but the user may choose
the per-nexthop mode, by using the vty command from the
previous commit. In the latter case, a per-vrf label
will however be allocated to handle networks that are not directly
connected. This is the case for local traffic for instance.

The change also include the following:

-  ECMP case
In case a route is learnt in a given VRF, and is resolved via an
ECMP nexthop. This implies that when exporting the route as a BGP
update, if label allocation per nexthop is used, then two possible
MPLS values could be picked up, which is not possible with the
current implementation. Actually, the NLRI for VPNv4 stores one
prefix, and one single label value, not two. Today, RFC8277 with
multiple label capability is not yet available.
To avoid this corner case, when a route is resolved via more than one
nexthop, the label allocation per nexthop will not apply, and the
default per-vrf label will be chosen.
Let us imagine BGP redistributes a static route using the `172.31.0.20`
nexthop. The nexthop resolution will find two different nexthops fo a
unique BGP update.

 > r1# show running-config
 > [..]
 > vrf vrf1
 >  ip route 172.31.0.30/32 172.31.0.20
 > r1# show bgp vrf vrf1 nexthop
 > [..]
 > 172.31.0.20 valid [IGP metric 0], #paths 1
 >  gate 192.0.2.11
 >  gate 192.0.2.12
 >  Last update: Mon Jan 16 09:27:09 2023
 >  Paths:
 >    1/1 172.31.0.30/32 VRF vrf1 flags 0x20018

To avoid this situation, BGP updates that resolve over multiple
nexthops are using the unique per-vrf label.

- recursive route case

Prefixes that need a recursive route to be resolved can
also be eligible for mpls allocation per nexthop. In that
case, the nexthop will be the recursive nexthop calculated.

To achieve this, all nexthop types in bnc contexts are valid,
except for the blackhole nexthops.

- network declared prefixes

Nexthop tracking is used to look for the reachability of the
prefixes. When the the 'no bgp network import-check' command
is used, network declared prefixes are maintained active,
even if there is no active nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-05-09 21:00:57 +02:00
..
rfapi bgpd: rfapi memleak fixes 2023-04-11 12:27:36 -07:00
rfp-example *: Convert struct event_master to struct event_loop 2023-03-24 08:32:17 -04:00
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
bgp_addpath_types.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_addpath.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_addpath.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_advertise.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_advertise.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_aspath.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
bgp_aspath.h Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_attr_evpn.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_attr_evpn.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_attr.c bgpd: Make sure AIGP attribute is non-transitive 2023-05-08 23:20:04 +03:00
bgp_attr.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
bgp_bfd.c doc: Add missing rfc9384 to BGP supported RFC list 2023-04-01 21:56:37 +03:00
bgp_bfd.h *: Convert struct event_master to struct event_loop 2023-03-24 08:32:17 -04:00
bgp_bmp.c bgpd: bmp fix peer-up ports byte order 2023-04-03 17:19:32 +02:00
bgp_bmp.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_btoa.c Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_clist.c bgpd: Deprecate BGP internet community 2023-02-17 18:53:01 +02:00
bgp_clist.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_community_alias.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
bgp_community_alias.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_community.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
bgp_community.h bgpd: Deprecate BGP internet community 2023-02-17 18:53:01 +02:00
bgp_conditional_adv.c *: Convert THREAD_XXX macros to EVENT_XXX macros 2023-03-24 08:32:17 -04:00
bgp_conditional_adv.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_damp.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_damp.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_debug.c Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_debug.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_dump.c bgpd: increase buffer size used for dumping BGP to MRT files 2023-03-30 14:23:48 +01:00
bgp_dump.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_ecommunity.c bgpd: fix show running of nt extcommunity 2023-05-05 17:50:36 +02:00
bgp_ecommunity.h bgpd: Reuse encode_route_target_ip() function 2023-04-14 22:33:34 +03:00
bgp_encap_tlv.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_encap_tlv.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_encap_types.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_errors.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_errors.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_evpn_mh.c bgpd:add correct value into dfAlgorithm json output 2023-04-16 10:29:09 -07:00
bgp_evpn_mh.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_evpn_private.h bgpd: Drop afi_t from bgp_evpn_global_node_lookup() 2023-03-14 12:05:58 +02:00
bgp_evpn_vty.c bgpd: Ensure bgp_vrf is non-null 2023-04-21 08:04:06 -04:00
bgp_evpn_vty.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_evpn.c Merge pull request #13310 from opensourcerouting/feature/bgpd_node_target_extended_community 2023-04-25 11:06:23 -04:00
bgp_evpn.h bgpd: Treat withdraw variable as a bool 2023-04-06 17:41:32 -04:00
bgp_filter.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_filter.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_flowspec_private.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_flowspec_util.c bgpd: add some flowspec sanity returns 2023-04-28 22:28:16 +02:00
bgp_flowspec_util.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_flowspec_vty.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_flowspec.c bgpd: Treat withdraw variable as a bool 2023-04-06 17:41:32 -04:00
bgp_flowspec.h bgpd: Treat withdraw variable as a bool 2023-04-06 17:41:32 -04:00
bgp_fsm.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_fsm.h *: Convert thread_cancelXXX to event_cancelXXX 2023-03-24 08:32:17 -04:00
bgp_io.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_io.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_keepalives.c *: Convert THREAD_XXX macros to EVENT_XXX macros 2023-03-24 08:32:17 -04:00
bgp_keepalives.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_label.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_label.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_labelpool.c bgpd: add the bgp_label_per_nexthop_cache struct and apis 2023-05-09 21:00:57 +02:00
bgp_labelpool.h bgpd: add the bgp_label_per_nexthop_cache struct and apis 2023-05-09 21:00:57 +02:00
bgp_lcommunity.c bgpd: Fix lcom->str string length to correctly cover aliases 2023-04-20 16:51:56 -04:00
bgp_lcommunity.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_mac.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
bgp_mac.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_main.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_memory.c Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
bgp_memory.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
bgp_mpath.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_mpath.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_mplsvpn_snmp.c bgpd: Coverity mistakenly believes we can fall through 2023-04-21 07:57:19 -04:00
bgp_mplsvpn_snmp.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_mplsvpn.c bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_mplsvpn.h bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_network.c Merge pull request #13084 from opensourcerouting/fix/bgp_vrf_md5_password 2023-03-26 08:21:31 -04:00
bgp_network.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_nexthop.c bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_nexthop.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_nht.c bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_nht.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_open.c Merge pull request #12953 from donaldsharp/struct_event 2023-03-24 13:48:53 -05:00
bgp_open.h Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
bgp_packet.c bgpd: Treat withdraw variable as a bool 2023-04-06 17:41:32 -04:00
bgp_packet.h bgpd: Treat withdraw variable as a bool 2023-04-06 17:41:32 -04:00
bgp_pbr.c *: Add a hash_clean_and_free() function 2023-03-21 08:54:21 -04:00
bgp_pbr.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_rd.c Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_rd.h Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_regex.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_regex.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_route.c bgpd: remove ATTR_NEXT_HOP for redistributed ipv6 nexthops 2023-05-09 21:00:57 +02:00
bgp_route.h bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_routemap_nb_config.c bgpd: Implement Node Target Extended Communities 2023-04-14 21:04:40 +03:00
bgp_routemap_nb.c bgpd: Implement Node Target Extended Communities 2023-04-14 21:04:40 +03:00
bgp_routemap_nb.h bgpd: Implement Node Target Extended Communities 2023-04-14 21:04:40 +03:00
bgp_routemap.c bgpd: Implement Node Target Extended Communities 2023-04-14 21:04:40 +03:00
bgp_rpki.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_rpki.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_script.c Merge pull request #12248 from pguibert6WIND/bgpasdot 2023-02-21 08:01:03 -05:00
bgp_script.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_snmp_bgp4.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_snmp_bgp4.h *: Convert struct event_master to struct event_loop 2023-03-24 08:32:17 -04:00
bgp_snmp_bgp4v2.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_snmp_bgp4v2.h *: Convert struct event_master to struct event_loop 2023-03-24 08:32:17 -04:00
bgp_snmp.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_snmp.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_table.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_table.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_trace.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
bgp_trace.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_updgrp_adv.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_updgrp_packet.c *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
bgp_updgrp.c bgpd: Remove unnecessary check for groups 2023-04-16 13:52:35 +08:00
bgp_updgrp.h *: Rename struct thread to struct event 2023-03-24 08:32:17 -04:00
bgp_vnc_types.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_vpn.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_vpn.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
bgp_vty.c bgpd: add vty command to select label allocation per nexthop 2023-05-09 21:00:57 +02:00
bgp_vty.h Merge pull request #12805 from karlquan/kquan_self_orig 2023-02-21 08:38:07 -05:00
bgp_zebra.c bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgp_zebra.h bgpd: add support for l3vpn per-nexthop label 2023-05-09 21:00:57 +02:00
bgpd.c bgpd: add the bgp_label_per_nexthop_cache struct and apis 2023-05-09 21:00:57 +02:00
bgpd.h bgpd: add the bgp_label_per_nexthop_cache struct and apis 2023-05-09 21:00:57 +02:00
Makefile build: non-recursive bgpd & rfp 2018-09-08 21:25:59 +02:00
subdir.am Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00