]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
17 months agoMerge pull request #12458 from liron-ze/aggre-route-withdraw
Donatas Abraitis [Wed, 4 Jan 2023 20:50:16 +0000 (22:50 +0200)]
Merge pull request #12458 from liron-ze/aggre-route-withdraw

bgpd: Fix aggregated routes are withdrawn abnormally.

17 months agoMerge pull request #12571 from Shikugawa/ospfd-json
Donatas Abraitis [Wed, 4 Jan 2023 20:45:34 +0000 (22:45 +0200)]
Merge pull request #12571 from Shikugawa/ospfd-json

ospfd: show ospf database info using formatted json

17 months agoMerge pull request #12589 from mjstapp/fix_zeb_typos
Donatas Abraitis [Wed, 4 Jan 2023 20:38:55 +0000 (22:38 +0200)]
Merge pull request #12589 from mjstapp/fix_zeb_typos

zebra: fix a couple of typos

17 months agoMerge pull request #12581 from cscarpitta/fix/fix-wrong-interface-name-srv6l3vpn...
Rafael Zalamena [Wed, 4 Jan 2023 16:30:48 +0000 (13:30 -0300)]
Merge pull request #12581 from cscarpitta/fix/fix-wrong-interface-name-srv6l3vpn-topotest

tests: Fix wrong interface name in `bgp_srv6l3vpn_route_leak` topotest

17 months agozebra: fix a couple of typos
Mark Stapp [Tue, 3 Jan 2023 15:46:01 +0000 (10:46 -0500)]
zebra: fix a couple of typos

Fix a couple of typos in vty prompt and output text.

Signed-off-by: Mark Stapp <mjs@labn.net>
17 months agoMerge pull request #12318 from gpnaveen/bgp_unique_rid
Donatas Abraitis [Tue, 3 Jan 2023 20:18:14 +0000 (22:18 +0200)]
Merge pull request #12318 from gpnaveen/bgp_unique_rid

tests: adding bgp unique router id automation.

17 months agoospfd: show ospf database info using formatted json
Rei Shimizu [Wed, 28 Dec 2022 08:09:37 +0000 (08:09 +0000)]
ospfd: show ospf database info using formatted json

Signed-off-by: Rei Shimizu <rshimizu@apache.org>
17 months agoMerge pull request #12566 from Jafaral/lsa-op
Donatas Abraitis [Mon, 2 Jan 2023 21:12:24 +0000 (23:12 +0200)]
Merge pull request #12566 from Jafaral/lsa-op

ospfd: add advertising router IP to Opaque capability mismatch err msg

17 months agotests: Fix wrong interface name in SRv6 topotest
Carmine Scarpitta [Sat, 31 Dec 2022 12:58:01 +0000 (13:58 +0100)]
tests: Fix wrong interface name in SRv6 topotest

Previously, routes leaked from one VRF to another VRF were associated
with the original nexthop interface.

Commit 14aabc01565a918c223b7811572fae0316810422 replaced the nexthop
interface with the index of incoming VRF interface.

Due to this change, the `bgp_srv6l3vpn_route_leak` topotest always fails
because it still expects the nexthop interface.

This commit fixes the expected interface name in the
`bgp_srv6l3vpn_route_leak` topotest.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
17 months agoMerge pull request #12562 from opensourcerouting/fix/add_frrtrace_points_for_peer_loc...
Russ White [Tue, 27 Dec 2022 20:07:57 +0000 (15:07 -0500)]
Merge pull request #12562 from opensourcerouting/fix/add_frrtrace_points_for_peer_lock_unlock

bgpd: A bit more tracepoints for lttng

17 months agoMerge pull request #12558 from donaldsharp/bgp_static_route_mem_leak
Russ White [Tue, 27 Dec 2022 20:07:17 +0000 (15:07 -0500)]
Merge pull request #12558 from donaldsharp/bgp_static_route_mem_leak

bgpd: static routes are leaked on shutdown

17 months agoMerge pull request #12515 from opensourcerouting/fix/show_ip_bgp_detail_weird_output
Russ White [Tue, 27 Dec 2022 20:05:55 +0000 (15:05 -0500)]
Merge pull request #12515 from opensourcerouting/fix/show_ip_bgp_detail_weird_output

bgpd: Show the real prefix for `show bgp detail`

17 months agoMerge pull request #11127 from louis-6wind/bgp-leak
Russ White [Tue, 27 Dec 2022 19:51:28 +0000 (14:51 -0500)]
Merge pull request #11127 from louis-6wind/bgp-leak

bgpd: multiple fixes for route leaking

17 months agoospfd: add advertising router IP to Opaque capability mismatch error message
Jafar Al-Gharaibeh [Sun, 25 Dec 2022 01:56:29 +0000 (19:56 -0600)]
ospfd: add advertising router IP to Opaque capability mismatch error message

Submitted-by Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
17 months agoMerge pull request #12560 from opensourcerouting/fix/allow_agentx_for_frr-reload
Jafar Al-Gharaibeh [Sun, 25 Dec 2022 01:48:21 +0000 (19:48 -0600)]
Merge pull request #12560 from opensourcerouting/fix/allow_agentx_for_frr-reload

tools: Ignore agentx command for frr-reload.py

17 months agoMerge pull request #12561 from opensourcerouting/feature/update_snmp_documentation
Jafar Al-Gharaibeh [Sun, 25 Dec 2022 01:45:48 +0000 (19:45 -0600)]
Merge pull request #12561 from opensourcerouting/feature/update_snmp_documentation

doc: Add an example of how to query SNMP for BGP

17 months agoMerge pull request #12564 from sysoleg/evpn-doc-fix
Mark Stapp [Fri, 23 Dec 2022 21:17:24 +0000 (16:17 -0500)]
Merge pull request #12564 from sysoleg/evpn-doc-fix

doc: Fix EVPN documentation minor error

17 months agodoc: Fix EVPN documentation minor error
Oleg A. Arkhangelsky [Fri, 23 Dec 2022 17:39:11 +0000 (17:39 +0000)]
doc: Fix EVPN documentation minor error

Signed-off-by: Oleg A. Arkhangelsky <sysoleg@yandex.ru>
17 months agoMerge pull request #12551 from proelbtn/fix-install-srv6-local-routes
Donatas Abraitis [Fri, 23 Dec 2022 12:51:46 +0000 (14:51 +0200)]
Merge pull request #12551 from proelbtn/fix-install-srv6-local-routes

bgpd: Fix announce SRv6 locally-generated routes to Zebra

17 months agobgpd: Add lttng tracepoints for bgp_path_info_add/free
Donatas Abraitis [Thu, 22 Dec 2022 21:58:24 +0000 (23:58 +0200)]
bgpd: Add lttng tracepoints for bgp_path_info_add/free

```
[00:05:25.690812414] (+0.000004699) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 8 }
[00:05:25.690816732] (+0.000004318) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.71/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 9 }
[00:05:25.690821251] (+0.000004519) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.72/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 10 }
[00:05:25.690826050] (+0.000004799) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.13.0/24", peer = "10.0.0.3", dest_lock = 1, peer_lock = 11 }
[00:05:25.690830438] (+0.000004388) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.24.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 12 }
[00:05:25.690834666] (+0.000004228) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.35.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 13 }
[00:05:25.690839145] (+0.000004479) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.67.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 14 }
[00:05:26.361779328] (+0.670940183) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.2/32", peer = "10.0.0.2", dest_lock = 3, peer_lock = 13 }
[00:05:26.361790669] (+0.000011341) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.3/32", peer = "10.0.0.3", dest_lock = 3, peer_lock = 13 }
[00:05:26.361792282] (+0.000001613) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 12 }
[00:05:26.361912420] (+0.000120138) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 12 }
[00:05:26.361914153] (+0.000001733) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 11 }
[00:05:26.361915425] (+0.000001272) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 11 }
[00:05:26.361916878] (+0.000001453) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 10 }
[00:05:26.361920645] (+0.000003767) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 10 }
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: Add lttng tracepoints for peer_lock/peer_unlock
Donatas Abraitis [Thu, 22 Dec 2022 21:07:58 +0000 (23:07 +0200)]
bgpd: Add lttng tracepoints for peer_lock/peer_unlock

```
[23:00:31.231255114] (+0.091943221) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 3 }
[23:00:31.231278048] (+0.000022934) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 4 }
[23:00:31.231280853] (+0.000002805) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 5 }
[23:00:31.231285742] (+0.000004889) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 6 }
[23:00:31.231287526] (+0.000001784) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 7 }
[23:00:31.231291694] (+0.000004168) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 8 }
[23:00:31.231295751] (+0.000004057) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 9 }
[23:00:31.231299599] (+0.000003848) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 10 }
[23:00:31.231304137] (+0.000004538) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 11 }
[23:00:31.231308255] (+0.000004118) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 12 }
[23:00:31.231312182] (+0.000003927) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 13 }
[23:00:31.231316300] (+0.000004118) donatas-pc frr_bgp:bgp_peer_lock: { cpu_id = 18 }, { caller = "bgp_path_info_add", peer = "10.0.0.3", count = 14 }
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #12555 from anlancs/fix/bgp-debug-info
Donatas Abraitis [Thu, 22 Dec 2022 19:24:32 +0000 (21:24 +0200)]
Merge pull request #12555 from anlancs/fix/bgp-debug-info

bgpd: fix one wrong debug log for evpn

17 months agodoc: Add an example of how to query SNMP for BGP
Donatas Abraitis [Thu, 22 Dec 2022 16:25:50 +0000 (18:25 +0200)]
doc: Add an example of how to query SNMP for BGP

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agotools: Ignore agentx command for frr-reload.py
Donatas Abraitis [Thu, 22 Dec 2022 15:55:40 +0000 (17:55 +0200)]
tools: Ignore agentx command for frr-reload.py

agentx can't be disabled once enabled, so we should ignore it for frr-reload.py.

```
$ /usr/lib/frr/frr-reload.py --reload /etc/frr/bgpd.conf --bindir /usr/local/bin
"no agentx" we failed to remove this command
SNMP AgentX support cannot be disabled once enabled
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: bgp_connected_add memory was being leaked in some cases
Donald Sharp [Thu, 22 Dec 2022 00:26:58 +0000 (19:26 -0500)]
bgpd: bgp_connected_add memory was being leaked in some cases

On shutdown, bgp calls an unlock for the bnc connected table,
via the bgp_connected_cleanup function.  This function is
only ever called on shutdown, so we know that bgp is going
away.  The refcount for the connected data can be more than
1.  Let's not worry about the refcount on shutdown and
just delete the nodes instead of leaving them around.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agobgpd: rfapi properly free a couple lists
Donald Sharp [Wed, 21 Dec 2022 20:22:24 +0000 (15:22 -0500)]
bgpd: rfapi properly free a couple lists

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12557 from donaldsharp/getenv_two_times
Rafael Zalamena [Wed, 21 Dec 2022 19:13:23 +0000 (16:13 -0300)]
Merge pull request #12557 from donaldsharp/getenv_two_times

vtysh: Remove double retrieve of env VTYSH_HISTFILE

18 months agobgpd: static routes are leaked on shutdown
Donald Sharp [Wed, 21 Dec 2022 17:11:56 +0000 (12:11 -0500)]
bgpd: static routes are leaked on shutdown

Shutdown of bgp results in both the bgp_path_info,
bgp_dest and bgp_table's not being freed because
the bgp_path_info remains locked.

Effectively static routes are scheduled for deletion but bgp_process
skips the work because the work queue sees that the bgp router
is marked for deletion.  Effectively not doing any work and leaving
data on the floor.

Modify the code when attempting to put into the work queue to
notice and not do so but just unlock the path info.

This is effectively the same as what goes on for normal peering
as that it checks for shutdown and just calls bgp_path_info_free
too.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12540 from manojvn/489527
Donald Sharp [Wed, 21 Dec 2022 13:20:31 +0000 (08:20 -0500)]
Merge pull request #12540 from manojvn/489527

ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackh…

18 months agoMerge pull request #12553 from opensourcerouting/fix-sa-warnings
Donald Sharp [Wed, 21 Dec 2022 13:09:02 +0000 (08:09 -0500)]
Merge pull request #12553 from opensourcerouting/fix-sa-warnings

bgpd: fix static analyzer warning

18 months agovtysh: Remove double retrieve of env VTYSH_HISTFILE
Donald Sharp [Wed, 21 Dec 2022 13:04:34 +0000 (08:04 -0500)]
vtysh: Remove double retrieve of env VTYSH_HISTFILE

The code is double checking the VTYSH_HISTFILE env variable,
additionally clang-15 when running SA over it doesn't fully
understand the code pattern.  Reduce the double check to
one check to reduce program run-time (ha!) and make SA happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agobgpd: fix one wrong debug log for evpn
anlan_cs [Sun, 18 Dec 2022 12:36:41 +0000 (20:36 +0800)]
bgpd: fix one wrong debug log for evpn

Take it into consideration for one debug log:
EVPN MAC-IP routes with a L3 NHG id, has no nexthops.

Not "delete", but "add".

Before:
```
Tx route delete VRF 21 192.168.30.253/32 metric 0 tag 0 count 0 nhg 72580649
```

After:
```
Tx route add VRF 21 192.168.30.253/32 metric 0 tag 0 count 0 nhg 72580649
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
18 months agoMerge pull request #12552 from Jafaral/rel-notes
Donald Sharp [Tue, 20 Dec 2022 20:49:15 +0000 (15:49 -0500)]
Merge pull request #12552 from Jafaral/rel-notes

Release housekeeping

18 months agobgpd: fix static analyzer warnings
Rafael Zalamena [Tue, 20 Dec 2022 18:44:02 +0000 (15:44 -0300)]
bgpd: fix static analyzer warnings

Use `DEFPY` to provide the `struct prefix` required by the debug
insertion functions. While here exchange `int` with `bool` where
appropriated.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
18 months agoMerge pull request #12518 from patrasar/pim_minor_issue
Donatas Abraitis [Tue, 20 Dec 2022 16:21:07 +0000 (18:21 +0200)]
Merge pull request #12518 from patrasar/pim_minor_issue

pimd: Fix (S,G) debug issue

18 months agoMerge pull request #12539 from donaldsharp/bgp_debug_prefix_mem_leak
Russ White [Tue, 20 Dec 2022 16:20:19 +0000 (11:20 -0500)]
Merge pull request #12539 from donaldsharp/bgp_debug_prefix_mem_leak

bgpd: When allocating prefix, free it when we are already tracking it

18 months agoMerge pull request #12531 from opensourcerouting/feature/snmp_tests
Russ White [Tue, 20 Dec 2022 16:19:10 +0000 (11:19 -0500)]
Merge pull request #12531 from opensourcerouting/feature/snmp_tests

bgpd: SNMP IPv6 tests and some fixes

18 months agoMerge pull request #12543 from donaldsharp/ospf_json_mem_leak
Russ White [Tue, 20 Dec 2022 16:15:28 +0000 (11:15 -0500)]
Merge pull request #12543 from donaldsharp/ospf_json_mem_leak

ospfd: Fix some json mem leaks and some issues

18 months agoMerge pull request #12527 from opensourcerouting/ospf-spf-leak2
Russ White [Tue, 20 Dec 2022 16:12:23 +0000 (11:12 -0500)]
Merge pull request #12527 from opensourcerouting/ospf-spf-leak2

ospfd: fix SPF table memory leak

18 months agodebian, redhat: updating changelog for new release
Jafar Al-Gharaibeh [Thu, 3 Nov 2022 03:44:56 +0000 (22:44 -0500)]
debian, redhat: updating changelog for new release

8.4 Release Overview

- New BGP [command](https://docs.frrouting.org/en/latest/bgp.html#clicmd-neighbor-A.B.C.D-X-X-X-X-WORD-soo-EXTCOMMUNITY) (`neighbor PEER soo`) to configure SoO to prevent routing loops and suboptimal routing on dual-homed sites.
- Command `debug bgp allow-martian` replaced to `bgp allow-martian-nexthop` because previously we allowed using martian next-hops when debug is turned on.
- Implement `BGP Prefix Origin Validation State Extended Community` [rfc8097](https://datatracker.ietf.org/doc/rfc8097/)
- Implement `Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages` [rfc9234](https://datatracker.ietf.org/doc/rfc9234/)
- BMP L3VPN support
- PIMv6 support
- MLD support
- New [command](https://docs.frrouting.org/en/latest/basic.html#clicmd-allow-reserved-ranges) to enable using reserved IPv4 ranges as normal addresses for BGP next-hops, interface addresses, etc.
- As usual, lots of bugs and memory leaks were fixed \m/

Changelog
---------

**babeld**
  - Ignore Sub-TLV's with mandatory bit set
  - Ignore unicast Hello's

**bfdd**
  - Add IPv4 BFD Echo support
  - Add RTT to BFD IPv4 Echo packet processing
  - Allow L3 VRF BFD sessions without UDP leaking

**bgpd**
  - Add `mpls bgp forwarding` to ease MPLS-VPN EBGP peering
  - Add `bgp allow-martian-nexthop` command (remove `debug bgp allow-martian`)
  - Add `neighbor soo` command
  - Add `no rpki` command
  - Add `show bgp access-list` command to filter routes by access-list
  - Implement [rfc8097](https://datatracker.ietf.org/doc/rfc8097/)
  - Implement [rfc9234](https://datatracker.ietf.org/doc/rfc9234/)
  - Add resolution for L3VPN traffic over GRE interfaces
  - Allow setting custom port for BGP unnumbered peers
  - Allow statistics gathering to give more data about prefix lengths
  - Apply conditional advertisements policy to update-group
  - Associate appropriate family for redistributed connected addresses
  - Avoid notify race between io and main pthreads
  - Call a hook when as-path filter is replaced
  - Cleanup memory leaks associated with t_deferral_timer
  - Do not check if the whole as-path has target asn when using as-override
  - Do not print new line for EVPN CLI outputs if it's a JSON
  - Do not show polling_period default value in CLI for RPKI
  - Don't advertise conditionally withdrawn routes
  - Drop SSH public key for RPKI CLI option
  - Fix `show bgp nexthop a.b.c.d`
  - Fix for `aggregate-address summary-only matching-med-only`
  - Fix inconsistencies with default-originate route-map
  - Fix memory leak for `as-override`
  - Fix memory leak for `set as-path replace` route-map command
  - Fix memory leak for community alias
  - Fix memory leak for community stuff
  - Fix memory leak in SRv6 locator
  - Fix memory leak when an SRv6 sid is removed
  - Fix memory leak when setting [l]community at the egress
  - Fix route-map update and delete route-map
  - Fix `show bgp l2vpn evpn route rd` crash
  - Fix the wrong next-hop BGP struct for next-hop validation
  - Fixed BMP VPNv4 monitoring are withdrawn instead of updates
  - Fixup PBR rule changes that were missed
  - Fixup some MAC address token CLI syntax
  - Free ecommunity before returning on warning/error
  - Free memory for as-path filter if regexp is wrong
  - Free memory for BMP listeners when deleting BGP instance
  - Generate RPKI CLI config even if no cache servers are configured
  - Handle origin validation state extended community via route-map match
  - Handle route-refresh requests received before EOR
  - Implement retain route-target all behavior
  - Improve labelpool performance at scale
  - Inconsistencies in snt counters with default-originate
  - Prevent memory leak of the listener on shutdown
  - Print peer's hostname for BGP (filtering) messages
  - Print source VRF name when leaking to another VRF
  - Release RCU lock in BGP keepalive pthread
  - Reset BGP sessions when changing the port
  - Send route updates when modifying access/aspath/prefix lists
  - Set TTL for iBGP/eBGP by checking only if generic TTL security applied
  - Show cache server preference in `show rpki cache-server` output
  - Show extended communities memory consumption
  - Show TTL value unconditionally for neighbors
  - Start conditional advertisement timer instantly
  - Stop conditional advertisements thread when terminating
  - Stop LLGR thread when deleting a peer and/or gr flags changed
  - Treat as withdraw if we receive as path with as_set / as_confed_set
  - When specifying listen address for BGP we shouldn't imply no-fib flag
  - Withdraw implicitly old paths from VRFs when import/export list changes
  - Ensure that bgp open message stream has enough data to read
  - Notify BGP conditional advertisement thread when the peer goes down

**bmp**
  - Add an interface source to BMP connect command
  - Add L3VPN support

**eigrpd**
  - VRF variable name hides a parameter of the same name

**fabricd**
  - Turn off excessive logging when peering will not come up

**isisd**
  - Ensure rcap is freed in error case
  - Fix crash with xfrm interface type
  - Fix memory leak on shutdown with prefix lists
  - Fix prefix-sid last-hop-behavior

**ldpd**
  - Check if the thread is scheduled before calling for remained time

**lib**
  - Abstract usage of '%pnhs' so that next-hop groups can use it too
  - Add errno details to the sockopt_reuseaddr API
  - Add sys_rawio to the capabilities definitions
  - Allow downgrade of all caps when none are specified
  - Allow using ipv4 (class e) reserved block if enabled
  - Check hostname in resolver_resolve
  - Cleanup red-herring memleaks in the parent of daemonizing fork
  - Ensure ls_msg2edge does not use memory after freeing
  - Fix `show route-map name json` command and memory leak
  - Fix memory leak in `zclient_send_localsid()`
  - Fix skip of every other plist deletion
  - Fixup workqueue.c to use the proper thread.h semantics
  - Function `crypt` does not need to be declared mid function
  - Increase next-hop flags size to 16 bits
  - Prevent uninitialized usage of data
  - Remove usage of inet_ntop in lib/sockopt.c
  - Require at least 2.1.42 version of sysrepo when compiling
  - Return 0 as the remaining msec if the thread is not scheduled
  - stream_dup memory alloc cannot fail
  - Update sysrepo code with the latest API changes
  - Use pi4 instead of inet_ntop in sockopt.c

**nhrpd**
  - Use frr_weak_random()
  - Use nhrp_interface_update_nbma when source VRF was changed

**ospf6d**
  - Don't remove the summary route if it is a range
  - Ensure that ospf6d does not memcpy beyond the end of the data
  - Fix missing cost change
  - Permit route delete without next-hops
  - Remove ospf6enabled from JSON output

**ospfd**
  - Add how many packets the interface has queued to send
  - Add router-id support to OSPF API
  - Added CLIs to change default timers for lsa refresh and maxage remove delay.
  - Adding per neighbor JSON details to gr helper detail command
  - Crash when router acts as gr helper upon a topo change
  - Fix `show ip ospf neighbour <nbrid>` command
  - Increase packets sent at one time in ospf_write
  - Refactor fifo_flush for the interface
  - Remove deprecated command `graceful-restart helper-only`
  - When a neighbor goes down clear the oi->obuf if we can
  - Catch and report too small LSAs
  - Remove assert on zero length LSA - which is permitted by spec
  - Fix bug where acks were not be generated to incoming P2P/P2MP neighbors

**pathd**
  - `no mpls-te on` command was not working
  - Add a zebra stop handler
  - Change the vty output, when no ted is enabled on pathd
  - Ensure the path is free'd after we no longer need it
  - Nai adjacency fix query type f for IPv5

pim6d
  - (*,g) mroutes not learnt after pim6d daemon restart
  - Lots of CLI changes regarding MLD
  - Lots of CLI changes regarding PIMv6
  - Clear interface stats on interface shutdown
  - Disable pim6d compilation by default
  - Don't enable MLD on pimreg interface
  - Fix the code for MLD in the show pim state command
  - mroute stuck in register state, multicast traffic getting drops
  - Register message getting dropped in the source node, mroute stuck in regj
  - Send register msg with IPv6 global address
  - Update last_member_query_interval and last_member_query_count
  - Use ttable for displaying show commands
  - Deleting the memory malloced for JSON
  - Adding JSON support for show ipv6 next-hop
  - Send register msg via register socket
  - Change the show running commands based on the address family
  - Set rp to true if the address matches, ignore prefix-length

**pimd**
  - Allow v6 to do non-integrated configuration
  - Assign a vty port value for v6
  - Cleanup rpf lookup debug to help us figure out what is going on
  - Correct the order of show JSON for interface traffic
  - During prune pending, behave as noinfo state
  - Fix invalid memory access join_timer_stop
  - Fix memleak in bfd profile
  - Fix PIM interface deletion flow
  - Fix static mroute to also take into account the input interface
  - Fix the setting of oif_flags in channel oil
  - Fix unaligned accesses
  - Handle receive of (*,g) register stop with src addr as 0
  - Igmp querier election is not correct in lan scenario
  - JSON support for next-hop
  - Let the end operator know the ifindex as well in the failure case
  - Limit PIM's ECMP to what zebra tells us is the multipath
  - Querier to non-querier transition to be ignored
  - Register stop message sent with mask 32
  - Show interface traffic even if the interface is currently `down`
  - Update mroute iif based on next-hop received from zebra
  - VRF may be null from pim_cmd_lookup_vrf

**ripd**
  - Use a sequence number instead of a time

**sharpd**
  - Fix memory leak in release-locator-chunk
  - Fix memory leak in release-locator-chunk
  - Fix memory leaks related to SRv6 next-hops

**staticd**
  - When changing the underlying nh ensure it is reinstalled

**tools**
  - Add missing bfdd to logrotate config
  - Add pim6d to tools so that pim6d will work properly
  - Fix boot config load in watchfrr
  - Stop zebra daemon last

**vtysh**
  - Account validity should be verified when authenticating users with pam
  - Add autocomplete for VRFs when using with `router bgp`
  - Handle SIGTSTP (c-z) without exiting the vty shell
  - Ignore `end` when parsing frr.conf
  - Properly handle `[no] service cputime-stats` in config
  - Properly handle `service cputime-warning xx` in the config
  - Add `allow-reserved-ranges` global command

**watchfrr**
  - Check that the operational timeout specified is good

**zebrad**
  - Fixing log flooding when disabling MLAG leaf configuration
  - Add a `mpls enable` interface node command
  - Add a configurable knob `zebra nexthop-group keep (1-3600)`
  - Add a timer to next-hop group deletion
  - Add ability for netconf dplane to handle global values
  - Add interface sysctl ignore on linkdown status
  - Add more cases to proto2zebra for understanding kernel routes
  - Add some more data to rtadv socket failures
  - Add support for maintaining local neigh entries
  - Add tc handlers in the script code
  - Add tc netlink and dplane ops
  - Allow kernel routes to stick around better on interface state changes
  - Attempt to make ioctl.c have a bit more useful log messages
  - Avoid buffer overflow using netlink_parse_rtattr_nested()
  - Cleanup the memory from the hash for MPLS stuff
  - Create a zebra_rib_route_entry_new function and use it
  - Debug decode rta_expires and rta_mfc_stats
  - Delete the malloced memory under `show zebra`
  - Don't install connected routes multiple times into frr
  - Expand PBR rule action for data-plane programming
  - Explicitly call out the correct queue name
  - Fix bond down for EVPN-MH
  - Fix bug in netconf handling where dplane would drop the change
  - Fix crash in shutdown w/ pw thread still running
  - Fix ctab calculation typo in tc netlink
  - Fix FPM crash
  - Fix lost memory on lsp free
  - Fix memory leak in srv6 locator delete
  - Fix memory leaks and use after frees in nhg's on shutdown
  - Fix missing tenant VRF change notification
  - Fix missing VNI transition
  - Fix remaining mr rtm_getroute oddities
  - Fix rtadv startup when config read in is before interface up
  - Free neighbor state before the exit to avoid memleaks
  - Handle freebsd routing socket enobufs
  - Iif/oif are not used in mr rtm_getroute
  - Infrastructure for the new dataplane plugin
  - Initialize hw via DPDK
  - Introduce early route processing on the metaq
  - Mc_forwarding was being sent but not retrieved across dataplane
  - Notice when an interface is turned on w/ mpls and enable mpls subsystem
  - On Linux let interface data come in through netlink messaging
  - Pass AFI received for netconf updates
  - Pass PBR expanded actions to the dataplane
  - Pbr DPDK programming
  - Reconfiguring netns for VRF is not a failure
  - Rtnetlink: flow attr per gateway attr in multipath updates
  - Setup the zebra interface to the DPDK port map table
  - System routes should be processed the same time as the kernel
  - Use default ns directly in tc dplane
  - When deleting next-hop group entries ensure the thread is off
  - When saving nhg for later stop processing

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
18 months agoospfd: Fix some json mem leaks and some issues
Donald Sharp [Mon, 19 Dec 2022 15:51:58 +0000 (10:51 -0500)]
ospfd: Fix some json mem leaks and some issues

a) if show_function happened to be NULL we would leak json memory
b) json_lsa_type was being allocated but only used in the default case, leaking memory
c) json output would sometimes produce text output and that is incorrect

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agobgpd: When allocating prefix, free it when we are already tracking it
Donald Sharp [Sun, 18 Dec 2022 15:54:36 +0000 (10:54 -0500)]
bgpd: When allocating prefix, free it when we are already tracking it

Several functions had this pattern:

a) p = prefix_new
b) if (already_tracking)
      return

Let's just stop allocating the prefix and use a prefix on the
stack, especially since the function used to hold the value
actually copies it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12549 from opensourcerouting/fix/bgp_packet_attribute_forward_null
Donald Sharp [Tue, 20 Dec 2022 13:14:47 +0000 (08:14 -0500)]
Merge pull request #12549 from opensourcerouting/fix/bgp_packet_attribute_forward_null

bgpd: Check if bgp_path_info is not NULL when setting AIGP metric TLV

18 months agoospfd: fix SPF table memory leak
Rafael Zalamena [Thu, 15 Dec 2022 12:54:33 +0000 (09:54 -0300)]
ospfd: fix SPF table memory leak

After `free()`ing a table also set it to NULL so when the instance
release function is called we know whether the pointer is valid or not.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
18 months agoMerge pull request #12541 from manojvn/dbdesc_recv
Rafael Zalamena [Tue, 20 Dec 2022 11:37:16 +0000 (08:37 -0300)]
Merge pull request #12541 from manojvn/dbdesc_recv

ospf6d: Fixing memory leak in ospf6_lsa_create_headeronly for both

18 months agobgpd: Adopt `show bgp detail-routes` command for L3VPN outputs as well
Donatas Abraitis [Tue, 20 Dec 2022 11:01:52 +0000 (13:01 +0200)]
bgpd: Adopt `show bgp detail-routes` command for L3VPN outputs as well

```
unet> sh pe2 vtysh -c 'sh ip bgp ipv4 vpn detail-routes'
BGP table version is 4, local router ID is 10.10.10.20, vrf id 0
Default local pref 100, local AS 65001
Route Distinguisher: 192.168.2.2:2
BGP routing table entry for 192.168.2.2:2:10.0.0.0/24, version 1
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:172.16.255.1/32, version 2
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:192.168.1.0/24, version 3
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022
BGP routing table entry for 192.168.2.2:2:192.168.2.0/24, version 4
not allocated
Paths: (1 available, best #1)
  Not advertised to any peer
  65000
    192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self
      Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received)
      Extended Community: RT:192.168.2.2:2
      Originator: 10.10.10.20
      Remote label: 2222
      Last update: Tue Dec 20 13:01:20 2022

Displayed  4 routes and 4 total paths
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agotests: Add topotest bgp_srv6l3vpn_route_leak
Ryoga Saito [Tue, 20 Dec 2022 08:58:30 +0000 (17:58 +0900)]
tests: Add topotest bgp_srv6l3vpn_route_leak

To verify previous changes, this PR adds topotest to verify whether
imported routes redistributed will be active on other VRF RIB.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
18 months agobgpd: Fix handling of SRv6 local routes
Ryoga Saito [Thu, 8 Dec 2022 07:01:59 +0000 (16:01 +0900)]
bgpd: Fix handling of SRv6 local routes

Current bgpd can't annouce SRv6 locally-generated routes to Zebra
correctly because MPLS label of locally-generated routes is not valid
but sid_info->transposition_len is set to non-zero value. This commit
fixes such kind of issues.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
18 months agobgpd: Set routes detail flag when using flowspec detailed command
Donatas Abraitis [Tue, 20 Dec 2022 10:18:10 +0000 (12:18 +0200)]
bgpd: Set routes detail flag when using flowspec detailed command

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agodoc: Add new command `show bgp detail-routes`
Donatas Abraitis [Tue, 20 Dec 2022 10:15:32 +0000 (12:15 +0200)]
doc: Add new command `show bgp detail-routes`

```
donatas-pc# show bgp all detail-routes

For address family: IPv4 Unicast
BGP table version is 11, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
BGP routing table entry for 10.10.100.0/24, version 2
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin IGP, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
BGP routing table entry for 172.16.31.1/32, version 3
Paths: (1 available, best #1, table default)
  Advertised to non peer-group peers:
  192.168.10.124
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, best (First path received)
      Last update: Tue Dec 20 12:11:52 2022
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Add `show ip bgp <afi> <safi> detail` command version
Donatas Abraitis [Tue, 20 Dec 2022 09:56:50 +0000 (11:56 +0200)]
bgpd: Add `show ip bgp <afi> <safi> detail` command version

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Rename BGP_SHOW_OPT_DETAIL to BGP_SHOW_OPT_JSON_DETAIL
Donatas Abraitis [Tue, 20 Dec 2022 09:52:19 +0000 (11:52 +0200)]
bgpd: Rename BGP_SHOW_OPT_DETAIL to BGP_SHOW_OPT_JSON_DETAIL

This option used only for JSON detailed output.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Show the real prefix for `show bgp detail`
Donatas Abraitis [Tue, 13 Dec 2022 20:30:15 +0000 (22:30 +0200)]
bgpd: Show the real prefix for `show bgp detail`

Absolutely not possible to read the output and even distinguish the prefix
we are looking for.

Before:

```
donatas-pc# show ip bgp detail
BGP table version is 12, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
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
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin incomplete, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:53:16 2022
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:53:16 2022
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin IGP, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:53:16 2022
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin IGP, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:53:16 2022
```

After:

```
donatas-pc# show ip bgp detail
BGP table version is 12, local router ID is 192.168.10.17, vrf id 0
Default local pref 100, local AS 65002
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin incomplete, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:47:16 2022
BGP routing table entry for 10.0.2.0/24, version 1
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    192.168.10.124 from 192.168.10.124 (200.200.200.202)
      Origin incomplete, metric 0, valid, external, otc 65001, multipath, best (Neighbor IP)
      Last update: Tue Dec 13 22:47:16 2022
BGP routing table entry for 10.10.100.0/24, version 2
Paths: (2 available, best #2, table default)
  Advertised to non peer-group peers:
  2a02:4780:abc::2
  65001
    2a02:4780:abc::2 from 2a02:4780:abc::2 (200.200.200.202)
    (fe80::a00:27ff:fe5e:d19e) (used)
      Origin IGP, metric 0, valid, external, multipath
      Last update: Tue Dec 13 22:47:16 2022
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Check if bgp_path_info is not NULL when setting AIGP metric TLV
Donatas Abraitis [Tue, 20 Dec 2022 07:48:43 +0000 (09:48 +0200)]
bgpd: Check if bgp_path_info is not NULL when setting AIGP metric TLV

*** CID 1530035:  Null pointer dereferences  (FORWARD_NULL)
/bgpd/bgp_updgrp_packet.c: 756 in subgroup_update_packet()
750                              * position.
751                              */
752                             mpattr_pos = stream_get_endp(s);
753
754                             /* 5: Encode all the attributes, except MP_REACH_NLRI
755                              * attr. */
>>>     CID 1530035:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "path" to "bgp_packet_attribute", which dereferences it.
756                             total_attr_len = bgp_packet_attribute(
757                                     NULL, peer, s, adv->baa->attr, &vecarr, NULL,
758                                     afi, safi, from, NULL, NULL, 0, 0, 0, path);
759
760                             space_remaining =
761                                     STREAM_CONCAT_REMAIN(s, snlri, STREAM_SIZE(s))

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agotests: Add an option for SNMP config to specify a custom options
Donatas Abraitis [Mon, 19 Dec 2022 21:26:28 +0000 (23:26 +0200)]
tests: Add an option for SNMP config to specify a custom options

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Zero intial OID items in array at the beginning
Donatas Abraitis [Mon, 19 Dec 2022 20:56:41 +0000 (22:56 +0200)]
bgpd: Zero intial OID items in array at the beginning

If OID does not have an IP address encoded, initialized every item in an
array to 0 to avoid a wrong comparison between IP addresses.

With >= 5.8 net-snmp, it works without this hack.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #12380 from chiragshah6/zdev
Donatas Abraitis [Mon, 19 Dec 2022 21:37:59 +0000 (23:37 +0200)]
Merge pull request #12380 from chiragshah6/zdev

ospfd: json support for show ip ospf border-routers

18 months agotests: Add basic tests for SNMP BGP4V2-MIB
Donatas Abraitis [Thu, 15 Dec 2022 12:21:16 +0000 (14:21 +0200)]
tests: Add basic tests for SNMP BGP4V2-MIB

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Return MED, not local-preference if MED attribute exists (SNMP)
Donatas Abraitis [Thu, 15 Dec 2022 21:46:49 +0000 (23:46 +0200)]
bgpd: Return MED, not local-preference if MED attribute exists (SNMP)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Specify prefix address-family before looking into BGP table
Donatas Abraitis [Thu, 15 Dec 2022 14:50:52 +0000 (16:50 +0200)]
bgpd: Specify prefix address-family before looking into BGP table

Otherwise, lookup behaves a bit weird.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Make sure we have peer->notify.data before returning for SNMP
Donatas Abraitis [Thu, 15 Dec 2022 13:14:40 +0000 (15:14 +0200)]
bgpd: Make sure we have peer->notify.data before returning for SNMP

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #12434 from chiragshah6/fdev1
Donatas Abraitis [Mon, 19 Dec 2022 21:24:53 +0000 (23:24 +0200)]
Merge pull request #12434 from chiragshah6/fdev1

zebra: show ip nht route-map vrf json support

18 months agoMerge pull request #12544 from mjstapp/fix_pathd_sa_pcep_config
Donald Sharp [Mon, 19 Dec 2022 19:44:21 +0000 (14:44 -0500)]
Merge pull request #12544 from mjstapp/fix_pathd_sa_pcep_config

pathd: fix SA warning in path_pcep_config

18 months agoMerge pull request #12535 from donaldsharp/mpattr_size_enum
Donatas Abraitis [Mon, 19 Dec 2022 18:54:53 +0000 (20:54 +0200)]
Merge pull request #12535 from donaldsharp/mpattr_size_enum

Use switch statements without default for safi_t and afi_t enum's

18 months agoMerge pull request #12537 from anlancs/fix/fpm-debug-info
Rafael Zalamena [Mon, 19 Dec 2022 18:01:43 +0000 (15:01 -0300)]
Merge pull request #12537 from anlancs/fix/fpm-debug-info

zebra: fix wrong gateway for fpm debug

18 months agoMerge pull request #12538 from donaldsharp/zebra_crash_in_shutdown
Rafael Zalamena [Mon, 19 Dec 2022 17:58:49 +0000 (14:58 -0300)]
Merge pull request #12538 from donaldsharp/zebra_crash_in_shutdown

zebra: Ensure memory is not freed that dplane depends on in shutdown

18 months agopathd: fix SA warning in path_pcep_config
Mark Stapp [Mon, 19 Dec 2022 16:36:03 +0000 (11:36 -0500)]
pathd: fix SA warning in path_pcep_config

Fix an SA warning about a possibly-uninited local.

Signed-off-by: Mark Stapp <mjs@labn.net>
18 months agoMerge pull request #12534 from donaldsharp/notice_missed
Mark Stapp [Mon, 19 Dec 2022 14:31:12 +0000 (09:31 -0500)]
Merge pull request #12534 from donaldsharp/notice_missed

zebra: Notice Optional Router Advertisement types that are not handled

18 months agoospf6d: Fixing memory leak in ospf6_lsa_create_headeronly for both master and slave.
Manoj Naragund [Mon, 19 Dec 2022 12:07:22 +0000 (04:07 -0800)]
ospf6d: Fixing memory leak in ospf6_lsa_create_headeronly for both master and slave.

Problem Statement:
=================
Memory leak backtraces

2022-11-23 01:51:10,525 - ERROR: ==842== 1,100 (1,000 direct, 100 indirect) bytes in 5 blocks are definitely lost in loss record 29 of 31
2022-11-23 01:51:10,525 - ERROR: ==842==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E8A1BF: qcalloc (memory.c:111)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13555A: ospf6_lsa_alloc (ospf6_lsa.c:723)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x1355F3: ospf6_lsa_create_headeronly (ospf6_lsa.c:756)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x135702: ospf6_lsa_copy (ospf6_lsa.c:790)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_dbdesc_recv_slave (ospf6_message.c:976)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_dbdesc_recv (ospf6_message.c:1038)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_read_helper (ospf6_message.c:1838)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13B64B: ospf6_receive (ospf6_message.c:1875)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4EB741B: thread_call (thread.c:1692)
2022-11-23 01:51:10,526 - ERROR: ==842==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-11-23 01:51:10,526 - ERROR: ==842==    by 0x119585: main (ospf6_main.c:228)
2022-11-23 01:51:10,526 - ERROR: ==842==

2022-11-23 01:51:10,524 - ERROR: Found memory leak in module ospf6d
2022-11-23 01:51:10,525 - ERROR: ==842== 220 (200 direct, 20 indirect) bytes in 1 blocks are definitely lost in loss record 21 of 31
2022-11-23 01:51:10,525 - ERROR: ==842==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E8A1BF: qcalloc (memory.c:111)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13555A: ospf6_lsa_alloc (ospf6_lsa.c:723)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x1355F3: ospf6_lsa_create_headeronly (ospf6_lsa.c:756)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x135702: ospf6_lsa_copy (ospf6_lsa.c:790)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_dbdesc_recv_master (ospf6_message.c:760)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_dbdesc_recv (ospf6_message.c:1036)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_read_helper (ospf6_message.c:1838)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x13BBCE: ospf6_receive (ospf6_message.c:1875)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4EB741B: thread_call (thread.c:1692)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-11-23 01:51:10,525 - ERROR: ==842==    by 0x119585: main (ospf6_main.c:228)
2022-11-23 01:51:10,525 - ERROR: ==842==

RCA:
====
These memory leaks are beacuse of last lsa in neighbour's request_list is not
getting freed beacuse of lsa lock. The last request has an addtional lock which
is added as a part of ospf6_make_lsreq, this lock needs to be removed
in order for the lsa to get freed.

Fix:
====
Check and remove the lock on the last request in all the functions.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
18 months agoospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackhole.
Manoj Naragund [Mon, 19 Dec 2022 11:52:59 +0000 (03:52 -0800)]
ospf6d: Fixing memory leak in ospf6_summary_add_aggr_route_and_blackhole.

Problem Statement:
=================
Memory leak in ospf6d.
2022-11-15 02:15:11,569 - ERROR: ==30108== 440 (280 direct, 160 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 17
2022-11-15 02:15:11,569 - ERROR: ==30108==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x4E8A1BF: qcalloc (memory.c:111)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x14337A: ospf6_route_create (ospf6_route.c:462)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x11EE27: ospf6_summary_add_aggr_route_and_blackhole (ospf6_asbr.c:2779)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x11EEDA: ospf6_originate_new_aggr_lsa (ospf6_asbr.c:2816)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x120053: ospf6_handle_external_lsa_origination (ospf6_asbr.c:3659)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x12041E: ospf6_asbr_redistribute_add (ospf6_asbr.c:1547)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x14F3CC: ospf6_zebra_read_route (ospf6_zebra.c:253)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x4EC9B73: zclient_read (zclient.c:2727)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x4EB741B: thread_call (thread.c:1692)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-11-15 02:15:11,569 - ERROR: ==30108==    by 0x119585: main (ospf6_main.c:228)
2022-11-15 02:15:11,569 - ERROR: ==30108==

RCA:
====
blackhole route was not freed before adding a new one.

Fix:
====
Added a check before allocating new route, to free the old one. Also,
added ospf6_asbr_summary_config_delete in ospf6_delet before freeing
the aggregate route.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
18 months agozebra: Notice Optional Router Advertisement types that are not handled
Donald Sharp [Wed, 12 Oct 2022 11:59:37 +0000 (07:59 -0400)]
zebra: Notice Optional Router Advertisement types that are not handled

Currently when zebra receives a RA with optional types, note
the optional types that we are ignoring.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agozebra: Ensure memory is not freed that dplane depends on in shutdown
Donald Sharp [Sat, 17 Dec 2022 19:09:29 +0000 (14:09 -0500)]
zebra: Ensure memory is not freed that dplane depends on in shutdown

Zebra has a shutdown setup where it asks the dplane to shutdown but can
still be processing data.  This is especially true if something the dplane
is listening on receives data that will be processed by the main dplane thread
from netlink.   When zebra_finalize is called it is possible that a bit
of data comes in before the zebra_dplane_shutdown() function is called
and the memory freed in ns_walk_func() causes the main dplane event
to crash when it cannot find the ns data anymore.

Reverse the order, stop the zebra dplane pthread and then free the
memory associated with the namespaces.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12536 from donaldsharp/peer_print_null
Donatas Abraitis [Sat, 17 Dec 2022 14:59:53 +0000 (16:59 +0200)]
Merge pull request #12536 from donaldsharp/peer_print_null

bgpd: Print out useful information about peer

18 months agozebra: fix wrong gateway for fpm debug
anlan_cs [Sat, 17 Dec 2022 08:25:56 +0000 (16:25 +0800)]
zebra: fix wrong gateway for fpm debug

The wrong parameter is passed in `inet_ntop()` of `zfpm_log_route_info()` in
old fpm module, so the display of gateway is always wrong. Just remove
that extra ampersand.

Additionally, use "none" as gateway value for the case of no gateway.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
18 months agoMerge pull request #12533 from donaldsharp/returns_are_needed
Mark Stapp [Fri, 16 Dec 2022 17:42:14 +0000 (12:42 -0500)]
Merge pull request #12533 from donaldsharp/returns_are_needed

lib, staticd: return values even after an assert

18 months agodoc: add documentation for show ospf border-routers
Chirag Shah [Fri, 16 Dec 2022 04:48:48 +0000 (20:48 -0800)]
doc: add documentation for show ospf border-routers

Signed-off-by: Chirag Shah <chirag@nvidia.com>
18 months agoospfd: json support for show ip ospf border-routers
Sindhu Parvathi Gopinathan [Thu, 10 Nov 2022 10:18:16 +0000 (02:18 -0800)]
ospfd: json support for show ip ospf border-routers

show ip ospf border-routers json support added.
commands:
  - show ip ospf vrf default border-routers json
  - show ip ospf vrf all border-routers json
  - show ip ospf border-routers json

Testing Done: Unit testing completed.

rut# show ip ospf vrf all border-routers json
{
  "default":{
    "vrfName":"default",
    "vrfId":0,
    "routers":{
      "0.0.0.8":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.0.2",
            "via":"swp1"
          }
        ]
      },
      "0.0.0.9":{
        "routeType":"R ",
        "cost":10,
        "area":"0.0.0.1",
        "routerType":"abr",
        "nexthops":[
          {
            "ip":"12.0.1.2",
            "via":"swp2"
          }
        ]
      }
    }
  }
}

rut#
rut# show ip ospf vrf all border-routers json
{
  "default":{
"vrfName":"default",
"vrfId":0,
        "routers":{
     "0.0.0.15":{
    "routeType":"R ",
    "cost":30,
    "area":"0.0.0.0",
    "routerType":"abr",
    "nexthops":[
{
  "ip":"11.0.0.2",
  "via":"br1"
}
     ]
  }
      }
  }
}

rut# show ip ospf border-routers json
{
  "routers":{
    "0.0.0.15":{
      "routeType":"R ",
      "cost":30,
      "area":"0.0.0.0",
      "routerType":"abr",
      "nexthops":[
        {
  "ip":"11.0.0.2",
          "via":"br1"
}
      ]
   }
 }
}

Ticket:#3229017
Issue:3229017

Co-authored-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
18 months agodoc: add documentation for show ip nht route-map
Chirag Shah [Fri, 16 Dec 2022 05:54:40 +0000 (21:54 -0800)]
doc: add documentation for show ip nht route-map

Signed-off-by: Chirag Shah <chirag@nvidia.com>
18 months agozebra: json support for show ip nht route-map
Sindhu Parvathi Gopinathan [Tue, 8 Nov 2022 05:40:13 +0000 (21:40 -0800)]
zebra: json support for show ip nht route-map

Changes:
JSON support added for below commands,
     - show ip nht route-map vrf all json
     - show ip nht route-map vrf <name> json
     - show ipv6 nht route-map vrf all json
     - show ipv6 nht route-map vrf <name> json
     - show ipv6 nht route-map json
     - show ip nht route-map json

Testing Done: Unit testing completed.

tor-1# show ip nht route-map vrf default json
{
  "afi":"ipv4",
  "vrfs":{
"default":{
  "protocols":{
"system":"none",
"kernel":"none",
"connected":"connected-policy",
"static":"none",
"rip":"none",
"ripng":"none",
"ospf":"none",
"ospf6":"none",
"isis":"none",
"bgp":"bgp-policy",
"pim":"none",
"eigrp":"none",
"nhrp":"none",
"hsls":"none",
"olsr":"none",
"table":"none",
"ldp":"none",
"vnc":"none",
"vnc-direct":"none",
"vnc-rn":"none",
"bgp-direct":"none",
"bgp-direct-to-nve-groups":"none",
"babel":"none",
"sharp":"none",
"pbr":"none",
"bfd":"none",
"openfabric":"none",
"vrrp":"none",
"zebra":"none",
"frr":"none",
"wildcard":"none",
"any":"none"
  }
}
  }
}

tor-1# show ip nht route-map vrf all json
{
  "afi":"ipv4",
  "vrfs":{
"default":{
  "protocols":{
"system":"none",
"kernel":"none",
"connected":"connected-policy",
"static":"none",
"rip":"none",
"ripng":"none",
"ospf":"none",
"ospf6":"none",
"isis":"none",
"bgp":"bgp-policy",
"pim":"none",
"eigrp":"none",
"nhrp":"none",
"hsls":"none",
"olsr":"none",
"table":"none",
"ldp":"none",
"vnc":"none",
"vnc-direct":"none",
"vnc-rn":"none",
"bgp-direct":"none",
"bgp-direct-to-nve-groups":"none",
"babel":"none",
"sharp":"none",
"pbr":"none",
"bfd":"none",
"openfabric":"none",
"vrrp":"none",
"zebra":"none",
"frr":"none",
"wildcard":"none",
"any":"none"
  }
},
"mgmt":{
  "protocols":{
"system":"none",
"kernel":"none",
"connected":"none",
"static":"none",
"rip":"none",
"ripng":"none",
"ospf":"none",
"ospf6":"none",
"isis":"none",
"bgp":"none",
"pim":"none",
"eigrp":"none",
"nhrp":"none",
"hsls":"none",
"olsr":"none",
"table":"none",
"ldp":"none",
"vnc":"none",
"vnc-direct":"none",
"vnc-rn":"none",
"bgp-direct":"none",
"bgp-direct-to-nve-groups":"none",
"babel":"none",
"sharp":"none",
"pbr":"none",
"bfd":"none",
"openfabric":"none",
"vrrp":"none",
"zebra":"none",
"frr":"none",
"wildcard":"none",
"any":"none"
  }
},
"sym_1":{
  "protocols":{
"system":"none",
"kernel":"none",
"connected":"none",
"static":"none",
"rip":"none",
"ripng":"none",
"ospf":"none",
"ospf6":"none",
"isis":"none",
"bgp":"bgp-policy",
"pim":"none",
"eigrp":"none",
"nhrp":"none",
"hsls":"none",
"olsr":"none",
"table":"none",
"ldp":"none",
"vnc":"none",
"vnc-direct":"none",
"vnc-rn":"none",
"bgp-direct":"none",
"bgp-direct-to-nve-groups":"none",
"babel":"none",
"sharp":"none",
"pbr":"none",
"bfd":"none",
"openfabric":"none",
"vrrp":"none",
"zebra":"none",
"frr":"none",
"wildcard":"none",
"any":"none"
  }
}
  }
}

tor-1# show ipv6 nht route-map vrf default json
{
  "afi":"ipv6",
  "vrfs":{
"default":{
  "protocols":{
"system":"none",
"kernel":"kernel-policy",
"connected":"connected-policy",
"static":"none",
"rip":"none",
"ripng":"none",
"ospf":"none",
"ospf6":"none",
"isis":"none",
"bgp":"none",
"pim":"none",
"eigrp":"none",
"nhrp":"none",
"hsls":"none",
"olsr":"none",
"table":"none",
"ldp":"none",
"vnc":"none",
"vnc-direct":"none",
"vnc-rn":"none",
"bgp-direct":"none",
"bgp-direct-to-nve-groups":"none",
"babel":"none",
"sharp":"none",
"pbr":"none",
"bfd":"none",
"openfabric":"none",
"vrrp":"none",
"zebra":"none",
"frr":"none",
"wildcard":"none",
"any":"none"
  }
}
  }
}

Ticket:#3229016
Issue:3229016

Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
18 months agobgpd: Print out useful information about peer
Donald Sharp [Fri, 16 Dec 2022 14:32:44 +0000 (09:32 -0500)]
bgpd: Print out useful information about peer

I am seeing this output:
2022/12/16 09:16:00.206 BGP: [MNE5N-K0G4Z] Resetting peer (null) due to change in addpath config

Switch over to %pBP

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12522 from donaldsharp/some_various_stuff
David Lamparter [Fri, 16 Dec 2022 14:30:37 +0000 (15:30 +0100)]
Merge pull request #12522 from donaldsharp/some_various_stuff

18 months agobgpd: fix attrhash_cmp() clang-format
Louis Scalbert [Fri, 16 Dec 2022 14:09:36 +0000 (15:09 +0100)]
bgpd: fix attrhash_cmp() clang-format

Fix attrhash_cmp() clang-format

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: fix appropriate number of routes in bgp
Philippe Guibert [Thu, 8 Sep 2022 16:31:17 +0000 (18:31 +0200)]
topotests: fix appropriate number of routes in bgp

The number of routes in BGP ce devices was wrong.
Change the expected values.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
18 months agotopotests: raise an error if pinging from vrf is not possible
Louis Scalbert [Fri, 27 May 2022 11:59:34 +0000 (13:59 +0200)]
topotests: raise an error if pinging from vrf is not possible

Because of the issue described in the above link, pinging from vrf with
the command "ip vrf exec <vrf> ping -I <src> <addr>" may fail.

> root@topo:~# ip vrf exec vrf1 ping -c1 -I 192.168.2.1 192.168.1.1
> bind: Cannot assign requested address

Raise an error if pinging its own IP from a VRF fails. This test should
always work unless in the condition of this issue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203483
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: add tests to bgp-vrf-route-leak-basic
Louis Scalbert [Thu, 12 May 2022 14:12:34 +0000 (16:12 +0200)]
topotests: add tests to bgp-vrf-route-leak-basic

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: add VRF leak tests in bgp_l3vpn_to_bgp_vrf
Louis Scalbert [Thu, 12 May 2022 12:57:17 +0000 (14:57 +0200)]
topotests: add VRF leak tests in bgp_l3vpn_to_bgp_vrf

Check that route leaking between VRF within a router works properly.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: add retry in BGP RIB check
Louis Scalbert [Thu, 12 May 2022 13:37:36 +0000 (15:37 +0200)]
topotests: add retry in BGP RIB check

Add a retry option in the BGP RIB test.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: add ability to check that a prefix is not in BGP RIB
Louis Scalbert [Thu, 12 May 2022 12:54:32 +0000 (14:54 +0200)]
topotests: add ability to check that a prefix is not in BGP RIB

Add an "exist" key to check the existence of a prefix in the BGP RIB.
Useful to check that a prefix has not leaked by error.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: resend routes deleted by kernel after interface addresses deletion
Louis Scalbert [Fri, 6 May 2022 18:03:55 +0000 (20:03 +0200)]
bgpd: resend routes deleted by kernel after interface addresses deletion

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>
18 months agozebra: delete kernel routes using an interface with no more IPv4 address
Louis Scalbert [Wed, 6 Jul 2022 13:37:44 +0000 (15:37 +0200)]
zebra: delete kernel routes using an interface with no more IPv4 address

When the last IPv4 address of an interface is deleted, Linux removes
all routes using this interface without any Netlink advertisement.

Routes that have a IPv4 nexthop are correctly removed from the FRR RIB.
However, routes that only have an interface with no more IPv4 addresses
as a nexthop remains in the FRR RIB.

In this situation, among the routes that this particular interface
nexthop:
 - remove from the zebra kernel routes
 - reinstall the routes that have been added from FRR. It is useful when
   the nexthop is for example a VRF interface.

Add related test cases in the zebra_netlink topotest.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: move mp_nexthop_prefer_global boolean attribute to nh_flag
Louis Scalbert [Fri, 29 Apr 2022 17:41:57 +0000 (19:41 +0200)]
bgpd: move mp_nexthop_prefer_global boolean attribute to nh_flag

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>
18 months agobgpd: fix route recursion on leaked routes
Louis Scalbert [Tue, 26 Apr 2022 14:45:42 +0000 (16:45 +0200)]
bgpd: fix route recursion on leaked routes

Leaked recursive routes are not resolved.

> VRF r1-cust1:
> B>  5.1.0.0/24 [200/98] via 99.0.0.1 (recursive), weight 1, 00:00:08
>  *                       via 192.168.1.2, r1-eth4, weight 1, 00:00:08
> B>* 99.0.0.1/32 [200/0] via 192.168.1.2, r1-eth4, weight 1, 00:00:08

> VRF r1-cust4:
> B   5.1.0.0/24 [20/98] via 99.0.0.1 (vrf r1-cust1) inactive, weight 1, 00:00:08
> B>* 99.0.0.1/32 [20/0] via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:08

When announcing the routes to zebra, use the peer of the ultimate bgp
path info instead of the one of the first parent path info to determine
whether the route is recursive.

The result is:
> VRF r1-cust4:
> B>  5.1.0.0/24 [20/98] via 99.0.0.1 (vrf r1-cust1) (recursive), weight 1, 00:00:02
>   *                      via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:02
> B>* 99.0.0.1/32 [20/0] via 192.168.1.2, r1-eth4 (vrf r1-cust1), weight 1, 00:00:02

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agotopotests: update bgp_vrf_route_leak_basic
Louis Scalbert [Wed, 11 May 2022 15:37:34 +0000 (17:37 +0200)]
topotests: update bgp_vrf_route_leak_basic

Update bgp_vrf_route_leak_basic to set up the VRF interfaces. Otherwise
the routes to the VRF interface are inactives.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: update route leaking when a VRF loopback is received
Louis Scalbert [Tue, 26 Apr 2022 14:57:45 +0000 (16:57 +0200)]
bgpd: update route leaking when a VRF loopback is received

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>
18 months agotopotests: update ospf_multi_vrf_bgp_route_leak
Louis Scalbert [Wed, 11 May 2022 15:41:36 +0000 (17:41 +0200)]
topotests: update ospf_multi_vrf_bgp_route_leak

Leaked connected routes have now the following nexthop interfaces:
- lo for routes imported from the default VRF
- or the VRF interface for routes imported from the other VRFs.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: fix invalid nexthop interface on leaked routes
Louis Scalbert [Mon, 25 Apr 2022 13:14:49 +0000 (15:14 +0200)]
bgpd: fix invalid nexthop interface on leaked routes

There is two cases where the nexthop interface is incorrect:

- Case 1: leaked routes from prefixes stated in 'network <prefix>' are
  inactive because they have no nexthop IP address or interface.
- Case 2: leaked routes from 'redistribute connected' contains the
  original nexthop interface.

======
Case 1
======
> router bgp 5227 vrf r1-cust1
>  bgp router-id 192.168.1.1
>  no bgp network import-check
> !
>  address-family ipv4 unicast
>   network 10.2.3.4/32
>   network 192.168.1.0/24
>   rd vpn export 10:1
>   rt vpn import 52:100
>   rt vpn export 52:101
>   export vpn
>   import vpn
>  exit-address-family
> exit
> !
> router bgp 5227 vrf r1-cust4
>  bgp router-id 192.168.1.1
> !
>  address-family ipv4 unicast
>   network 29.0.0.0/24
>   rd vpn export 10:1
>   rt vpn import 52:101
>   rt vpn export 52:100
>   export vpn
>   import vpn
>  exit-address-family
> exit

Extract from the routing table:

> VRF r1-cust1:
> S>* 192.0.0.0/24 [1/0] via 192.168.1.2, r1-eth4, weight 1, 00:47:53
> C>* 192.168.1.0/24 is directly connected, r1-eth4, 00:44:15
> B>* 29.0.0.0/24 [20/0] is directly connected, unknown (vrf r1-cust4), inactive, weight 1, 00:00:02
>
> VRF r1-cust4:
> B   10.2.3.4/32 [20/0] is directly connected, unknown (vrf r1-cust1) inactive, weight 1, 00:00:02
> C>* 29.0.0.0/24 is directly connected, r1-cust5, 00:27:40
> B   192.0.0.0/24 [20/0] is directly connected, unknown (vrf r1-cust1) inactive, weight 1, 00:03:40
> B   192.168.1.0/24 [20/0] is directly connected, unknown (vrf r1-cust1) inactive, weight 1, 00:00:02

======
Case 2
======

The previous is modified with the following settings:

> router bgp 5227 vrf r1-cust1
>  address-family ipv4 unicast
>   no network 192.168.1.0/24
>   redistribute connected
> !
> vrf r1-cust1
> ip route 29.0.0.0/24 r1-cust5 nexthop-vrf r1-cust5

Extract from the routing table:
> VRF r1-cust1:
> S>* 192.0.0.0/24 [1/0] via 192.168.1.2, r1-eth4, weight 1, 00:47:53
> C>* 192.168.1.0/24 is directly connected, r1-eth4, 00:44:15
> S>* 29.0.0.0/24 [1/0] is directly connected, r1-cust5 (vrf r1-cust5), weight 1, 00:00:30
>
> VRF r1-cust4:
> B   10.2.3.4/32 [20/0] is directly connected, unknown (vrf r1-cust1) inactive, weight 1, 00:00:02
> C>* 29.0.0.0/24 is directly connected, r1-cust5, 00:27:40
> B   192.0.0.0/24 [20/0] is directly connected, unknown (vrf r1-cust1) inactive, weight 1, 00:03:40
> B>* 192.168.1.0/24 [20/0] is directly connected, r1-eth4 (vrf r1-cust1), weight 1, 00:00:02

The nexthop interface is r1-eth4. It causes issue to traffic leaving
r1-cust4. The following ping to r1-eth4 local address 192.168.1.1 from
r1-cust5 local add does
not respond.

> # tcpdump -lnni r1-cust1 'icmp' &
> # ip vrf exec r1-cust4 ping -c1 192.168.1.1 -I 29.0.0.1
> PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
PING 192.168.1.1 (192.168.1.1) from 29.0.0.1 : 56(84) bytes of data.
18:49:20.635638 IP 29.0.0.1 > 192.168.1.1: ICMP echo request, id 15897, seq 1, length 64
18:49:27.113827 IP 29.0.0.1 > 29.0.0.1: ICMP host 192.168.1.1 unreachable, length 92

Fix description:

When leaking prefix from other VRFs, if the nexthop IP address is not
set in the bgp path info attribures, reset nh_ifindex to the index of
master interface of the incoming BGP instance.

The result is for case 1 and 2:

> VRF r1-cust1:
> S>* 192.0.0.0/24 [1/0] via 192.168.1.2, r1-eth4, weight 1, 00:47:53
> C>* 192.168.1.0/24 is directly connected, r1-eth4, 00:44:15
> B>* 29.0.0.0/24 [20/0] is directly connected, r1-cust4 (vrf r1-cust4), weight 1, 00:00:08
>
> VRF r1-cust4:
> B>* 10.2.3.4/32 [20/0] is directly connected, r1-cust1 (vrf r1-cust1), weight 1, 00:00:08
> C>* 29.0.0.0/24 is directly connected, r1-cust5, 00:27:40
> B>* 192.0.0.0/24 [20/0] is directly connected, r1-cust1 (vrf r1-cust1), weight 1, 00:00:08
> B>* 192.168.1.0/24 [20/0] is directly connected, r1-cust1 (vrf r1-cust1), weight 1, 00:00:08

> # tcpdump -lnni r1-cust1 'icmp' &
> # ping -c1 192.168.1.1 -I 29.0.0.1
> PING 192.168.1.1 (192.168.1.1) from 29.0.0.1 : 56(84) bytes of data.
> 18:48:32.506281 IP 29.0.0.1 > 192.168.1.1: ICMP echo request, id 15870, seq 1, length 64
> 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.050 ms
> 18:48:32.506304 IP 192.168.1.1 > 29.0.0.1: ICMP echo reply, id 15870, seq 1, length 64

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
 1, 00:47:53
4:15
vrf r1-cust4), inactive, weight 1, 00:00:02

vrf r1-cust1) inactive, weight 1, 00:00:02
40
(vrf r1-cust1) inactive, weight 1, 00:03:40
n (vrf r1-cust1) inactive, weight 1, 00:00:02

dress is not
the index of

 1, 00:47:53
4:15
(vrf r1-cust4), weight 1, 00:00:08

(vrf r1-cust1), weight 1, 00:00:08
40
 (vrf r1-cust1), weight 1, 00:00:08
t1 (vrf r1-cust1), weight 1, 00:00:08

18 months agolib: fix clang warning
Louis Scalbert [Wed, 13 Jul 2022 12:52:16 +0000 (14:52 +0200)]
lib: fix clang warning

Fix a CLANG warning

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agolib: add a function to get the VRF or loopback interface
Louis Scalbert [Fri, 22 Apr 2022 16:08:08 +0000 (18:08 +0200)]
lib: add a function to get the VRF or loopback interface

Add a function to find the VRF or the loopback interface: the loopback
interface for the default VRF and the VRF master interface otherwise.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: fix prefix VRF leaking with 'network import-check' (5/5)
Louis Scalbert [Thu, 5 May 2022 16:06:24 +0000 (18:06 +0200)]
bgpd: fix prefix VRF leaking with 'network import-check' (5/5)

The following configuration creates an infinite routing leaking loop
because 'rt vpn both' parameters are the same in both VRFs.

> router bgp 5227 vrf r1-cust4
>    no bgp network import-check
>    bgp router-id 192.168.1.1
>    address-family ipv4 unicast
>      network 28.0.0.0/24
>      rd vpn export 10:12
>      rt vpn both 52:100
>      import vpn
>      export vpn
>    exit-address-family
> !
> router bgp 5227 vrf r1-cust5
>    no bgp network import-check
>    bgp router id 192.168.1.1
>    address-family ipv4 unicast
>      network 29.0.0.0/24
>      rd vpn export 10:13
>      rt vpn both 52:100
>      import vpn
>      export vpn
>    exit-address-family

The previous commit has added a routing leak update when a nexthop
update is received from zebra. It indirectly calls
bgp_find_or_add_nexthop() in which a static route triggers a nexthop
cache entry registration that triggers a nexthop update from zebra.

Do not register again the nexthop cache entry if the BGP_STATIC_ROUTE is
already set.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 months agobgpd: fix prefix VRF leaking with 'network import-check' (4/5)
Louis Scalbert [Fri, 29 Apr 2022 12:26:04 +0000 (14:26 +0200)]
bgpd: fix prefix VRF leaking with 'network import-check' (4/5)

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>