summaryrefslogtreecommitdiff
path: root/bgpd/bgp_attr.h
AgeCommit message (Collapse)Author
2025-01-14bgpd: remove unused BATTR_REFLECTED for rmap_change_flagsEnke Chen
Remove unused BATTR_REFLECTED for rmap_change_flags. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2025-01-09bgpd: use igpmetric in bgp_aigp_metric_total()Enke Chen
Use igpmetric from bgp_path_info in bgp_igp_metric_total() to be consistent with all other cases, e.g., as in bgp_path_info_cmp(). Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-22bgpd: Check for the extended community size before setting the flagDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-21bgpd: fix AIGP calculation in route advertisementEnke Chen
Currently the AIGP is always incremented when a route with the attribute is advertised. That is incorrect when the nexthop is unchanged, as is commonly the case in route reflection. Adjust the AIGP for propagation only when the nexthop is set to ourselves. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-16bgpd: fix several issues in sourcing AIGP attributeEnke Chen
Fix several issues in sourcing AIGP attribute: 1) AIGP should not be set as default for a redistributed route or a static network. It should be set by config instead. 2) AIGP sourced by "set aigp-metric igp-metric" in a route-map does not set the correct value for a redistributed route. 3) When redistribute a connected route like loopback, the AGIP (with value 0) is sourced by "set aigp-metric igp-metric", but the attribute is not propagated as the attribute flag is not set. Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-15bgpd: Set MED using a helper bgp_attr_set_med()Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-14bgpd: fix route selection with AIGPEnke Chen
The nexthop metric should be added to AIGP when calculating the bestpath in bgp_path_info_cmp(). Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-09-18bgpd: changes for code maintainabilitysri-mohan1
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-08-24bgpd: Free epvn_overlay memory on errorDonatas Abraitis
When parsing EVPN NLRIs, and an error occurred, do no forget to free the memory. Fixes: 4ace11d010 ("bgpd: Move evpn_overlay to a pointer") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-11bgpd: Move evpn_overlay to a pointerDonatas Abraitis
Before this convertion: ``` /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn evpn_overlay; /* 208 36 */ ``` After this convertion: ``` /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn * evpn_overlay; /* 208 8 */ ``` Saving 28 bytes when EVPN is not used. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-09bgpd: Shrink rmap_change_flags to 2-bytesDonatas Abraitis
4 bytes is not needed for this thing clearly. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-09bgpd: Reduce encap_tunneltype to 1 byteDonatas Abraitis
It's not used as a bitmask, no point to use it as 2 bytes. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-04bgpd: Move sticky, default_gw, router_flag into a single flags variableDonatas Abraitis
Instead of using 3 uint8_t variables under struct attr, let's use a single uint8_t as the flags. Saving 2-bytes. Not a big deal, but it's even easier to track EVPN-related flags/variables. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-06-05bgpd: store number of labels with 8 bitsLouis Scalbert
8 bits are sufficient to store the number of labels because the current maximum is 2. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-27Merge pull request #15782 from opensourcerouting/fix/drop_srte_color_flagRuss White
bgpd: Drop SRTE_COLOR attribute flag
2024-04-22bgpd: Convert 32-bit to 64-bit link bandwidth variable (link_bw)Donatas Abraitis
This is needed to implement and use larger bandwidths rather than limiting only to theoretical 34Gbps max bandwidth. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-17bgpd: Drop SRTE_COLOR attribute flagDonatas Abraitis
SRTE_COLOR is not defined at all as an attribute, it was a mistake from the beginning. SRTE_COLOR is extended community, can't see the reason having it as a community, and a separate attribute. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-04bgpd: fix install BGP route with appropriate colored ext. communityPhilippe Guibert
When receiving a BGP update that includes a colored extended community, the nexthop is tracked in the bgp nexthop tracking context, but the color is never recorded. Adding to this, the BGP route is not prevented from being installed without hte color. Actually, the srte color is set only when the SRTE_COLOR attribute is set. And that attribute value is only set when an ext. community is locally created, or an srte value is set, but not when a BGP update with a color ext. community is received. Fix this by setting the SRTE_COLOR attribute on this last case. Fixes: 442e2edcfaef ("bgpd: add functions related to srte_color management") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-02-22bgpd: move mp_nexthop_prefer_global boolean attribute to nh_flagsLouis Scalbert
Move mp_nexthop_prefer_global boolean attribute to nh_flags. It does not currently save memory because of the packing. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-14bgpd: update route leak when vrf state changesLouis Scalbert
Locally leaked routes remain active after the nexthop VRF interface goes down. Update route leaking when the loopback or a VRF interface state change is received from zebra. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-01bgpd: One more attr struct memory optimizationDonatas Abraitis
``` struct attr { struct aspath * aspath; /* 0 8 */ struct community * community; /* 8 8 */ long unsigned int refcnt; /* 16 8 */ _uint64_t flag; /* 24 8 */ struct in_addr nexthop; /* 32 4 */ uint32_t med; /* 36 4 */ uint32_t local_pref; /* 40 4 */ ifindex_t nh_ifindex; /* 44 4 */ uint8_t nh_flags; /* 48 1 */ uint8_t origin; /* 49 1 */ uint8_t es_flags; /* 50 1 */ uint8_t router_flag; /* 51 1 */ uint8_t distance; /* 52 1 */ uint8_t df_alg; /* 53 1 */ uint16_t df_pref; /* 54 2 */ enum pta_type pmsi_tnl_type; /* 56 4 */ uint32_t rmap_change_flags; /* 60 4 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct in6_addr mp_nexthop_global; /* 64 16 */ struct in6_addr mp_nexthop_local; /* 80 16 */ ifindex_t nh_lla_ifindex; /* 96 4 */ mpls_label_t label; /* 100 4 */ struct ecommunity * ecommunity; /* 104 8 */ struct ecommunity * ipv6_ecommunity; /* 112 8 */ struct lcommunity * lcommunity; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ struct cluster_list * cluster1; /* 128 8 */ struct transit * transit; /* 136 8 */ struct in_addr mp_nexthop_global_in; /* 144 4 */ struct in_addr aggregator_addr; /* 148 4 */ struct in_addr originator_id; /* 152 4 */ uint32_t weight; /* 156 4 */ as_t aggregator_as; /* 160 4 */ uint8_t mp_nexthop_len; /* 164 1 */ uint8_t mp_nexthop_prefer_global; /* 165 1 */ uint8_t sticky; /* 166 1 */ uint8_t default_gw; /* 167 1 */ route_tag_t tag; /* 168 4 */ uint32_t label_index; /* 172 4 */ struct bgp_attr_srv6_vpn * srv6_vpn; /* 176 8 */ struct bgp_attr_srv6_l3vpn * srv6_l3vpn; /* 184 8 */ /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn evpn_overlay; /* 208 36 */ uint32_t mm_seqnum; /* 244 4 */ uint32_t mm_sync_seqnum; /* 248 4 */ struct ethaddr rmac; /* 252 6 */ /* --- cacheline 4 boundary (256 bytes) was 2 bytes ago --- */ uint16_t encap_tunneltype; /* 258 2 */ uint32_t rmap_table_id; /* 260 4 */ uint32_t link_bw; /* 264 4 */ esi_t esi; /* 268 10 */ /* XXX 2 bytes hole, try to pack */ uint32_t srte_color; /* 280 4 */ enum nexthop_types_t nh_type; /* 284 4 */ enum blackhole_type bh_type; /* 288 4 */ uint32_t otc; /* 292 4 */ _uint64_t aigp_metric; /* 296 8 */ /* size: 304, cachelines: 5, members: 54 */ /* sum members: 302, holes: 1, sum holes: 2 */ /* last cacheline: 48 bytes */ }; /* saved 8 bytes! */ ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-30Merge pull request #15250 from opensourcerouting/fix/memory_optimizationsDonald Sharp
bgpd: Some memory optimizations
2024-01-30bgpd: Optimize memory usage for attr structDonatas Abraitis
``` struct attr { struct aspath * aspath; /* 0 8 */ struct community * community; /* 8 8 */ long unsigned int refcnt; /* 16 8 */ _uint64_t flag; /* 24 8 */ struct in_addr nexthop; /* 32 4 */ uint32_t med; /* 36 4 */ uint32_t local_pref; /* 40 4 */ ifindex_t nh_ifindex; /* 44 4 */ uint8_t origin; /* 48 1 */ uint8_t es_flags; /* 49 1 */ uint8_t router_flag; /* 50 1 */ uint8_t default_gw; /* 51 1 */ enum pta_type pmsi_tnl_type; /* 52 4 */ uint32_t rmap_change_flags; /* 56 4 */ struct in6_addr mp_nexthop_global; /* 60 16 */ /* --- cacheline 1 boundary (64 bytes) was 12 bytes ago --- */ struct in6_addr mp_nexthop_local; /* 76 16 */ ifindex_t nh_lla_ifindex; /* 92 4 */ struct ecommunity * ecommunity; /* 96 8 */ struct ecommunity * ipv6_ecommunity; /* 104 8 */ struct lcommunity * lcommunity; /* 112 8 */ struct cluster_list * cluster1; /* 120 8 */ /* --- cacheline 2 boundary (128 bytes) --- */ struct transit * transit; /* 128 8 */ struct in_addr mp_nexthop_global_in; /* 136 4 */ struct in_addr aggregator_addr; /* 140 4 */ struct in_addr originator_id; /* 144 4 */ uint32_t weight; /* 148 4 */ as_t aggregator_as; /* 152 4 */ uint8_t mp_nexthop_len; /* 156 1 */ uint8_t mp_nexthop_prefer_global; /* 157 1 */ uint8_t sticky; /* 158 1 */ uint8_t distance; /* 159 1 */ uint16_t encap_tunneltype; /* 160 2 */ uint8_t df_alg; /* 162 1 */ /* XXX 1 byte hole, try to pack */ route_tag_t tag; /* 164 4 */ uint32_t label_index; /* 168 4 */ mpls_label_t label; /* 172 4 */ struct bgp_attr_srv6_vpn * srv6_vpn; /* 176 8 */ struct bgp_attr_srv6_l3vpn * srv6_l3vpn; /* 184 8 */ /* --- cacheline 3 boundary (192 bytes) --- */ struct bgp_attr_encap_subtlv * encap_subtlvs; /* 192 8 */ struct bgp_attr_encap_subtlv * vnc_subtlvs; /* 200 8 */ struct bgp_route_evpn evpn_overlay; /* 208 36 */ uint32_t mm_seqnum; /* 244 4 */ uint32_t mm_sync_seqnum; /* 248 4 */ struct ethaddr rmac; /* 252 6 */ /* --- cacheline 4 boundary (256 bytes) was 2 bytes ago --- */ uint16_t df_pref; /* 258 2 */ uint32_t rmap_table_id; /* 260 4 */ uint32_t link_bw; /* 264 4 */ esi_t esi; /* 268 10 */ /* XXX 2 bytes hole, try to pack */ uint32_t srte_color; /* 280 4 */ uint32_t otc; /* 284 4 */ enum nexthop_types_t nh_type; /* 288 4 */ enum blackhole_type bh_type; /* 292 4 */ _uint64_t aigp_metric; /* 296 8 */ /* size: 304, cachelines: 5, members: 53 */ /* sum members: 301, holes: 2, sum holes: 3 */ /* last cacheline: 48 bytes */ }; /* saved 16 bytes! */ ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-29bgpd: fix VRF leaking with 'network import-check' (3/4)Louis Scalbert
If 'bgp network import-check' is defined on the source BGP session, prefixes that are defined with the network command cannot be leaked to the other VRFs BGP table even if they are present in the origin VRF RIB if the 'rt import' statement is defined after the 'network <prefix>' ones. When a prefix nexthop is updated, update the prefix route leaking. The current state of nexthop validation is now stored in the attributes of the bgp path info. Attributes are compared with the previous ones at route leaking update so that a nexthop validation change now triggers the update of destination VRF BGP table. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-10-31bgpd: Ignore handling NLRIs if we received MP_UNREACH_NLRIDonatas Abraitis
If we receive MP_UNREACH_NLRI, we should stop handling remaining NLRIs if no mandatory path attributes received. In other words, if MP_UNREACH_NLRI received, the remaining NLRIs should be handled as a new data, but without mandatory attributes, it's a malformed packet. In normal case, this MUST not happen at all, but to avoid crashing bgpd, we MUST handle that. Reported-by: Iggy Frankovic <iggyfran@amazon.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-24bgpd: Handle MP_REACH_NLRI malformed packets with session resetDonatas Abraitis
Avoid crashing bgpd. ``` (gdb) bgp_mp_reach_parse (args=<optimized out>, mp_update=0x7fffffffe140) at bgpd/bgp_attr.c:2341 2341 stream_get(&attr->mp_nexthop_global, s, IPV6_MAX_BYTELEN); (gdb) stream_get (dst=0x7fffffffe1ac, s=0x7ffff0006e80, size=16) at lib/stream.c:320 320 { (gdb) 321 STREAM_VERIFY_SANE(s); (gdb) 323 if (STREAM_READABLE(s) < size) { (gdb) 34 return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); (gdb) Thread 1 "bgpd" received signal SIGSEGV, Segmentation fault. 0x00005555556e37be in route_set_aspath_prepend (rule=0x555555aac0d0, prefix=0x7fffffffe050, object=0x7fffffffdb00) at bgpd/bgp_routemap.c:2282 2282 if (path->attr->aspath->refcnt) (gdb) ``` With the configuration: ``` neighbor 127.0.0.1 remote-as external neighbor 127.0.0.1 passive neighbor 127.0.0.1 ebgp-multihop neighbor 127.0.0.1 disable-connected-check neighbor 127.0.0.1 update-source 127.0.0.2 neighbor 127.0.0.1 timers 3 90 neighbor 127.0.0.1 timers connect 1 address-family ipv4 unicast redistribute connected neighbor 127.0.0.1 default-originate neighbor 127.0.0.1 route-map RM_IN in exit-address-family ! route-map RM_IN permit 10 set as-path prepend 200 exit ``` Reported-by: Iggy Frankovic <iggyfran@amazon.com> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-10Revert "bgpd: store and send bgp link-state attributes"Donald Sharp
This reverts commit 8b531b110756bf8627b5716f433190a0748b5e76.
2023-09-18bgpd: store and send bgp link-state attributesLouis Scalbert
Add the ability to store a raw copy of the incoming BGP Link-State attributes and to redistribute them as is to other routes. New types of data BGP_ATTR_LS and BGP_ATTR_LS_DATA are defined. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-08-03bgpd: Use SET_FLAG when setting AIGP attribute flagDonatas Abraitis
Just reuse an existing more-readable code. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-03bgpd: Handle cluster attribute the same way as others using setters/gettersDonatas Abraitis
To be consistent and error-safe. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-06-27Merge pull request #13722 from fdumontet6WIND/color_extcommDonatas Abraitis
bgpd,lib,yang: add colored extended communities support
2023-06-26bgpd: add functions related to srte_color managementFrancois Dumontet
Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2023-05-30bgpd: add EVPN reimport handler for martian changeTrey Aspelund
Adds a generalized martian reimport function used for triggering a relearn/reimport of EVPN routes that were previously filtered/deleted as a result of a "self" check (either during import or by a martian change handler). The MAC-VRF SoO is the first consumer of this function, but can be expanded for use with Martian Tunnel-IPs, Interface-IPs, Interface-MACs, and RMACs. Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01bgpd: Add `neighbor path-attribute treat-as-withdraw` commandDonatas Abraitis
To filter out routes with unwanted prefixes. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-22bgpd: Add missing `no` form for `neighbor path-attribute discard` cmdDonatas Abraitis
Just forgot this _somehow_ :) Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-14bgpd: Add `neighbor path-attribute discard` commandDonatas Abraitis
The idea is to drop unwanted attributes from the BGP UPDATE messages and continue by just ignoring them. This improves the security, flexiblity, etc. This is the command that Cisco has also. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-13Revert "Merge pull request #11127 from louis-6wind/bgp-leak"Donald Sharp
This reverts commit 16aa1809e7c8caad37e8edd4e5aaac4f344bc7d3, reversing changes made to f616e716089b16d9a678846282a6ac5c55e31a56.
2022-12-16bgpd: resend routes deleted by kernel after interface addresses deletionLouis Scalbert
When the last IPv4 address of an interface is deleted, Linux removes all routes includes BGP ones using this interface without any Netlink advertisement. bgpd keeps them in RIB as valid (e.g. installed in FIB). The previous patch invalidates the associated nexthop groups in zebra but bgpd is not notified of the event. > 2022/05/09 17:37:52.925 ZEBRA: [TQKA8-0276P] Not Notifying Owner: connected about prefix 29.0.0.0/24(40) 3 vrf: 7 Look for the bgp_path_info that are unsynchronized with the kernel and flag them for refresh in their attributes. A VPN route leaking update is calles and the refresh flag triggers a route refresh to zebra and then a kernel FIB installation. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-16bgpd: move mp_nexthop_prefer_global boolean attribute to nh_flagLouis Scalbert
Previous commits have introduced a new 8 bits nh_flag in the attr struct that has increased the memory footprint. Move the mp_nexthop_prefer_global boolean in the attr structure that takes 8 bits to the new nh_flag in order to go back to the previous memory utilization. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-16bgpd: update route leaking when a VRF loopback is receivedLouis Scalbert
At bgpd startup, VRF instances are sent from zebra before the interfaces. When importing a l3vpn prefix from another local VRF instance, the interfaces are not known yet. The prefix nexthop interface cannot be set to the loopback or the VRF interface, which causes setting invalid routes in zebra. Update route leaking when the loopback or a VRF interface is received from zebra. At a VRF interface deletion, zebra voluntarily sends a ZEBRA_INTERFACE_ADD message to move it to VRF_DEFAULT. Do not update if such a message is received. VRF destruction will destroy all the related routes without adding codes. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-12-16bgpd: fix prefix VRF leaking with 'network import-check' (4/5)Louis Scalbert
If 'network import-check' is defined on the source BGP session, prefixes that are stated in the network command cannot be leaked to the other VRFs BGP table even if they are present in the origin VRF RIB if the 'rt import' statement is defined after the 'network <prefix>' ones. When a prefix nexthop is updated, update the prefix route leaking. The current state of nexthop validation is now stored in the attributes of the bgp path info. Attributes are compared with the previous ones at route leaking update so that a nexthop validation change now triggers the update of destination VRF BGP table. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-11-18bgpd: Convert bgp_rmap_nhop_changed to bool from intDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-18bgpd: Allow overriding MPLS VPN next-hops via route-mapsDonatas Abraitis
Just do not reset next-hop for MPLS VPN routes. Example of 172.16.255.1/32 (using extended next-hop capability): ``` pe2# sh bgp ipv4 vpn BGP table version is 4, local router ID is 10.10.10.20, vrf id 0 Default local pref 100, local AS 65001 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path Route Distinguisher: 192.168.1.2:2 *>i10.0.0.0/24 2001:db8:1::1 0 100 0 65000 ? UN=2001:db8:1::1 EC{192.168.1.2:2} label=1111 type=bgp, subtype=0 *>i172.16.255.1/32 2001:db8::1 0 100 0 65000 ? UN=2001:db8::1 EC{192.168.1.2:2} label=1111 type=bgp, subtype=0 *>i192.168.1.0/24 2001:db8:1::1 0 100 0 65000 ? UN=2001:db8:1::1 EC{192.168.1.2:2} label=1111 type=bgp, subtype=0 *>i192.168.2.0/24 2001:db8:1::1 100 0 65000 ? UN=2001:db8:1::1 EC{192.168.1.2:2} label=1111 type=bgp, subtype=0 Route Distinguisher: 192.168.2.2:2 *> 10.0.0.0/24 192.168.2.1@4< 0 50 0 65000 ? UN=192.168.2.1 EC{192.168.2.2:2} label=2222 type=bgp, subtype=5 *> 172.16.255.1/32 192.168.2.1@4< 50 0 65000 ? UN=192.168.2.1 EC{192.168.2.2:2} label=2222 type=bgp, subtype=5 *> 192.168.1.0/24 192.168.2.1@4< 50 0 65000 ? UN=192.168.2.1 EC{192.168.2.2:2} label=2222 type=bgp, subtype=5 *> 192.168.2.0/24 192.168.2.1@4< 0 50 0 65000 ? UN=192.168.2.1 EC{192.168.2.2:2} label=2222 type=bgp, subtype=5 Displayed 8 routes and 8 total paths ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-26bgpd: Implement Accumulated IGP Metric Attribute for BGPDonatas Abraitis
https://www.rfc-editor.org/rfc/rfc7311.html Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-07bgpd: save srv6_locator_chunk in vpn_policyRyoga Saito
In order to send correct SRv6 L3VPN advertisement, we need to save srv6_locator_chunk in vpn_policy. With this information, we can construct correct SRv6 L3VPN advertisement packets. Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-09-05bgpd: add resolution for l3vpn traffic over gre interfacesPhilippe Guibert
When a route imported from l3vpn is analysed, the nexthop from default VRF is looked up against a valid MPLS path. Generally, this is done on backbones with a MPLS signalisation transport layer like LDP. Generally, the BGP connection is multiple hops away. That scenario is already working. There is case where it is possible to run L3VPN over GRE interfaces, and where there is no LSP path over that GRE interface: GRE is just here to tunnel MPLS traffic. On that case, the nexthop given in the path does not have MPLS path, but should be authorized to convey MPLS traffic provided that the user permits it via a configuration command. That commit introduces a new command that can be activated in route-map: > set l3vpn next-hop encapsulation gre That command authorizes the nexthop tracking engine to accept paths that o have a GRE interface as output, independently of the presence of an LSP path or not. A configuration example is given below. When bgp incoming vpnv4 updates are received, the nexthop of NLRI is 192.168.0.2. Based on nexthop tracking service from zebra, BGP knows that the output interface to reach 192.168.0.2 is r1-gre0. Because that interface is not MPLS based, but is a GRE tunnel, then the update will be using that nexthop to be installed. interface r1-gre0 ip address 192.168.0.1/24 exit router bgp 65500 bgp router-id 1.1.1.1 neighbor 192.168.0.2 remote-as 65500 ! address-family ipv4 unicast no neighbor 192.168.0.2 activate exit-address-family ! address-family ipv4 vpn neighbor 192.168.0.2 activate neighbor 192.168.0.2 route-map rmap in exit-address-family exit ! router bgp 65500 vrf vrf1 bgp router-id 1.1.1.1 no bgp network import-check ! address-family ipv4 unicast network 10.201.0.0/24 redistribute connected label vpn export 101 rd vpn export 444:1 rt vpn both 52:100 export vpn import vpn exit-address-family exit ! route-map rmap permit 1 set l3vpn next-hop encapsulation gre exit Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-06-17bgpd: Add RFC9234 implementationEugene Bogomazov
RFC9234 is a way to establish correct connection roles (Customer/ Provider, Peer or with RS) between bgp speakers. This patch: - Add a new configuration/terminal option to set the appropriate local role; - Add a mechanism for checking used roles, implemented by exchanging the corresponding capabilities in OPEN messages; - Add strict mode to force other party to use this feature; - Add basic support for a new transitive optional bgp attribute - OTC (Only to Customer); - Add logic for default setting OTC attribute and filtering routes with this attribute by the edge speakers, if the appropriate conditions are met; - Add two test stands to check role negotiation and route filtering during role usage. Signed-off-by: Eugene Bogomazov <eb@qrator.net>
2022-06-06bgpd: Initialize attr->local_pref to the configured default valueDonatas Abraitis
When we use network/redistribute local_preference is configured inproperly when using route-maps something like: ``` network 100.100.100.100/32 route-map rm1 network 100.100.100.200/32 route-map rm2 route-map rm1 permit 10 set local-preference +10 route-map rm2 permit 10 set local-preference -10 ``` Before: ``` root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf' 10 root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf' 0 ``` After: ``` root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf' 110 root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf' 90 ``` Set local-preference as the default value configured per BGP instance, but do not set LOCAL_PREF flag by default. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>