summaryrefslogtreecommitdiffstats
path: root/isisd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* isisd: fix wrongly disabled flex-algoLouis Scalbert2023-06-011-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A configured flex-algo algorithm may remain in disabled state after its definition is advertised on the area. It happens sometimes that, in isis_sr_flex_algo_topo1 topotest step 4 or 8, flex-algo 203 is disabled. It depends on the following sequence: 1. Flex-algo 203 is configured on a remote router to be re-advertised. 2. A LSP is received on the local router and contains the algo 203 definition. 3. The local router re-builds its own LSP with lsp_build(). 4. local router isis_run_spf() recomputes the algo 203 SPF tree. A 1. 2. 3. 4. sequence results in a working test. The reception of the remote LSP (2.) does not trigger the built of the local LSP. If for some reasons, the sequence is 1. 3. 4. 2. 4., isis_run_spf() will not knows that flex-algo 203 has been re-enabled because flex_algo_get_state() only returns the state from the local LSP. Compare in sequence step 4. the flex-algo state from the local LSP with the actual state. If the state is not the same, request a new local LSP generation and quits the re-computation of algo SPF tree. The SPF tree will be recomputed just after the built of the local LSP. Fixes: 3f55b8c621 ("isisd: fix disabled flex-algo on race condition") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* Merge pull request #13376 from louis-6wind/fix-flex-algo-mem-leakRuss White2023-05-023-3/+8
|\ | | | | isisd, lib: fix flex-algo memory leak
| * isisd: fix a memory leak in isis_spftree_clear()Louis Scalbert2023-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isis_spftree_clear() calls: - _isis_spftree_del() to partially delete a spftree instance without freeing spftree->route_table and spftree->route_table_backup. - then _isis_spftree_init() that allocates new spftree->route_table and spftree->route_table_backup. As a consequence, the previous table instances are not referenced and not freed. Free the route tables before allocating new ones. Fixes: 860b75b40e ("isisd: calculate flex-algo constraint spf") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd, lib: clarify sizeof on flex-algo memory allocationLouis Scalbert2023-04-271-1/+1
| | | | | | | | | | | | Use the struct instead of the pointer for flex-algo memory allocation. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd: fix flex-algo data memory leak at algorithm removalLouis Scalbert2023-04-271-0/+1
| | | | | | | | | | | | | | Fix a flex-algo data memory leak when a specific algorithm is removed. Fixes: 7f198e063c ("isisd: add isis flex-algo base interface") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd, lib: fix flex-algo database memory leak at area destructionLouis Scalbert2023-04-271-0/+4
| | | | | | | | | | | | | | | | Free flex-algorithm database memory when an IS-IS area is destroyed. Fixes: 735fb37db1 ("lib: add library for igp flexible-algorithm") Fixes: 7f198e063c ("isisd: add isis flex-algo base interface") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: fix disabled flex-algo on race conditionLouis Scalbert2023-04-282-3/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | A particular flex-algo algorithm may remain in disabled state after configuring it if its flex-algo definition is being spread in the area. It happens sometimes that, in isis_sr_flex_algo_topo1 topotest, r3 flex-algo 203 is disabled on test8. It depends on the following sequence on r3: 1. a LSP containing the flex-algo 203 definition is received from either r1 or r2 (or both). 2. the local LSP is rebuilt by lsp_build() because of the flex-algo 203 configuration 3. isis_run_spf() recomputes the algo 203 SPF tree A 1. 2. 3. sequence results in a working test whereas 2. 1. 3. is not working. The second case issue is because of an inconsistent flex-algo definition state between the following: - in lsp_build(), isis_flex_algo_elected_supported_local_fad() returns false because no flex-algo definition is known. - in isis_run_spf(), isis_flex_algo_elected_supported() returns true because a flex-algo definition is found. Set a flex-algo state lsp_build() depending on flex-algo definition existence that is used later in isis_run_spf(). Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* Merge pull request #13334 from louis-6wind/flexalgo-fixesOlivier Dugeon2023-04-214-13/+16
|\ | | | | isisd: fixes for Flex-Algo
| * isisd: fix add an algorithm argument to show isis routeLouis Scalbert2023-04-201-3/+6
| | | | | | | | | | | | | | | | | | | | "show isis route algorithm ALGO json" display some text output before printing the JSON one. Do not print the text output in JSON mode. Fixes: 0833c25180 ("isisd: add an algorithm argument to show isis route") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd: fix potential null pointer in isis_affinity_map_update()Louis Scalbert2023-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | Reported by coverity scanner #1560315 Do not attempt to update the affinity map if the main isis struct is not yet created. Fixes: 9a65cf35da ("isisd: add affinity-map configuration hooks") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd: fix wrong pointer test in area_resign_level()Louis Scalbert2023-04-201-1/+1
| | | | | | | | | | | | | | Fix a wrong pointer test issue reported by coverity scanner #1560314 Fixes: 860b75b40e ("isisd: calculate flex-algo constraint spf") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd: fix potential null pointer in isis_affinity_map_check_use()Louis Scalbert2023-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | Reported by coverity scanner #1560313 Do not consider the affinity map is in use if the main isis struct is not yet created. Fixes: 9a65cf35da ("isisd: add affinity-map configuration hooks") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
| * isisd: fix overrun in isis_flex_algo_constraint_drop()Louis Scalbert2023-04-201-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | Coverity scanner reported the overrun issue #1560312 because reach->id length is 7 bytes and we are trying to copy 8 bytes (ie. ISIS_SYS_ID_LEN + 2). Fix the issue by using the %pPN to display directly the 7 bytes system-id. Fixes: 860b75b40e ("isisd: calculate flex-algo constraint spf") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | Merge pull request #12933 from Orange-OpenSource/link_statePhilippe Guibert2023-04-201-27/+43
|\ \ | |/ |/| lib: Update edge key in link state database
| * isisd: Update TE to new Link State Edge keyOlivier Dugeon2023-04-071-27/+43
| | | | | | | | | | | | | | | | Following the modification of the edge key in link state database this patch updates the isis_te.c file to replace the old uint64_t edge key by the new ls_edge_key structure. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* | isisd: add "show isis flex-algo" commandLouis Scalbert2023-04-181-0/+187
| | | | | | | | | | | | | | Add the show isis flex-algo command to display the elected Flex-Algo definitions and states (enabled/disabled). Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add algorithm argument to show isis segment-routing nodeLouis Scalbert2023-04-181-9/+36
| | | | | | | | | | | | Add algorithm argument to show isis segment-routing node Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add an algorithm argument to show isis routeLouis Scalbert2023-04-181-22/+93
| | | | | | | | | | | | | | Add an optional algorithm argument to "show isis route" command. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add an algorithm argument to show isis topologyLouis Scalbert2023-04-181-25/+77
| | | | | | | | | | | | | | Add an optional algorithm argument to "show isis topology" command. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add flex-algo info to spf extreme debugLouis Scalbert2023-04-181-24/+41
| | | | | | | | | | | | | | Add flex-algo information ID to the SPF extreme debug mode. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add option to display isis routes as jsonEric Kinzie2023-04-182-21/+100
| | | | | | | | | | | | | | | | Append an optional parameter to "show isis route [prefix-sid]" that formats the output as a JSON array. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: show non-zero algos in "show isis route prefix-sid" (2/2)Eric Kinzie2023-04-181-34/+52
| | | | | | | | | | | | | | Show Prefix-SIDs and labels for all available Flex-Algos. Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: show non-zero algos in "show isis route prefix-sid" (1/2)Louis Scalbert2023-04-181-76/+76
| | | | | | | | | | | | | | Change the indentation to facilitate the reading of next commit. No change on code. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: clarify ifdef fabricdLouis Scalbert2023-04-181-2/+3
| | | | | | | | | | | | clarify ifdef fabricd Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: fix typo in indef fabricd commentLouis Scalbert2023-04-181-1/+1
| | | | | | | | | | | | | | fix typo in indef fabricd comment Fixes: 20bd27e2aa ("isisd, yang: add configuration model and callback stubs") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add affinity-map configuration hooksLouis Scalbert2023-04-184-1/+122
| | | | | | | | | | | | | | | | Add affinity-map hooks to check the utilization of affinity-map in flex-algo contexts before its deletion and to update local TLVs when the affinity-map bit-position is updated. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add support of (ti-)lfa to flex-algoLouis Scalbert2023-04-181-13/+18
| | | | | | | | | | | | Add support of (ti-)lfa to flex-algo Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: fix merging flex-algo route nodesEric Kinzie2023-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As isis_route_verify_merge() builds a new route table, each (src,dst) new node in the table is created by merging data from the same (src,dst) pair present in all route tables. However, as it iterates over those route nodes and copies SR data into the newly created node, it repeatedly overwrites the isis_route_info pointer. This, in turn, pollutes the isis_route_info structures in all of the other tables with partially updated SR data. After a route is deleted, this leaves pointers to freed memory in one of the route trees. Fixes: 26b0598f6b6f ("isisd: fix isis_route_merge_verify logic") Signed-off-by: Eric Kinzie <ekinzie@labn.net>
* | isisd: merge algorithm tablesHiroki Shirokura2023-04-185-27/+61
| | | | | | | | | | | | | | | | | | Create a temporary "merge" route table that contains the routing information from all algorithms and install the merge route table into the FIB. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: calculate flex-algo constraint spfHiroki Shirokura2023-04-185-22/+290
| | | | | | | | | | | | | | | | Take into account the flex-algo affinity constraints to compute the SPF tree. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add isis flex-algo lsp advertisementHiroki Shirokura2023-04-183-58/+513
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deal with the packing and unpacking of following Flex-Algo Sub-Sub-TLVs: - Router Capability (already defined TLV 242) - List of the Flex-Algo Definitions (Sub-TLV 26) - Exclude admin group (Sub-Sub-TLV 1) - Include-any admin group (Sub-Sub-TLV 2) - Include-all admin group (Sub-Sub-TLV 3) - Flags (for prefix-metric) (Sub-Sub-TLV 4) This commit splits data into multiple router capability TLVs if needed because a TLV cannot contains more than 255 bytes. Note that the list of SR Algorithm (Sub-TLV 19) within Router Capability (TLV 242) is already set in a previous commit. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add ASLA supportLouis Scalbert2023-04-183-1/+744
| | | | | | | | | | | | | | | | | | | | | | | | Add the support of ASLA with the following TLV: - Extended IS Reachability (already defined TLV 22) - Application-Specific Link Attributes (Sub-TLV 16) (to enable the Flex-Algo flag on a link) - Admin-group (Sub-Sub-TLV 3) - Extended Admin-group (Sub-Sub-TLV 14) Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add isis flex-algo configuration frontendHiroki Shirokura2023-04-181-9/+190
| | | | | | | | | | | | | | | | Add the frontend functions for the flex-algo configuration. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add isis flex-algo configuration backendHiroki Shirokura2023-04-182-18/+532
| | | | | | | | | | | | | | | | Add the backend functions for the flex-algo configuration. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add isis flex-algo base interfaceHiroki Shirokura2023-04-186-0/+320
| | | | | | | | | | | | | | | | | | Adds basic functionality to Flex-Algo for IS-IS wrapping lib/flex_algo. The configuration interface will be added in the next commit. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | lib,vtysh,isisd,yang: algo cli/yang/callbacksHiroki Shirokura2023-04-185-0/+486
| | | | | | | | | | | | | | | | | | | | Define the IS-IS flex-algo structure in yang, the CLI configuration commands and the skeletons of frontend and backend functions that are called by the CLI code. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add cli to configure algorithm-prefix-sidHiroki Shirokura2023-04-181-0/+82
| | | | | | | | | | | | | | | | | | | | Add the ability to configure a Segment-Routing prefix SID for a given algorithm. For example: > segment-routing prefix 10.10.10.10/32 algorithm 128 index 100 Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd,yang: add algorithm-prefix-sid configuration treeHiroki Shirokura2023-04-184-0/+299
| | | | | | | | | | | | | | | | | | | | Add the ability to configure a Segment-Routing prefix SID for a given algorithm. For example: > segment-routing prefix 10.10.10.10/32 algorithm 128 index 100 Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: add TLV_SIZE_MISMATCH for tlvs length mismatchHiroki Shirokura2023-04-181-54/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically in frrouting source code principle, the log string should not be a complicated abstraction or streamlined for grep. But for log format for the "TLV size does not match ..." can be unified, which makes development easier. > $ grep "TLV size does not match expected size for" isisd/isis_tlvs.c > "TLV size does not match expected size for Administrative Group!\n"); > "TLV size does not match expected size for Local IPv6 address!\n"); > ...(snip)... > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > > $ grep "TLV size does not match expected size for" isisd/isis_tlvs.c | wc -l > 25 Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: refactor enum tail commaHiroki Shirokura2023-04-181-4/+4
| | | | | | | | | | | | | | | | | | | | Many of the enum definitions defined in isis_tlvs.h are often extended at the end. The c/c++ allows commas at the end of a list. This commit simplifies the patching of later extensions. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update struct isis_route_info has multiple sr info by algorithmHiroki Shirokura2023-04-183-36/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, there was only one sr psid info included in route_info. In fact, in RFC8667, Algorithm ID, which is a property of Prefix-SID, has 8 bits of information. That is, each Prefix can hold up to 256 Prefix-SIDs. This commit implements it. The previously implemented single Prefix-SID will be continued as Algorithm 0. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update struct isis_sr_psid_info with nh contextHiroki Shirokura2023-04-184-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefix-SID nexthops and backup nexthops are stored respectively in isis_route_info->nexthops and isis_route_info->backup->nexthops. With Flex-Algo, there are multiple Prefix-SIDs for a single prefix in different algorithms. Each of these Prefix-SIDs performs SPF calculation with a separate contract and sets a nexthops, so it is necessary to store a different set nexthops for each Prefix-SID. Add a nexthops and backup nethops list into the Prefix-SID isis_sr_psid_info struct and use these lists instead of the when needed After this commit, the nexthops for each Prefix-SID is not taken from route_info, but the nexthop set inside the Prefix-SID is taken. This works for backup nexthops as well. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: refactor IP reachability lsp buildLouis Scalbert2023-04-181-53/+53
| | | | | | | | | | | | | | | | | | | | Refactor IP reachability lsp build to comply with checkpatch: > WARNING: Too many leading tabs - consider code refactoring No code logic change. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update isis_tlvs_add_*_reach() with multi algorithmHiroki Shirokura2023-04-183-32/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isis_tlvs_add_extended_ip_reach adds IS-IS Extended IP reachability to the LSP. In this case, if the pcfg argument is not NULL, you can add IGP Prefix-SID as its sub tlv. Before this commit, only one Prefix-SID can be added. After this commit, the argument is not a single pointer but an array of pointers, and multiple Prefix-SIDs can be added. This feature is necessary because Flex-Algo requires multiple Prefix-SIDs for each Algorithm. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update SR_ALGORITHM_COUNT to 256Hiroki Shirokura2023-04-184-22/+47
| | | | | | | | | | | | | | | | | | | | Before this commit, SR_ALGORITHM_COUNT was set to 2, and each was hardcoded with router capability tlv. When Flex-Algo is supported, SR-Algorithm may be variably supported up to 256. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | lib,isisd: refactor igp-agnostic sr misc functionsHiroki Shirokura2023-04-183-22/+8
| | | | | | | | | | | | | | | | | | | | 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>
* | isisd: update struct isis_sr_psid_info with algorithm idHiroki Shirokura2023-04-174-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | The information in prefix-sid has a new property called algorithm id. This is used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo.In all other cases, the algorithm id is basically 0. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Eric Kinzie <ekinzie@labn.net> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update struct sr_prefix_cfg with algorithm idHiroki Shirokura2023-04-174-13/+36
| | | | | | | | | | | | | | | | | | | | | | The information in prefix-sid has a new property called algorithm id. This is used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo.In all other cases, the algorithm id is basically 0. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | isisd: update struct isis_spftree with algorithm idHiroki Shirokura2023-04-175-26/+30
| | | | | | | | | | | | | | | | | | | | | | The spftree has a new property called algorithm which is id used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo. In other cases than Flex-Algo, the algorithm id is always zero. Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
* | Merge pull request #13163 from isabelladeleon12/isis_log_dropsRuss White2023-04-119-17/+123
|\ \ | | | | | | isisd: Add support for log-pdu-drops