]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
2 years agobgpd: Remove redundant test against ifp for DEBUG messages
Donatas Abraitis [Tue, 30 Aug 2022 08:35:05 +0000 (11:35 +0300)]
bgpd: Remove redundant test against ifp for DEBUG messages

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11874 from sri-mohan1/sri-isis-dbg1
Donatas Abraitis [Mon, 29 Aug 2022 18:30:17 +0000 (21:30 +0300)]
Merge pull request #11874 from sri-mohan1/sri-isis-dbg1

isisd: changes for code maintainability

2 years agoMerge pull request #11871 from AbhishekNR/mem_free
Donatas Abraitis [Mon, 29 Aug 2022 18:25:00 +0000 (21:25 +0300)]
Merge pull request #11871 from AbhishekNR/mem_free

pimd, pim6d: deleting the memory malloced for json.

2 years agopimd, pim6d: deleting the memory malloced for json.
Abhishek N R [Mon, 29 Aug 2022 11:50:26 +0000 (04:50 -0700)]
pimd, pim6d: deleting the memory malloced for json.

Problem Statement:
=================
2022-08-18 04:57:32,376 - ERROR: Found memory leak in daemon pimd
2022-08-18 04:57:32,377 - ERROR: ==12100== 18,978 (144 direct, 18,834 indirect) bytes in 2 blocks are definitely lost in loss record 45 of 45
2022-08-18 04:57:32,377 - ERROR: ==12100==    at 0x4C31FAC: calloc (vg_replace_malloc.c:762)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x532F51F: json_object_new_object (in /lib/x86_64-linux-gnu/libjson-c.so.3.0.1)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x128B5C: pim_show_interfaces (pim_cmd_common.c:3395)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x15A86B: show_ip_pim_interface_magic (pim_cmd.c:3127)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x15A86B: show_ip_pim_interface (pim_cmd_clippy.c:324)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4E672B2: cmd_execute_command_real.isra.2 (command.c:1005)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4E696FE: cmd_execute_command (command.c:1064)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4E698F1: cmd_execute (command.c:1227)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4EBC814: vty_command (vty.c:530)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4EBC9EF: vty_execute (vty.c:1295)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4EBF1F7: vtysh_read (vty.c:2142)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4EB739B: thread_call (thread.c:1692)
2022-08-18 04:57:32,377 - ERROR: ==12100==    by 0x4E85B17: frr_run (libfrr.c:1068)
2022-08-18 04:57:32,377 - ERROR: ==12100==

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agoisisd: changes for code maintainability
sri-mohan1 [Mon, 29 Aug 2022 13:35:24 +0000 (19:05 +0530)]
isisd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11855 from cscarpitta/fix-srv6-memleaks
Donatas Abraitis [Mon, 29 Aug 2022 11:35:24 +0000 (14:35 +0300)]
Merge pull request #11855 from cscarpitta/fix-srv6-memleaks

*: Fix several memory leaks in SRv6 implementation

2 years agoMerge pull request #11869 from sri-mohan1/sri-isis-dbg1
Donatas Abraitis [Mon, 29 Aug 2022 10:43:11 +0000 (13:43 +0300)]
Merge pull request #11869 from sri-mohan1/sri-isis-dbg1

isisd: changes for code maintainability

2 years agoMerge pull request #11581 from AbhishekNR/mld_hardcode_value
Donatas Abraitis [Mon, 29 Aug 2022 10:27:28 +0000 (13:27 +0300)]
Merge pull request #11581 from AbhishekNR/mld_hardcode_value

pim6d: Completing mld config commands.

2 years agoMerge pull request #11857 from mobash-rasool/fixes2
Donatas Abraitis [Mon, 29 Aug 2022 07:14:34 +0000 (10:14 +0300)]
Merge pull request #11857 from mobash-rasool/fixes2

pim6d: mroute stuck in register state, multicast traffic getting drops

2 years agoisisd: changes for code maintainability
sri-mohan1 [Mon, 29 Aug 2022 06:53:46 +0000 (12:23 +0530)]
isisd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agodoc: Changed uppercase MLD to lowercase in ipv6 MLD last-member-query-interval (1...
Abhishek N R [Mon, 29 Aug 2022 06:35:03 +0000 (23:35 -0700)]
doc: Changed uppercase MLD to lowercase in ipv6 MLD last-member-query-interval (1-65535)

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agopim6d: Completing "ipv6 mld last-member-query-interval" command
Abhishek N R [Mon, 11 Jul 2022 17:09:39 +0000 (10:09 -0700)]
pim6d: Completing "ipv6 mld last-member-query-interval" command

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agopim6d: Completing "ipv6 mld last-member-query-count" command.
Abhishek N R [Mon, 11 Jul 2022 15:51:52 +0000 (08:51 -0700)]
pim6d: Completing "ipv6 mld last-member-query-count" command.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agopim6d: Completing "ipv6 mld query-max-response-time" command.
Abhishek N R [Mon, 11 Jul 2022 08:33:07 +0000 (01:33 -0700)]
pim6d: Completing "ipv6 mld query-max-response-time" command.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agoMerge pull request #11867 from sri-mohan1/sri-ospf-dbg1
mobash-rasool [Mon, 29 Aug 2022 06:20:54 +0000 (11:50 +0530)]
Merge pull request #11867 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoospfd: changes for code maintainability
sri-mohan1 [Fri, 26 Aug 2022 17:22:36 +0000 (22:52 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11863 from sri-mohan1/sri-ospf-dbg1
Donald Sharp [Fri, 26 Aug 2022 14:50:21 +0000 (10:50 -0400)]
Merge pull request #11863 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoMerge pull request #11718 from SaiGomathiN/mldgroups
Donatas Abraitis [Fri, 26 Aug 2022 12:19:32 +0000 (15:19 +0300)]
Merge pull request #11718 from SaiGomathiN/mldgroups

pim6d: Implementing "show ipv6 mld groups" CLI

2 years agoMerge pull request #11844 from SaiGomathiN/ttable-1
Donatas Abraitis [Fri, 26 Aug 2022 08:48:18 +0000 (11:48 +0300)]
Merge pull request #11844 from SaiGomathiN/ttable-1

pimd, pim6d: Using ttable for displaying show CLIs

2 years agodoc: Updated the doc for show ipv6 mld groups command
Sai Gomathi N [Tue, 2 Aug 2022 11:09:28 +0000 (04:09 -0700)]
doc: Updated the doc for show ipv6 mld groups command

show ipv6 mld [vrf NAME] groups [json] displays MLD group information.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2 years agopim6d: Implementing "show mld groups" CLI
Sai Gomathi N [Tue, 2 Aug 2022 11:08:11 +0000 (04:08 -0700)]
pim6d: Implementing "show mld groups" CLI

To Display MLD Group information

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2 years agopimd: Modifying member of pim_instance to accomodate IPv6 changes
Sai Gomathi N [Tue, 2 Aug 2022 10:55:09 +0000 (03:55 -0700)]
pimd: Modifying member of pim_instance to accomodate IPv6 changes

Modifying igmp_group_count of struct pim_instance
to gm_group_count which is to be used for both IGMP and MLD.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2 years agoospfd: changes for code maintainability
sri-mohan1 [Fri, 26 Aug 2022 07:24:57 +0000 (12:54 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11854 from donaldsharp/memory_walk_in_gdb
Donatas Abraitis [Fri, 26 Aug 2022 07:20:58 +0000 (10:20 +0300)]
Merge pull request #11854 from donaldsharp/memory_walk_in_gdb

gdb: Add a macro to walk memory allocations

2 years agoMerge pull request #11862 from sri-mohan1/sri-ospf-dbg1
mobash-rasool [Fri, 26 Aug 2022 06:38:53 +0000 (12:08 +0530)]
Merge pull request #11862 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoospfd: changes for code maintainability
sri-mohan1 [Thu, 25 Aug 2022 18:14:50 +0000 (23:44 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11860 from opensourcerouting/fix/evpn_cli_json
Donald Sharp [Thu, 25 Aug 2022 17:20:19 +0000 (13:20 -0400)]
Merge pull request #11860 from opensourcerouting/fix/evpn_cli_json

bgpd: Do not print new line for EVPN CLI outputs if it's a JSON

2 years agoMerge pull request #11858 from sri-mohan1/sri-ospf-dbg1
Donald Sharp [Thu, 25 Aug 2022 13:25:10 +0000 (09:25 -0400)]
Merge pull request #11858 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoMerge pull request #11859 from liwg06/master.fix.extra.semicolon
Mark Stapp [Thu, 25 Aug 2022 12:53:36 +0000 (08:53 -0400)]
Merge pull request #11859 from liwg06/master.fix.extra.semicolon

lib: Fix extra semicolon after if

2 years agobgpd: Drop bnc_str() function
Donatas Abraitis [Thu, 25 Aug 2022 10:53:30 +0000 (13:53 +0300)]
bgpd: Drop bnc_str() function

Reuse %pFX -> prefix2str()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Convert prefix2str to %pFX
Donatas Abraitis [Thu, 25 Aug 2022 10:46:58 +0000 (13:46 +0300)]
bgpd: Convert prefix2str to %pFX

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Do not print new line for EVPN CLI outputs if it's a JSON
Donatas Abraitis [Thu, 25 Aug 2022 10:15:27 +0000 (13:15 +0300)]
bgpd: Do not print new line for EVPN CLI outputs if it's a JSON

Before:

```
$ vtysh -c 'show bgp l2vpn evpn route detail json'
<<<<<<<<<<<<<<<<<<<< empty line
<<<<<<<<<<<<<<<<<<<< empty line
<<<<<<<<<<<<<<<<<<<< empty line
<<<<<<<<<<<<<<<<<<<< empty line
{
...
"numPrefix":4,
"numPaths":4 <<<<< four paths = four empty lines
}
```

Contain as much "empty lines" before the JSON string as the number
of paths displayed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agolib: Fix extra semicolon after if
Weiguo Li [Thu, 25 Aug 2022 09:51:46 +0000 (17:51 +0800)]
lib: Fix extra semicolon after if

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
2 years agoospfd: changes for code maintainability
sri-mohan1 [Wed, 24 Aug 2022 17:56:16 +0000 (23:26 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agopimd, pim6d: Using ttable for displaying "show ip|ipv6 pim jp-agg" CLI
Sai Gomathi N [Mon, 22 Aug 2022 05:58:42 +0000 (22:58 -0700)]
pimd, pim6d: Using ttable for displaying "show ip|ipv6 pim jp-agg" CLI

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2 years agopimd, pim6d: Using ttable for displaying "show ip|ipv6 pim channel" CLI
Sai Gomathi N [Mon, 22 Aug 2022 05:35:04 +0000 (22:35 -0700)]
pimd, pim6d: Using ttable for displaying "show ip|ipv6 pim channel" CLI

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2 years agoMerge pull request #11829 from donaldsharp/time_32_bits
Jafar Al-Gharaibeh [Wed, 24 Aug 2022 16:25:16 +0000 (11:25 -0500)]
Merge pull request #11829 from donaldsharp/time_32_bits

Time 32 bits

2 years agoMerge pull request #11856 from opensourcerouting/fix/revert_clist_internet
Mark Stapp [Wed, 24 Aug 2022 13:32:19 +0000 (09:32 -0400)]
Merge pull request #11856 from opensourcerouting/fix/revert_clist_internet

bgpd: Revert community-list INTERNET stuff

2 years agoripd: Use a sequence number instead of time
Donald Sharp [Wed, 17 Aug 2022 23:05:33 +0000 (19:05 -0400)]
ripd: Use a sequence number instead of time

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobabeld: Remove return value for gettime()
Donald Sharp [Wed, 17 Aug 2022 23:01:30 +0000 (19:01 -0400)]
babeld: Remove return value for gettime()

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Convert time to uint64_t for zclient data structures
Donald Sharp [Wed, 17 Aug 2022 22:58:50 +0000 (18:58 -0400)]
zebra: Convert time to uint64_t for zclient data structures

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agopimd: Intentionally downcast to a uint32_t value
Donald Sharp [Wed, 17 Aug 2022 22:43:09 +0000 (18:43 -0400)]
pimd: Intentionally downcast to a uint32_t value

When calling time(NULL), FRR is intentionally throwing
away the upper 32 bits of value returned.  Let's explicitly
call it out so that coverity understands this is intentional
and ok.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Replace rfapi_time() with monotime()
Donald Sharp [Wed, 17 Aug 2022 22:32:14 +0000 (18:32 -0400)]
bgpd: Replace rfapi_time() with monotime()

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Convert from bgp_clock() to monotime()
Donald Sharp [Wed, 17 Aug 2022 22:27:54 +0000 (18:27 -0400)]
bgpd: Convert from bgp_clock() to monotime()

Let's convert to our actual library call instead
of using yet another abstraction that makes it fun
for people to switch daemons.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agosharpd: Fix memory leaks related to SRv6 nexthops
Carmine Scarpitta [Tue, 23 Aug 2022 22:53:19 +0000 (00:53 +0200)]
sharpd: Fix memory leaks related to SRv6 nexthops

Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 routes
(seg6 and seg6local routes) are handled: when the user executes the CLI
command `sharp install seg6-routes` or `sharp install seg6local-routes`
to create a seg6 or seg6local route, sharpd calls
`nexthop_add_srv6_seg6` or `nexthop_add_srv6_seg6local` to create an
SRv6 nexthop. A pointer to the SRv6 nexthop is stored in the global data
structure `sg.r.nhop`. If you call `sharp install routes`,
`sharp install seg6-routes` or `sharp install seg6local-routes` to create
more routes, `sg.r.nhop` is set to zero and the
pointer to the SRv6 nexthop contained in `sg.r.nhop` is definitely lost
and the allocated memory is never freed.

This patch adds calls to `nexthop_del_srv6_seg6()` and
`nexthop_del_srv6_seg6local()` to free the memory allocated for the SRv6
nexthop before clearing the `sg.r.nhop` data structure.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agosharpd: Fix memory leak in release-locator-chunk
Carmine Scarpitta [Tue, 23 Aug 2022 22:35:43 +0000 (00:35 +0200)]
sharpd: Fix memory leak in release-locator-chunk

Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 chunks are
released: when the user executes the CLI command
`sharp srv6-manager release-locator-chunk` to release the chunks of an
SRv6 locator, the `list_delete()` function is called to delete the
chunks list (`loc->chunks`), but the memory allocated for the chunks is
not freed.

This patch defines a new callback `sharp_srv6_locator_chunk_free()`.
This callback takes care of freeing the memory allocated for a given
chunk. When `list_delete()` is called to remove the chunk list
`loc->chunks`, it automatically calls `sharp_srv6_locator_chunk_free()`
on each element of the list to free the allocated memory before
deleting the list.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agosharpd: Fix memory leak in release-locator-chunk
Carmine Scarpitta [Tue, 23 Aug 2022 22:25:17 +0000 (00:25 +0200)]
sharpd: Fix memory leak in release-locator-chunk

Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 chunks are
released: when the user executes the CLI command
`sharp srv6-manager release-locator-chunk` to release the chunks of an
SRv6 locator, all the chunks are removed from the list `loc->chunks`.
Also, the locator is removed from the SRv6 locators list
`sg.srv6_locators`, but the memory allocated for the locator is not
freed.

This patch adds a call to `XFREE()` to properly free the allocated
memory when all the chunks of an SRv6 locator are removed and the
locator is removed as well.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agobgpd: Fix memory leak in SRv6 locator delete
Carmine Scarpitta [Tue, 23 Aug 2022 22:13:25 +0000 (00:13 +0200)]
bgpd: Fix memory leak in SRv6 locator delete

Running `bgp_srv6l3vpn_to_bgp_vrf` and `bgp_srv6l3vpn_to_bgp_vrf2`
topotests with `--valgrind-memleaks` gives several memory leak errors.
This is due to the way SRv6 locators are removed/unset in bgpd: when
an SRv6 locator is deleted or unset, the memory allocated for the
locator prefix (`tovpn_sid_locator`) is not freed.

This patch adds a `for` loop that iterates over the list of BGP
instances. For each BGP instance using the SRv6 locator to be
removed/unset, we use `XFREE()` to properly free the memory allocated
for `tovpn_sid_locator` after the SRv6 locator is removed or unset.

The memory allocated for `tovpn_sid_locator` cannot be freed before
calling `vpn_leak_postchange_all()`. This is because
after deleting an SRv6 locator, we call `vpn_leak_postchange_all()`
to handle the SRv6 locator deletion and send a BGP Prefix SID withdraw
message. `tovpn_sid_locator` is required to properly build the BGP
Prefix SID withdraw message. After calling `vpn_leak_postchange_all()`
we can safely remove the `tovpn_sid_locator` and free the allocated
memory.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agogdb: Add a macro to walk memory allocations
Donald Sharp [Tue, 23 Aug 2022 20:31:02 +0000 (16:31 -0400)]
gdb: Add a macro to walk memory allocations

Add a macro to walk all memory allocations in a core file.

load the file in gdb:
source /path/to/frr/gdb/lib.txt
mg_walk mg_first
(gdb) mq_walk mg_first
showing active allocations in memory group libfrr
memstats: BFD info:0
memstats: Buffer:5
memstats: Buffer data:0
memstats: Host config:6
memstats: Completion item:0
memstats: Command Tokens:2585
memstats: Command Token Text:1951
memstats: Command Token Help:1951
memstats: Command Argument:0
memstats: Command Argument Name:575
memstats: Command Match Stack:0
memstats: Lexer token (temporary):0
memstats: Path Computation Algorithms:0
memstats: Distribute ctx:0
memstats: Distribute list:0
memstats: Dist-list ifname:0
memstats: Dist-list name:0
memstats: error information:0
memstats: Access List:0
memstats: Access List Str:0
memstats: Access Filter:0
memstats: RCU thread:0
<snip>

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #11848 from rgirada/ospf_gr_nbr
Donatas Abraitis [Wed, 24 Aug 2022 09:39:13 +0000 (12:39 +0300)]
Merge pull request #11848 from rgirada/ospf_gr_nbr

ospfd: Adding per neighbour json details to GR helper detail command

2 years agobgpd: Fix memory leak when an SRv6 SID is removed
Carmine Scarpitta [Tue, 23 Aug 2022 22:02:22 +0000 (00:02 +0200)]
bgpd: Fix memory leak when an SRv6 SID is removed

Running `bgp_srv6l3vpn_to_bgp_vrf` and `bgp_srv6l3vpn_to_bgp_vrf2`
topotests with `--valgrind-memleaks` gives several memory leak errors.
This is due to the way SRv6 SIDs are removed in bgpd: when
an SRv6 locator is deleted/unset, all the SIDs allocated from that
locator are removed from the SRv6 functions list
(`bgp->srv6_functions`),but the memory allocated for the SIDs is not
freed.

This patch adds a call to `XFREE()` to properly free the allocated
memory when an SRv6 SID is removed.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agobgpd: Fix memory leak in SRv6 locator delete/unset
Carmine Scarpitta [Tue, 23 Aug 2022 21:55:05 +0000 (23:55 +0200)]
bgpd: Fix memory leak in SRv6 locator delete/unset

Running `bgp_srv6l3vpn_to_bgp_vrf` and `bgp_srv6l3vpn_to_bgp_vrf2`
topotests with `--valgrind-memleaks` gives several memory leak errors.
This is due to the way SRv6 locators are deleted/unset in bgpd: when
an SRv6 locator is deleted/unset, all the chunks of the locator are
removed from the SRv6 locator chunks list (`bgp->srv6_locator_chunks`).
However, the memory allocated for the chunks is not freed.

This patch adds a call to the `srv6_locator_chunk_free()` function to
properly free the allocated memory when an SRv6 locator is removed or
unset.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agolib: Fix memory leak in `zclient_send_localsid()`
Carmine Scarpitta [Tue, 23 Aug 2022 21:27:47 +0000 (23:27 +0200)]
lib: Fix memory leak in `zclient_send_localsid()`

Running `bgp_srv6l3vpn_to_bgp_vrf` and `bgp_srv6l3vpn_to_bgp_vrf2`
topotests with `--valgrind-memleaks` gives several memory leak errors.
This is due to the way FRR daemons pass local SIDs to zebra: to send a
local SID to zebra, FRR daemons call the `zclient_send_localsid()`
function.

The `zclient_send_localsid()` function performs the following sequence
of operations:
* create a temporary `struct nexthop`;
* call `nexthop_add_srv6_seg6local()` to fill the `struct nexthop` with
the proper local SID information;
* create a `struct zapi_route` and call `zapi_nexthop_from_nexthop()` to
copy the information from the `struct nexthop` to the
`struct zapi_route`;
* send the `struct zapi_route` to zebra through the ZAPI.

The `nexthop_add_srv6_seg6local()` function uses `XCALLOC()` to allocate
memory for the SRv6 nexthop. This memory is never freed.

Creating a temporary `struct nexthop` is unnecessary, as the local SID
information can be pushed directly to the `struct zapi_route`. This
patch simplifies the implementation of `zclient_send_localsid()` by
avoiding using the temporary `struct nexthop`. This eliminates the need
to use `nexthop_add_srv6_seg6local()` to fill the `struct nexthop` and
consequently fixes the memory leak.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agozebra: Fix memory leak in SRv6 locator delete
Carmine Scarpitta [Tue, 23 Aug 2022 20:40:47 +0000 (22:40 +0200)]
zebra: Fix memory leak in SRv6 locator delete

Running `srv6_locator` topotest with `--valgrind-memleaks` gives several
memory leak errors. This is due to the way SRv6 locators are deleted:
when an SRv6 locator is deleted, it is removed from the SRv6 locators
list (`srv6->locators`), but the memory allocated for the SRv6 locator
is not freed.

This patch adds a call to the `srv6_locator_free()` function to properly
free the allocated memory when an SRv6 locator is removed.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agoMerge pull request #11853 from sri-mohan1/sri-ospf-dbg1
Donatas Abraitis [Wed, 24 Aug 2022 06:19:51 +0000 (09:19 +0300)]
Merge pull request #11853 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agodoc: Define `internet` BGP community
Donatas Abraitis [Wed, 24 Aug 2022 05:59:25 +0000 (08:59 +0300)]
doc: Define `internet` BGP community

Overall, rfc1997 states:

The community attribute values ranging from 0x0000000 through
   0x0000FFFF and 0xFFFF0000 through 0xFFFFFFFF are hereby reserved.

But we have a special handling here, like Cisco IOS XR.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoRevert "bgpd: Drop `internet` community check from community_list_match()"
Donatas Abraitis [Wed, 24 Aug 2022 05:46:56 +0000 (08:46 +0300)]
Revert "bgpd: Drop `internet` community check from community_list_match()"

Seems that, `internet` community is used to match ANY community.

This reverts commit e605d0cfae6a3fc9b65058ec85b55d7d0bd5cc22.

2 years agoRevert "tests: Check if BGP community-list filtering works correctly"
Donatas Abraitis [Wed, 24 Aug 2022 05:46:47 +0000 (08:46 +0300)]
Revert "tests: Check if BGP community-list filtering works correctly"

This reverts commit b08784281471bebb8b8dd4a97e558ae7cc078954.

2 years agoospfd: Adding per neighbour json details to GR helper detail command
rgirada [Mon, 22 Aug 2022 18:15:56 +0000 (11:15 -0700)]
ospfd: Adding per neighbour json details to GR helper detail command

Description:
Per neighbor GR enabled information is  missing from json
output in "show ip ospf gr helper details json" command.

      Example config:

frr(config-router)# graceful-restart helper enable 2.2.2.2
frr(config-router)#
frr(config-router)# do show ip ospf  graceful-restart helper  detail

       OSPF Router with ID (10.112.156.220)

Graceful restart helper support disabled.
Strict LSA check is enabled.
Helper supported for Planned and Unplanned Restarts.
Supported Graceful restart interval: 1800(in seconds).
Enable Router list:
2.2.2.2,

frr(config-router)# do show ip ospf  graceful-restart helper  detail json
{
 "routerId":"10.112.156.220",
 "helperSupport":"Disabled",
 "strictLsaCheck":"Enabled",
 "restartSupoort":"Planned and Unplanned Restarts",
 "supportedGracePeriod":1800,
}
frr(config-router)#

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2 years agoospfd: changes for code maintainability
sri-mohan1 [Tue, 23 Aug 2022 16:45:38 +0000 (22:15 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11851 from sri-mohan1/sri-ospf-dbg1
Russ White [Tue, 23 Aug 2022 15:07:29 +0000 (11:07 -0400)]
Merge pull request #11851 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoMerge pull request #11820 from opensourcerouting/fix/clist_match
Russ White [Tue, 23 Aug 2022 15:06:15 +0000 (11:06 -0400)]
Merge pull request #11820 from opensourcerouting/fix/clist_match

bgpd: Fix community-list handling

2 years agoMerge pull request #11836 from ak503/nhrp_nbma
Philippe Guibert [Tue, 23 Aug 2022 15:06:02 +0000 (17:06 +0200)]
Merge pull request #11836 from ak503/nhrp_nbma

nhrpd: Use nhrp_interface_update_nbma when source vrf was changed

2 years agoMerge pull request #11840 from xdxu/master
Russ White [Tue, 23 Aug 2022 14:58:57 +0000 (10:58 -0400)]
Merge pull request #11840 from xdxu/master

ospf6d: Don't remove summary route if it is a range

2 years agoMerge pull request #11842 from opensourcerouting/fix/topotests_platform_check
Russ White [Tue, 23 Aug 2022 14:58:01 +0000 (10:58 -0400)]
Merge pull request #11842 from opensourcerouting/fix/topotests_platform_check

tests: Log as error if some of the daemons are missing

2 years agoMerge pull request #11843 from ARShreenidhi/ecmp_testcase
Russ White [Tue, 23 Aug 2022 14:57:13 +0000 (10:57 -0400)]
Merge pull request #11843 from ARShreenidhi/ecmp_testcase

tests : bgp-default-originate ecmp scenerio is added

2 years agoospfd: changes for code maintainability
sri-mohan1 [Tue, 23 Aug 2022 11:17:37 +0000 (16:47 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agopim6d: mroute stuck in register state, multicast traffic getting drops
Mobashshera Rasool [Tue, 23 Aug 2022 07:09:20 +0000 (00:09 -0700)]
pim6d: mroute stuck in register state, multicast traffic getting drops

IPv4 and IPv6 behaves a little bit differently with the socket
options.
IPPROTO_RAW socket option is only for IPv4.
Therefore the register packet was not properly getting encapculated
for PIMv6 and was working fine for PIMv4.

So have used IPPROTO_PIM for PIMv6.

Fixes: #11846
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2 years agoMerge pull request #11847 from sri-mohan1/sri-ospf-dbg1
mobash-rasool [Tue, 23 Aug 2022 04:57:13 +0000 (10:27 +0530)]
Merge pull request #11847 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoospfd: changes for code maintainability
sri-mohan1 [Mon, 22 Aug 2022 17:30:35 +0000 (23:00 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11845 from sri-mohan1/sri-ospf-dbg1
Donald Sharp [Mon, 22 Aug 2022 16:46:49 +0000 (12:46 -0400)]
Merge pull request #11845 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agonhrpd: Use nhrp_interface_update_nbma when source vrf was changed
Dmitrii Turlupov [Fri, 19 Aug 2022 14:12:55 +0000 (17:12 +0300)]
nhrpd: Use nhrp_interface_update_nbma when source vrf was changed

1. Run frr:
interface enp0s8
 ip address 193.168.1.2/24
exit
!
interface gre1
 ip address 10.8.1.2/32
 ip nhrp network-id 1
 ip nhrp nhs dynamic nbma 193.168.1.1
 tunnel source enp0s8
exit

Log:

NHS: Register 10.8.1.2 -> 10.8.1.2 (timeout 2)
Send Registration-Request(3) 10.8.1.2 -> 10.8.1.2
Recv Registration-Reply(4) 10.8.1.1 -> 10.8.1.2

2. Create VRF and move enp0s8 to VRF
 ip link set enp0s8 master vrf1

Before patch:
NHS: Waiting link for 193.168.1.1

After patch:
NHS: Register 10.8.1.2 -> 10.8.1.2 (timeout 2)

Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
2 years agoospfd: changes for code maintainability
sri-mohan1 [Mon, 22 Aug 2022 12:49:04 +0000 (18:19 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agoMerge pull request #11841 from sri-mohan1/sri-ospf-dbg1
Donatas Abraitis [Mon, 22 Aug 2022 10:11:51 +0000 (13:11 +0300)]
Merge pull request #11841 from sri-mohan1/sri-ospf-dbg1

ospfd: changes for code maintainability

2 years agoospfd: changes for code maintainability
sri-mohan1 [Sat, 20 Aug 2022 05:54:29 +0000 (11:24 +0530)]
ospfd: changes for code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agotests : bgp-default-originate ecmp scenerio is added
ARShreenidhi [Mon, 22 Aug 2022 05:01:43 +0000 (05:01 +0000)]
tests : bgp-default-originate ecmp scenerio is added

Signed-off-by: ARShreenidhi <rshreenidhi@vmware.com>
2 years agotests: Log as error if some of the daemons are missing
Donatas Abraitis [Sat, 20 Aug 2022 18:45:06 +0000 (21:45 +0300)]
tests: Log as error if some of the daemons are missing

Also print runtime directory for topotests if the error occurs.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11835 from crosser/fix-lua-build
Donatas Abraitis [Sat, 20 Aug 2022 13:45:28 +0000 (16:45 +0300)]
Merge pull request #11835 from crosser/fix-lua-build

debian: add lua _binary_ to build dependencies

2 years agoospf6d: Don't remove summary route if it is a range
Xiaodong Xu [Sat, 20 Aug 2022 00:25:41 +0000 (17:25 -0700)]
ospf6d: Don't remove summary route if it is a range

Fix issue #11839.

When the user defines a range in an area other than the backbone area, the
summary route will be announced to the backbone area as an inter-area LSA.
However, if the prefix defined in the range is the same prefix as a connected
route in that area, the LSA won't be announced to the backbone area.

This is because when ospf6d is originating the summary route for the
intra-area route, it finds the range configured by the user and tries to
suppress the route by deleting the existing summary route, which happens to be
the one created by the range.

Although the range definition is not necessary in this case, it should not
fail this use case. So let's just keep the summary route there if it is
created from the user defined range.

Signed-off-by: Xiaodong Xu <stid.smth@gmail.com>
2 years agoMerge pull request #11832 from sigeryang/master
Quentin Young [Fri, 19 Aug 2022 14:16:56 +0000 (10:16 -0400)]
Merge pull request #11832 from sigeryang/master

zebra: trim unused tc dplane result values

2 years agodebian: add lua _binary_ to build dependencies
Eugene Crosser [Fri, 19 Aug 2022 13:56:57 +0000 (15:56 +0200)]
debian: add lua _binary_ to build dependencies

FRR only needs lua library (package libluaX.Y-dev) to be compiled and
linked, but its `configure` script makes use of lua interpreter to
perform its checks. Therefore, `luaX.Y` package is a requisite
build-dependency for debian packaging.

This commit adds the debian package with the lua interpreter to the
build dependencies.

Signed-off-by: Eugene Crosser <crosser@average.org>
2 years agoMerge pull request #11777 from donaldsharp/metaq_processing
Donatas Abraitis [Fri, 19 Aug 2022 11:43:33 +0000 (14:43 +0300)]
Merge pull request #11777 from donaldsharp/metaq_processing

Metaq processing

2 years agoMerge pull request #11827 from sri-mohan1/sri-ospf-dbg1
mobash-rasool [Fri, 19 Aug 2022 10:48:46 +0000 (16:18 +0530)]
Merge pull request #11827 from sri-mohan1/sri-ospf-dbg1

ospfd: changes to improve code maintainability

2 years agoospfd: changes code maintainability
sri-mohan1 [Wed, 17 Aug 2022 20:31:01 +0000 (02:01 +0530)]
ospfd: changes code maintainability

these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2 years agozebra: trim unused tc dplane result values
Siger Yang [Thu, 18 Aug 2022 15:35:41 +0000 (23:35 +0800)]
zebra: trim unused tc dplane result values

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2 years agoMerge pull request #11830 from AbhishekNR/unused_var
Donald Sharp [Thu, 18 Aug 2022 10:28:51 +0000 (06:28 -0400)]
Merge pull request #11830 from AbhishekNR/unused_var

pimd, pim6d: Removing unused parameter

2 years agoMerge pull request #11485 from AbhishekNR/ipv6_mld_todo
Donatas Abraitis [Thu, 18 Aug 2022 06:47:03 +0000 (09:47 +0300)]
Merge pull request #11485 from AbhishekNR/ipv6_mld_todo

pim6d: Completing "ipv6 mld" config command.

2 years agoMerge pull request #11826 from mjstapp/stop_zebra_last
Donatas Abraitis [Thu, 18 Aug 2022 06:19:04 +0000 (09:19 +0300)]
Merge pull request #11826 from mjstapp/stop_zebra_last

tools: stop zebra daemon last

2 years agoMerge pull request #11817 from AbhishekNR/ttable_pim_rp-info
Donatas Abraitis [Thu, 18 Aug 2022 06:16:00 +0000 (09:16 +0300)]
Merge pull request #11817 from AbhishekNR/ttable_pim_rp-info

pimd, pim6d: Using ttable for displaying "show ip/ipv6 pim rp-info"  command output.

2 years agoMerge pull request #11783 from AbhishekNR/ttbale_show_cli
Donatas Abraitis [Thu, 18 Aug 2022 06:15:34 +0000 (09:15 +0300)]
Merge pull request #11783 from AbhishekNR/ttbale_show_cli

pimd, pim6d: Using ttable for displaying show ip/ipv6 pim CLI's output

2 years agopimd, pim6d: Removing unused parameter
Abhishek N R [Thu, 18 Aug 2022 06:09:11 +0000 (23:09 -0700)]
pimd, pim6d: Removing unused parameter

Signed-off-by: Abhishek N R <abnr@vmware.com>
2 years agozebra: No need for a rib_delete before a rib_add
Donald Sharp [Wed, 10 Aug 2022 00:09:03 +0000 (20:09 -0400)]
zebra: No need for a rib_delete before a rib_add

In kernel_socket.c, the code is deleting and then adding
the route back in on a change operation.  This just translates
too two re's, one for deletion and one for addition.  The deletion
will just be ignored.  Let's not do the extra deletion.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: use rib_add_multipath in rt_netlink.c
Donald Sharp [Wed, 10 Aug 2022 00:07:09 +0000 (20:07 -0400)]
zebra: use rib_add_multipath in rt_netlink.c

The new route code path was using a combination of
both rib_add() and rib_add_multipath() let's clean
it up some to use rib_add_multipath()

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Create a zebra_rib_route_entry_new function and use it
Donald Sharp [Tue, 9 Aug 2022 23:56:08 +0000 (19:56 -0400)]
zebra: Create a zebra_rib_route_entry_new function and use it

Abstract the creation of the route_entry and use it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Introduce early route processing on the MetaQ
Donald Sharp [Tue, 2 Aug 2022 17:57:18 +0000 (13:57 -0400)]
zebra: Introduce early route processing on the MetaQ

Currently if an operator does this operation:

sharpd@eva ~/frr8> sudo ip nexthop add id 5000 via 192.168.119.44 dev enp39s0 ; sudo ip route add 10.0.0.1 nhid 5000
2022/06/30 08:52:40 ZEBRA: [ZHQK5-J9M1R] proto2zebra: Please add this protocol(0) to proper rt_netlink.c handling
2022/06/30 08:52:40 ZEBRA: [PS16P-365FK][EC 4043309076] Zebra failed to find the nexthop hash entry for id=5000 in a route entry
sharpd@eva ~/frr8> vtysh -c "show ip route 10.0.0.1"
Routing entry for 0.0.0.0/0
  Known via "kernel", distance 0, metric 100, best
  Last update 00:01:58 ago
  * 192.168.119.1, via enp39s0

The route is dropped by zebra with no warnings.  This is not good,
but unlikely to happen at this point in time.  In order to fix
this issue route processing from inputs needs to happen after nexthop
group processing from inputs.  This was not possible because
nexthop groups are placed on the metaQ.  As such the above
nexthop group creation is placed on the metaQ for processing
in META_QUEUE_NHG.  Then the route is read in and processed
immediately.  The nexthop group is not found ( not processed yet!)
and the route is dropped in zebra.

Modify the code to have early route processing of validity
on the MetaQ.  This preserves the order of operations.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Convert label processing to Meta-Q
Donald Sharp [Tue, 9 Aug 2022 20:00:24 +0000 (16:00 -0400)]
zebra: Convert label processing to Meta-Q

Convert label processing that comes from zapi messages
into being handled by the meta-Q.  This is because early
route processing is going to be moved to the meta-Q as
well and we will have a chicken and egg problem without
moving this code to be processed by the meta-Q.

Ordering of messages from ospf as an example:
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:48] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:48] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:48] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:48] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:62] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:43] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:61] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_ROUTE_ADD:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_MPLS_LABELS_REPLACE:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_MPLS_LABELS_REPLACE:0:66] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_MPLS_LABELS_REPLACE:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_MPLS_LABELS_REPLACE:0:47] comes from socket [36]
2022/08/09 08:55:52.740 ZEBRA: [YXG8K-BCYMV] zebra message[ZEBRA_MPLS_LABELS_REPLACE:0:47] comes from socket [36]

The ZEBRA_MPLS_LABELS_REPLACE immediately turn around and attempt to replace nexthop labels on routes that
were added.  If the route add is placed on the metaQ, it will not exist yet and as such the label replace
will fail.

Modify the zebra code to take the label operations and place them on the metaQ as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #11824 from sigeryang/master
Donald Sharp [Wed, 17 Aug 2022 13:59:37 +0000 (09:59 -0400)]
Merge pull request #11824 from sigeryang/master

zebra: fix deadcodes in tc dplane & netlink

2 years agoMerge pull request #11819 from sworleys/TC_enum_fix
Christian Hopps [Wed, 17 Aug 2022 13:57:34 +0000 (09:57 -0400)]
Merge pull request #11819 from sworleys/TC_enum_fix

zebra: add TC handlers in script code

2 years agozebra: fix ctab calculation typo in tc netlink
Siger Yang [Wed, 17 Aug 2022 11:02:13 +0000 (19:02 +0800)]
zebra: fix ctab calculation typo in tc netlink

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2 years agozebra: use default NS directly in tc dplane
Siger Yang [Wed, 17 Aug 2022 11:00:39 +0000 (19:00 +0800)]
zebra: use default NS directly in tc dplane

Signed-off-by: Siger Yang <siger.yang@outlook.com>