Commit graph

17 commits

Author SHA1 Message Date
Philippe Guibert 4e76df0547 isis, lib: add isis srv6 end sid to ls_prefix
According to draft-ietf-lsr-isis-srv6-extensions draft,
the End SID should be available in link state prefix
information.

Add the SID information in the link state prefix, by
getting the END SID from the locator TLV information.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-07-11 09:14:34 +02:00
Philippe Guibert a08922256a isis, lib: add isis srv6 capability to ls_node
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-23 14:27:01 +02:00
Philippe Guibert 196f0d69fa isisd, lib: add link state support for srv6 adjacencies
Add support for endx_lan and endx adjacency.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-04-23 14:27:01 +02:00
Philippe Guibert 7b343a9ed5
Merge pull request #12933 from Orange-OpenSource/link_state
lib: Update edge key in link state database
2023-04-20 18:33:21 +02:00
Hiroki Shirokura 81a067cd92 lib,isisd: refactor igp-agnostic sr misc functions
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-18 10:11:43 +02:00
Olivier Dugeon 9a9f0b893e lib: Update Edge Key in link_state
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-07 16:40:25 +02:00
Donald Sharp b589466918 *: Use a struct prefix *p instead of a struct prefix in functions
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-04-06 18:00:09 -04:00
Donald Sharp 8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
Louis Scalbert bd0581e434 lib,isisd: add extended admin-group info into the ted
Add extended admin-group info into the ted.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-02-10 13:52:03 +01:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Olivier Dugeon 9bf9bd1a0b lib: Correct valgrind errors
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-08-01 17:32:56 +02:00
Donald Sharp aa5ced0ac8 isisd, lib, ospfd, pathd: Null out free'd pointer
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>
2022-03-31 15:59:46 -04:00
Olivier Dugeon 8693b4d66e lib: Update Link State functions to handle IPv6
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-11-30 15:22:28 +01:00
Olivier Dugeon f4157b4f6e lib: Fix comparison function in link_state.c
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-10-29 10:16:12 +02:00
Olivier Dugeon b0c0b43348 lib: Update Link State Database
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-23 15:39:29 +01:00
David Lamparter 960b9a5383 *: require semicolon after DEFINE_<typesafe...>
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
Olivier Dugeon bbd85e2038 lib: Add Link State Database
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>
2021-01-04 18:19:26 +01:00