Commit graph

80 commits

Author SHA1 Message Date
Mark Stapp e2515f7a4f tests: clean up variable-shadow warnings
Clean up -Wshadow warnings in unit-tests

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Ariel Otilibili 84d0ab9896 tests: clear -Wcalloc-transposed-args warnings
* order of arguments was swapped; not consistent with calloc signature
* therefore producing -Wcalloc-transposed-args during compilation.

Link: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Link: https://man7.org/linux/man-pages/man3/calloc.3p.html
Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
2025-01-06 15:47:55 +01:00
Donald Sharp 172a2aa533
Merge pull request #17156 from opensourcerouting/eradicate-strncpy
*: remove remaining `strncpy()` users
2024-11-19 09:42:39 -05:00
Donald Sharp 274c98628f
Merge pull request #17155 from opensourcerouting/memstats-zlog
lib: `debug memstats-at-exit` improvements
2024-10-24 21:07:09 -04:00
David Lamparter 84fd92c80e tests: remove strncpy() use
`checkpatch` has sufficiently annoyed me to fix this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 14:51:25 +02:00
David Lamparter b3e4007197 lib: refactor memstats logging, fix ACTIVEATEXIT
Move the various destinations handling into lib/memory.c, include
"normal" logging as target, and make `ACTIVEATEXIT` properly non-error
as it was intended to be.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-17 13:58:57 +02:00
Louis Scalbert 3c430cd4e0 tests: update fuzz after ipv4 mapped ipv6 print change
Update IS-IS fuzz test to match corrected output after change in the
display of IPv4 mapped IPv6 address.

The update was performed using wuschl [1] like this:

$ wuschl rebuild tests/isisd/test_fuzz_isis_tlv
$ gzip -9 tests/isisd/test_fuzz_isis_tlv_tests.h

[1] https://pypi.org/project/wuschl/

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-16 13:45:54 +02:00
Christian Hopps e8648a0c72 lib: add flag to have libyang load internal ietf-yang-library module
Mgmtd makes use of libyang's internal ietf-yang-library module to add
support for said module to FRR management. Previously, mgmtd was loading
this module explicitly; however, that required that libyang's
`ietf-yang-library.yang` module definition file be co-located with FRR's
yang files so that it (and ietf-datastore.yang) would be found when
searched for by libyang using FRRs search path. This isn't always the
case depending on how the user compiles and installs libyang so mgmtd
was failing to run in some cases.

Instead of doing it the above way we simply tell libyang to load it's
internal version of ietf-yang-library when we initialize the libyang
context.

This required adding a boolean to a couple of the init functions which
is why so many files are touched (although all the changes are minimal).

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-10-07 03:32:44 +00:00
Louis Scalbert cfd050a0e5 tests: update isisd fuzz test
Since the previous commit, if a router capability subTLV is not
readable, the previously read subTLVs are kept.

Update of the ISIS fuzz test.

> $ wuschl rebuild tests/isisd/test_fuzz_isis_tlv
> $ gzip -9 tests/isisd/test_fuzz_isis_tlv_tests.h

> $ ./test_fuzz_isis_tlv 2>/dev/null | grep failed
> Test 139 failed, output differs.
> Test 150 failed, output differs.
> 2 of 405 tests failed.
>
> $ ./test_fuzz_isis_tlv 139 2>/dev/null
> Test 139 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Received output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Router Capability: 253.212.128.242 , D:1, S:1
>
> $ ./test_fuzz_isis_tlv 150 2>/dev/null
> Test 150 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Received output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Router Capability: 253.212.128.242 , D:1, S:1

Link: https://pypi.org/project/wuschl/
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-09-16 14:53:03 +02:00
Donald Sharp b2654e35e5
Merge pull request #16232 from zhou-run/202406171755
isisd: Even after configuring "no hostname dynamic", the topology still displays the hostname.
2024-07-24 10:30:34 -04:00
Philippe Guibert 3a2554e4a2 isisd: add json support to display spf paths in 'show isis route'
The 'show isis route json' command never displays the list of
paths. Add the json support for this sub-part.

> # show isis route json
> [..]
> "ipv6-paths":[
>  {
>   "Vertex":"rt1",
>   "Type":"",
>   "Metric":0,
>   "Next-Hop":"",
>   "Interface":"",
>   "Parent":""
>  },
>  {
>    "Vertex":"2001:db8:1000::1\/128",
>    "Type":"IP6 internal",
>    "Metric":0,
>    "Next-Hop":"",
>    "Interface":"",
>    "Parent":"rt1(4)"
>  },

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-21 15:40:23 +02:00
Philippe Guibert df723ccfb7 isisd: show isis route uses ttable for paths
This is a preliminary commit, so that route paths are visible from json.

Before:
> IS-IS paths to level-1 routers that speak IPv6
> Vertex               Type         Metric Next-Hop             Interface Parent
> rt1
> 2001:db8:1000::1/128 IP6 internal 0                                     rt1(4)
> rt2                  TE-IS        10     rt2                  eth-rt2   rt1(4)
> rt3                  TE-IS        10     rt3                  eth-rt3   rt1(4)
> 2001:db8:1000::2/128 IP6 internal 20     rt2                  eth-rt2   rt2(4)
> 2001:db8:1000::3/128 IP6 internal 20     rt3                  eth-rt3   rt3(4)

After:
> Vertex                Type          Metric  Next-Hop  Interface  Parent
>  -------------------------------------------------------------------------
>  rt1
>  2001:db8:1000::1/128  IP6 internal  0                            rt1(4)
>  rt2                   TE-IS         10      rt2       eth-rt2    rt1(4)
>  rt3                   TE-IS         10      rt3       eth-rt3    rt1(4)
>  2001:db8:1000::2/128  IP6 internal  20      rt2       eth-rt2    rt2(4)
>  2001:db8:1000::3/128  IP6 internal  20      rt3       eth-rt3    rt3(4)

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-21 15:40:23 +02:00
zhou-run 0db469958c isisd: Even after configuring "no hostname dynamic", the topology still displays the hostname.
The command "show isis topology" calls print_sys_hostname() to display the system ID or hostname, but it does not check the area->dynhostname flag.

Signed-off-by: zhou-run <zhou.run@h3c.com>
2024-06-19 15:44:51 +08:00
Donatas Abraitis 07573cf98b Revert "isisd: When the metric-type is configured as "wide", the IS-IS generates incorrect metric values for IPv4 directly connected routes."
This broke these topotests:

test_isis_lsp_bits_topo1
test_isis_sr_topo1
test_isis_srv6_topo1
test_isis_tilfa_topo1
test_isis_topo1
test_isis_topo1_vrf
test_ldp_snmp_topo1
test_ldp_sync_isis_topo1

This reverts commit 39e27b840e.
2024-06-04 17:31:40 +03:00
zhou-run 39e27b840e isisd: When the metric-type is configured as "wide", the IS-IS generates incorrect metric values for IPv4 directly connected routes.
The IPv4 directly connected route prefix exists in both the root LSP and the root's neighbor LSP:

1. When generating vertices for directly connected route prefixes with a metric of 0 based on the root LSP, the isis_spf_preload_tent_ip_reach_cb function only generates vertices of type VTYPE_IPREACH_INTERNAL without distinguishing between area->oldmetric and area->newmetric.
2. When generating vertices for the directly connected route prefix based on the neighbor LSP, the isis_spf_process_lsp function will generate vertices of type VTYPE_IPREACH_INTERNAL and VTYPE_IPREACH_TE based on area->oldmetric and area->newmetric, where the vertex metric is the sum of the metric from the root IS to the neighbor IS and from the neighbor IS to the root IS, respectively.

If area->newmetric=1, the same directly connected route prefix will have both VTYPE_IPREACH_INTERNAL vertices with a metric of 0 and VTYPE_IPREACH_TE vertices with a non-zero metric. During route generation, the isis_spf_loop function will prioritize selecting VTYPE_IPREACH_TE vertices, leading to incorrect metrics for the directly connected routes.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

fix frrbot styling issues found.

1)fix frrbot styling issues found.
2)Roll back the modifications to TE.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

Maintain code factorization and avoid duplicating code.

Maintain code factorization and avoid duplicating code.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: fix frrbot styling issues found

fix frrbot styling issues found

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>

isisd: Resolve compilation issues.

Resolve compilation issues.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
2024-05-28 17:21:19 +08:00
Igor Ryzhov 3625360d88 lib: add support for "features" when loading YANG modules
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-28 23:28:40 +02:00
Donald Sharp 848dcf3d03 *: remove sys/stat.h from zebra.h
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-09 12:39:23 -05:00
Carmine Scarpitta 0078f6f53a tests: Update fuzz test to match expected output
Update IS-IS fuzz test to match corrected output after the introduction
of SRv6-related TLVs.

The update was performed using wuschl [1] like this:

$ wuschl rebuild tests/isisd/test_fuzz_isis_tlv
$ gzip -9 tests/isisd/test_fuzz_isis_tlv_tests.h

[1] https://pypi.org/project/wuschl/

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:52 +02:00
Eric Kinzie 42ac448538 isisd: add option to display isis routes as json
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>
2023-04-18 11:33:15 +02:00
Hiroki Shirokura 78774bbcd5 isisd: add isis flex-algo lsp advertisement
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>
2023-04-18 11:33:15 +02:00
Hiroki Shirokura 0de7b43308 isisd: update isis_tlvs_add_*_reach() with multi algorithm
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>
2023-04-18 10:11:52 +02:00
Hiroki Shirokura 329f87b310 isisd: update struct isis_spftree with algorithm id
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>
2023-04-17 11:06:08 +02:00
Donald Sharp 24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp ce50d11c4d *: Convert thread_master_XXX functions to event_master_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp de2754be3a *: Convert thread_fetch and thread_call to event_fetch and event_call
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04: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
David Lamparter d173381edc build: consistently mkdir -p output for redirect
When running the build in a separate build directory, redirecting output
into a file can error out if the directory does not exist yet.  Some
places already had `mkdir -p` calls, but not all.

Make all occurences of this consistently use `@$(MKDIR_P)`.

(Extension of PR #12575 to catch more places.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-24 17:46:57 +01:00
Louis Scalbert a90d4c45db isisd: fix metric calculation of classic lfa backup prefixes
The isis-lfa-topo1 topotest shows backup routes with lower metrics than
the primary ones.

> rt1# show isis route
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::1/128  0       -          -                          -
>  2001:db8:1000::2/128  20      eth-rt2    fe80::d091:eeff:fe09:31cd  -
>  2001:db8:1000::3/128  20      eth-rt3    fe80::946b:d4ff:fe5b:414b  -
>  2001:db8:1000::4/128  20      eth-rt4    fe80::5ced:29ff:feed:59c4  -
> (...)
>
> rt1# show isis route backup
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::2/128  15      eth-rt3    fe80::946b:d4ff:fe5b:414b  -
>                                eth-rt5    fe80::847d:feff:fe74:bdde  -
>                                eth-rt6    fe80::ac8c:dff:feac:8a8d   -
>  2001:db8:1000::3/128  15      eth-rt2    fe80::d091:eeff:fe09:31cd  -
>                                eth-rt5    fe80::847d:feff:fe74:bdde  -
>  2001:db8:1000::4/128  45      eth-rt5    fe80::847d:feff:fe74:bdde  -
> (...)

Backup routes metrics are incorrect because they only take into account
the path metric but not the prefix metric.

Add the prefix metric to the path metric on backup routes.

After the patch with a prefix metric of 10:

> rt1# show isis route backup
> Area 1:
> IS-IS L1 IPv6 routing table:
>
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::2/128  25      eth-rt3    fe80::8c6f:8aff:fe10:ad0d  -
>                                eth-rt5    fe80::b08e:5cff:fe90:62dd  -
>                                eth-rt6    fe80::4810:47ff:fe81:2b9a  -
>  2001:db8:1000::3/128  25      eth-rt2    fe80::e855:12ff:fe31:5765  -
>                                eth-rt5    fe80::b08e:5cff:fe90:62dd  -
>  2001:db8:1000::4/128  55      eth-rt5    fe80::b08e:5cff:fe90:62dd  -

Fixes: e886416f81 ("isisd: add support for classic LFA (RFC 5286)")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-10-24 14:56:42 +02:00
Donatas Abraitis fbf0fc22f0 Revert "isisd: fix metric calculation of classic lfa backup prefixes"
This reverts commit e45958e9cf.
2022-07-10 21:40:43 +03:00
Louis Scalbert e45958e9cf isisd: fix metric calculation of classic lfa backup prefixes
The isis-lfa-topo1 topotest shows backup routes with lower metrics than
the primary ones.

> rt1# show isis route
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::1/128  0       -          -                          -
>  2001:db8:1000::2/128  20      eth-rt2    fe80::d091:eeff:fe09:31cd  -
>  2001:db8:1000::3/128  20      eth-rt3    fe80::946b:d4ff:fe5b:414b  -
>  2001:db8:1000::4/128  20      eth-rt4    fe80::5ced:29ff:feed:59c4  -
> (...)
>
> rt1# show isis route backup
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::2/128  15      eth-rt3    fe80::946b:d4ff:fe5b:414b  -
>                                eth-rt5    fe80::847d:feff:fe74:bdde  -
>                                eth-rt6    fe80::ac8c:dff:feac:8a8d   -
>  2001:db8:1000::3/128  15      eth-rt2    fe80::d091:eeff:fe09:31cd  -
>                                eth-rt5    fe80::847d:feff:fe74:bdde  -
>  2001:db8:1000::4/128  45      eth-rt5    fe80::847d:feff:fe74:bdde  -
> (...)

Backup routes metrics are incorrect because they only take into account
the path metric but not the prefix metric.

Add the prefix metric to the path metric on backup routes.

After the patch with a prefix metric of 10:

> rt1# show isis route backup
> Area 1:
> IS-IS L1 IPv6 routing table:
>
> Area 1:
> IS-IS L1 IPv6 routing table:
>
>  Prefix                Metric  Interface  Nexthop                    Label(s)
>  ------------------------------------------------------------------------------
>  2001:db8:1000::2/128  25      eth-rt3    fe80::8c6f:8aff:fe10:ad0d  -
>                                eth-rt5    fe80::b08e:5cff:fe90:62dd  -
>                                eth-rt6    fe80::4810:47ff:fe81:2b9a  -
>  2001:db8:1000::3/128  25      eth-rt2    fe80::e855:12ff:fe31:5765  -
>                                eth-rt5    fe80::b08e:5cff:fe90:62dd  -
>  2001:db8:1000::4/128  55      eth-rt5    fe80::b08e:5cff:fe90:62dd  -

Fixes: e886416f81 ("isisd: add support for classic LFA (RFC 5286)")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-05-24 10:06:05 +02:00
Donald Sharp 2b669d3a21 *: Fix spelling of overriden
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-19 08:27:02 -04:00
Javier Garcia 432f143212 topotest: Add test for isis json cmds.
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
2022-03-02 16:21:29 +01:00
Juraj Vijtiuk 9ba865f54d isisd: fix router capability TLV parsing issues
isis_tlvs.c would fail at multiple places if incorrect TLVs were
received causing stream assertion violations.
This patch fixes the issues by adding missing length checks, missing
consumed length updates and handling malformed Segment Routing subTLVs.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>

Small adjustments by Igor Ryzhov:
- fix incorrect replacement of srgb by srlb on lines 3052 and 3054
- add length check for ISIS_SUBTLV_ALGORITHM
- fix conflict in fuzzing data during rebase

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2022-02-08 11:31:45 +03:00
Olivier Dugeon 173f8887cc isisd: Add support for RFC6119 (IPv6 TE in IS-IS)
- Add advertisement of Global IPv6 address in IIH pdu
 - Add new CLI to set IPv6 Router ID
 - Add advertisement of IPv6 Router ID
 - Correctly advertise IPv6 local and neighbor addresses in Extended IS and MT
   Reachability TLVs
 - Correct output of Neighbor IPv6 address in 'show isis database detail'
 - Manage IPv6 addresses advertisement and corresponiding Adjacency SID when
   IS-IS is not using Multi-Topology by introducing a new ISIS_MT_DISABLE
   value for mtid (== 4096 i.e. first reserved flag set to 1)

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-11-30 15:22:28 +01:00
David Lamparter e536bb107d build: break up tests/subdir.am
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-11 14:40:03 +01:00
Juraj Vijtiuk 17b0839b35 isisd: fix unpack_item_ext_subtlvs TLV parsing issues
isis_tlvs.c would fail at multiple places if incorrect
TLVs were received in unpack_item_ext_subtlvs(),
causing stream assertion violations.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
2021-10-27 17:04:26 +00:00
Guillaume Solignac 9482949688 isisd: Fix sending of LSP with null seqno
Check sequence number when building LSP missing in received CSNP

Signed-off-by: Guillaume Solignac <gsoligna@protonmail.com>
2021-08-26 12:06:29 +02:00
Igor Ryzhov 240f48b36b isisd: per-instance dynamic hostname cache
Currently, the dynamic hostname cache is global. It is incorrect because
neighbors in different VRFs may have the same system ID and different
hostnames.

This also fixes a memory leak - when the instance is deleted, the cache
must be cleaned up and the cleanup thread must be cancelled.

Fixes #8832.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-11 18:30:47 +03:00
Igor Ryzhov 5cfffcdd8d isisd: fix dangling instances
We only need an instance when we have at least one area configured in a
VRF. Currently we have the following issues:
- instance for the default VRF is always created
- instance is not removed after the last area config is removed

This commit fixes both issues.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-14 17:12:38 +03:00
Christian Hopps 3bb513c399 lib: adapt to version 2 of libyang
Compile with v2.0.0 tag of `libyang2` branch of:
https://github.com/CESNET/libyang

staticd init load time of 10k routes now 6s vs ly1 time of 150s

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-05-13 16:24:48 -04:00
Igor Ryzhov bcf2208156 isisd: allow arbitrary order of area/interface configuration
Currently we don't allow to configure the interface before the area is
configured. This approach has the following issues:

1. The area config can be deleted even when we have an interface config
   relying on it. The code is not ready for that - we'll have a whole
   bunch of stale pointers if user does that.
2. The code doesn't correctly process the event of changing the VRF for
   an interface. There is no mechanism to ensure that the area exists
   in the new VRF so currently the circuit still stays in the old VRF.

This commit allows an arbitrary order of area/interface configuration.
There is no more need to configure the area before configuring the
interface.

This change fixes both the issues.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-29 17:05:21 +03:00
Renato Westphal 784f92f052 isisd: handle corner case involving TI-LFA and the SR No-PHP flag
When the last SID in the TI-LFA repair list is an Adj-SID from the
penultimate hop router towards the final hop, the No-PHP flag of the
original Prefix-SID must be honored in the repair list itself since
the penultimate hop router won't have a chance to process that SID
and pop it if necessary.

Reported-by: Fredi Raspall <fredi@voltanet.io>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-02-26 15:54:01 -03:00
Renato Westphal c40de29448 tests: add remote LFA unit tests
Extend the existing SPF unit testing infrastructure so that it can
test RLFA as well.

These new unit tests are useful to test the RLFA PQ node
computation on several different network topologies in a timely
manner. Artificial LDP labels (starting from 50000) are used to
activate the computed RLFAs.

It's worth mentioning that the computed backup routing tables
contain both local LFAs and remote LFAs, as running RLFA separately
isn't possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-01-08 22:22:11 -03:00
Renato Westphal c8a4f33195 tests: add IS-IS classic LFA unit tests
These unit tests check the basic LFA loop-free condition on a
variety of different network topologies. None of the implemented
LFA tie-breakers are tested here.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-11-24 20:15:52 -03:00
Renato Westphal 4c75f7c773 isisd: fix the TI-LFA repair paths to preserve the original Prefix-SID
When computing backup nexthops for routes that contain a Prefix-SID,
the original Prefix-SID label should be present at the end of
backup label stacks (after the repair labels). This commit fixes
that oversight in the original TI-LFA code. The SPF unit tests and
TI-LFA topotes were also updated accordingly.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23 10:31:39 -03:00
Renato Westphal d47d6089e0 isisd: refactor handling of SR Prefix-SIDs
Embed Prefix-SID information inside SPF data structures so that
Prefix-SIDs can be installed together with their associated routes
at the end of the SPF algorithm. This is different from the current
implementation where Prefix-SIDs are parsed and processed separately,
which is vastly suboptimal.

Advantages of the new code:
* No need to parse the LSPDB an additional time to detect and process
  SR-related changes;
* Routes are installed with their Prefix-SID labels in the same ZAPI
  message. This can prevent packet dropping for a few milliseconds
  after each SPF run if there are BGP-labeled routes (e.g. L3VPN) that
  recurse on IGP labeled routes;
* Much easier to support Anycast-SIDs, as the SPF code will naturally
  figure out the best nexthops and use only them (that can't be done
  in any reasonable way if the Prefix-SID Sub-TVLs are processed
  separately);
* Less code to maintain and reduced memory footprint;

The "show isis segment-routing prefix-sids" command was removed as
it doesn't make sense anymore now that "show isis route" exists.
Prefix-SIDs are a property of routes, so what was done was to extend
the "show isis route" command with a new "prefix-sid" option that
changes the output table to show the Prefix-SID information associated
to each route.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-23 10:31:39 -03:00