summaryrefslogtreecommitdiff
path: root/bgpd/bgp_community_alias.c
AgeCommit message (Collapse)Author
2023-03-21*: Add a hash_clean_and_free() functionDonald Sharp
Add a hash_clean_and_free() function as well as convert the code to use it. This function also takes a double pointer to the hash to set it NULL. Also it cleanly does nothing if the pointer is NULL( as a bunch of code tested for ). Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-07-16bgpd: Fix memory leak for community aliasDonatas Abraitis
==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 94 of 97 ==361630== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==361630== by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x1FD3CC: bgp_ca_alias_insert (in /usr/lib/frr/bgpd) ==361630== by 0x2CF8E5: bgp_community_alias_magic (in /usr/lib/frr/bgpd) ==361630== by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd) ==361630== by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x1EBEE8: main (in /usr/lib/frr/bgpd) ==361630== ==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 95 of 97 ==361630== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==361630== by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x1FD39C: bgp_ca_community_insert (in /usr/lib/frr/bgpd) ==361630== by 0x2CF8F4: bgp_community_alias_magic (in /usr/lib/frr/bgpd) ==361630== by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd) ==361630== by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0) ==361630== by 0x1EBEE8: main (in /usr/lib/frr/bgpd) Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-03*: remove the checking returned value for hash_get()anlan_cs
Firstly, *keep no change* for `hash_get()` with NULL `alloc_func`. Only focus on cases with non-NULL `alloc_func` of `hash_get()`. Since `hash_get()` with non-NULL `alloc_func` parameter shall not fail, just ignore the returned value of it. The returned value must not be NULL. So in this case, remove the unnecessary checking NULL or not for the returned value and add `void` in front of it. Importantly, also *keep no change* for the two cases with non-NULL `alloc_func` - 1) Use `assert(<returned_data> == <searching_data>)` to ensure it is a created node, not a found node. Refer to `isis_vertex_queue_insert()` of isisd, there are many examples of this case in isid. 2) Use `<returned_data> != <searching_data>` to judge it is a found node, then free <searching_data>. Refer to `aspath_intern()` of bgpd, there are many examples of this case in bgpd. Here, <returned_data> is the returned value from `hash_get()`, and <searching_data> is the data, which is to be put into hash table. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-04build: first header *must* be zebra.h or config.hDavid Lamparter
This has already been a requirement for Solaris, it is still a requirement for some of the autoconf feature checks to work correctly, and it will be a requirement for `-fms-extensions`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-02bgpd: strncmp -> strcmp in community hash fooQuentin Young
buffers are null terminated Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-08-11bgpd: fix memory leaks in bgp_alias2community_strIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-10bgpd: BGP extended [l]community-list regexp match must work with aliasesDonatas Abraitis
We have to convert BGP alias to numerical format to compare in regexp. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-16bgpd: Allow for auto-completion of community alias's createdDonald Sharp
Add a bit of code to allow for auto-completion of the community alias command when attempting to use it for show commands. example: eva(config)# bgp community alias 11:22 FOO eva(config)# end eva# show bgp ipv4 uni alias ALIAS_NAME BGP community alias FOO Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-05bgpd: Create BGP alias names for community/large-communityDonatas Abraitis
Show alias name instead of numerical value in `show bgp <prefix>. E.g.: ``` root@exit1-debian-9:~/frr# vtysh -c 'sh run' | grep 'bgp community alias' bgp community alias 65001:123 community-1 bgp community alias 65001:123:1 lcommunity-1 root@exit1-debian-9:~/frr# ``` ``` exit1-debian-9# sh ip bgp 172.16.16.1/32 BGP routing table entry for 172.16.16.1/32, version 21 Paths: (2 available, best #2, table default) Advertised to non peer-group peers: 65030 192.168.0.2 from home-spine1.donatas.net(192.168.0.2) (172.16.16.1) Origin incomplete, metric 0, valid, external, best (Neighbor IP) Community: 65001:12 65001:13 community-1 65001:65534 Large Community: lcommunity-1 65001:123:2 Last update: Fri Apr 16 12:51:27 2021 exit1-debian-9# ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>