summaryrefslogtreecommitdiff
path: root/lib/cspf.c
AgeCommit message (Collapse)Author
2023-08-21lib: Clear Computed Path Pointer to Destination on CleanKeelan10
This commit ensures proper cleanup by clearing the `algo->pdst` pointer if it points to a path that is being deleted. It addresses memory leaks by freeing memory held by `algo->pdst` that might not have been released during the cleanup of processed paths. The ASan leak log for reference: ``` Direct leak of 96 byte(s) in 1 object(s) allocated from: #0 0x7fbffcec9a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x7fbffca67a81 in qcalloc ../lib/memory.c:105 #2 0x7fbffc9d1a54 in cpath_new ../lib/cspf.c:44 #3 0x7fbffc9d2829 in cspf_init ../lib/cspf.c:256 #4 0x7fbffc9d295d in cspf_init_v4 ../lib/cspf.c:287 #5 0x5601dcd34d3f in show_sharp_cspf_magic ../sharpd/sharp_vty.c:1262 #6 0x5601dcd2c2be in show_sharp_cspf sharpd/sharp_vty_clippy.c:1869 #7 0x7fbffc9afd61 in cmd_execute_command_real ../lib/command.c:993 #8 0x7fbffc9b00ee in cmd_execute_command ../lib/command.c:1052 #9 0x7fbffc9b0dc0 in cmd_execute ../lib/command.c:1218 #10 0x7fbffcb611c7 in vty_command ../lib/vty.c:591 #11 0x7fbffcb660ac in vty_execute ../lib/vty.c:1354 #12 0x7fbffcb6c4aa in vtysh_read ../lib/vty.c:2362 #13 0x7fbffcb51324 in event_call ../lib/event.c:1979 #14 0x7fbffca3b872 in frr_run ../lib/libfrr.c:1213 #15 0x5601dcd11c6f in main ../sharpd/sharp_main.c:177 #16 0x7fbffc5ffd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Indirect leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7fbffcec9a37 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 #1 0x7fbffca67a81 in qcalloc ../lib/memory.c:105 #2 0x7fbffca3c108 in list_new ../lib/linklist.c:49 #3 0x7fbffc9d1acc in cpath_new ../lib/cspf.c:47 #4 0x7fbffc9d2829 in cspf_init ../lib/cspf.c:256 #5 0x7fbffc9d295d in cspf_init_v4 ../lib/cspf.c:287 #6 0x5601dcd34d3f in show_sharp_cspf_magic ../sharpd/sharp_vty.c:1262 #7 0x5601dcd2c2be in show_sharp_cspf sharpd/sharp_vty_clippy.c:1869 #8 0x7fbffc9afd61 in cmd_execute_command_real ../lib/command.c:993 #9 0x7fbffc9b00ee in cmd_execute_command ../lib/command.c:1052 #10 0x7fbffc9b0dc0 in cmd_execute ../lib/command.c:1218 #11 0x7fbffcb611c7 in vty_command ../lib/vty.c:591 #12 0x7fbffcb660ac in vty_execute ../lib/vty.c:1354 #13 0x7fbffcb6c4aa in vtysh_read ../lib/vty.c:2362 #14 0x7fbffcb51324 in event_call ../lib/event.c:1979 #15 0x7fbffca3b872 in frr_run ../lib/libfrr.c:1213 #16 0x5601dcd11c6f in main ../sharpd/sharp_main.c:177 #17 0x7fbffc5ffd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 ``` Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-04-03sharpd: Fix sharpd memory leakKeelan10
Free path Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.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-02-02lib: Add CSPF Path Computation algorithmOlivier Dugeon
As helper function of Segment Routing Flex Algo or RSVP-TE add Constrained Shortest Path First algorithm able to compute path with constraints. Supported constraints are as follow: - Standard IGP metric - TE IGP metric - Delay metric - Bandwidth for given Class of Service for bandwidth reservation (RSVP-TE) Usage of CSPF algorithms is detailed in the doc/developer/cspf.rst file Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>