summaryrefslogtreecommitdiff
path: root/lib/link_state.h
AgeCommit message (Collapse)Author
2023-04-20Merge pull request #12933 from Orange-OpenSource/link_statePhilippe Guibert
lib: Update edge key in link state database
2023-04-18lib,isisd: refactor igp-agnostic sr misc functionsHiroki Shirokura
SR Algorithms are independent of specific IGPs such as IS-IS. This commit adds lib/sr to aggregate IGP agnostic functions and constants. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-04-07lib: Update Edge Key in link_stateOlivier Dugeon
The original uin64_t for the edge key in link state is not always appropriate with IPv6 addresses. In some cases, 2 different edge with 2 different IPv6 addresses could conduct to the same key. The resulting TED is wrong in this case. This patch replace the uint64_t edge key by a dedicated structure. The resulting key of the edge is: - the local IPv4 address of the corresponding link - the local IPv6 address if no IPv4 address is configured on the link - the local + remote link ID for unnumbered address Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-04-06*: Use a `struct prefix *p` instead of a `struct prefix` in functionsDonald Sharp
When passing a prefix into a function let's pass by address instead of pass by value. Let's save our stack space. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-10lib,isisd: add extended admin-group info into the tedLouis Scalbert
Add extended admin-group info into the ted. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.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-08-01lib: Correct valgrind errorsOlivier Dugeon
In CSPF topo test, valgrind detects uninitialized bytes when exporting TE Opaque information through ZEBRA. This is due to C pragma compilation directive __attribute__(aligned(8)) in struct ls_node_id in link_state.h. Valgrind consideris that struct ls_node_id nid = {} doesn't initialized the padding bytes introduced by gcc. This patch simply removes the C pragma compilation directive and also takes opportunity to remove the transmission of remote node id for vertices and subnets which is not known. Indeed, remote node id is only pertinent for edges. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2022-03-31isisd, lib, ospfd, pathd: Null out free'd pointerDonald Sharp
The commands: router isis 1 mpls-te on no mpls-te on mpls-te on no mpls-te on ! Will crash Valgrind gives us this: ==652336== Invalid read of size 8 ==652336== at 0x49AB25C: typed_rb_min (typerb.c:495) ==652336== by 0x4943B54: vertices_const_first (link_state.h:424) ==652336== by 0x493DCE4: vertices_first (link_state.h:424) ==652336== by 0x493DADC: ls_ted_del_all (link_state.c:1010) ==652336== by 0x47E77B: isis_instance_mpls_te_destroy (isis_nb_config.c:1871) ==652336== by 0x495BE20: nb_callback_destroy (northbound.c:1131) ==652336== by 0x495B5AC: nb_callback_configuration (northbound.c:1356) ==652336== by 0x4958127: nb_transaction_process (northbound.c:1473) ==652336== by 0x4958275: nb_candidate_commit_apply (northbound.c:906) ==652336== by 0x49585B8: nb_candidate_commit (northbound.c:938) ==652336== by 0x495CE4A: nb_cli_classic_commit (northbound_cli.c:64) ==652336== by 0x495D6C5: nb_cli_apply_changes_internal (northbound_cli.c:250) ==652336== Address 0x6f928e0 is 272 bytes inside a block of size 320 free'd ==652336== at 0x48399AB: free (vg_replace_malloc.c:538) ==652336== by 0x494BA30: qfree (memory.c:141) ==652336== by 0x493D99D: ls_ted_del (link_state.c:997) ==652336== by 0x493DC20: ls_ted_del_all (link_state.c:1018) ==652336== by 0x47E77B: isis_instance_mpls_te_destroy (isis_nb_config.c:1871) ==652336== by 0x495BE20: nb_callback_destroy (northbound.c:1131) ==652336== by 0x495B5AC: nb_callback_configuration (northbound.c:1356) ==652336== by 0x4958127: nb_transaction_process (northbound.c:1473) ==652336== by 0x4958275: nb_candidate_commit_apply (northbound.c:906) ==652336== by 0x49585B8: nb_candidate_commit (northbound.c:938) ==652336== by 0x495CE4A: nb_cli_classic_commit (northbound_cli.c:64) ==652336== by 0x495D6C5: nb_cli_apply_changes_internal (northbound_cli.c:250) ==652336== Block was alloc'd at ==652336== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==652336== by 0x494B6F8: qcalloc (memory.c:116) ==652336== by 0x493D7D2: ls_ted_new (link_state.c:967) ==652336== by 0x47E4DD: isis_instance_mpls_te_create (isis_nb_config.c:1832) ==652336== by 0x495BB29: nb_callback_create (northbound.c:1034) ==652336== by 0x495B547: nb_callback_configuration (northbound.c:1348) ==652336== by 0x4958127: nb_transaction_process (northbound.c:1473) ==652336== by 0x4958275: nb_candidate_commit_apply (northbound.c:906) ==652336== by 0x49585B8: nb_candidate_commit (northbound.c:938) ==652336== by 0x495CE4A: nb_cli_classic_commit (northbound_cli.c:64) ==652336== by 0x495D6C5: nb_cli_apply_changes_internal (northbound_cli.c:250) ==652336== by 0x495D23E: nb_cli_apply_changes (northbound_cli.c:268) Let's null out the pointer. After this change. Valgrind no longer reports issues and isisd no longer crashes. Fixes: #10939 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-30lib: Update Link State functions to handle IPv6Olivier Dugeon
In order to add Link State Traffic Engineering to IS-IS, Link State library should have been updated: - Correct Node and Edge RB Tree comparison functions to support key > 32 bits - Change Subnet RB Tree comparison function to take into account host part of the prefix i.e. 10.0.0.1/24 and 10.0.0.2/24 are considered as different - Add new function to convert IS-IS ISO system ID into Vertex or Edge key that take into account Endianness architecture - Correct Vertex and Edge creation and search function accordingly - Add extra Adjacency entries in Link State Attributes for IPv6 Segment Routing - Update send/received and show TED functions accordingly Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-10-29lib: Fix comparison function in link_state.cOlivier Dugeon
ls_node_same, ls_attributes_same and ls_prefix_same are not producing expected result due to a wrong usage of memcmp. In addition, if respective structures are not initialized with 0, there is a risk that the comparison failed. This patch correct usage of memcmp and expand comparison to each invidual parameters of the respective structure for safer result. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-03-23lib: Update Link State DatabaseOlivier Dugeon
Add new status for Vertex, Edge and Subnet to manage their respective states in the data base. Add new functions: - to register/unregister server and client - to show content of the Database (VTY and Json output) - to update and compare subnets - to clean vertex and ted from ORPHAN elements - to convert message or stream into a Link State Element and update Link State Database accordingly to message event Change Edge and Vertex key computation by using the host order systematically. This impact mostly key based on IPv4 addresses where `ntohl()` function must be used when searching a Vertex or Edge by key. Update the documentation accordingly Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-03-17*: require semicolon after DEFINE_<typesafe...>David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-01-04lib: Add Link State DatabaseOlivier Dugeon
Define new models for Link State Database a.k.a TED and functions to manipulate the new database as well as exchange Link State information through ZAPI Opaque message. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>