Commit Graph

218 Commits

Author SHA1 Message Date
Donald Sharp
fa935aa7e8 isisd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:50 -04:00
Donatas Abraitis
d8bebc08aa Revert "isisd: apply fast-reroute on an adjacency failure"
This reverts commit 7125297323.
2022-07-10 21:41:25 +03:00
Louis Scalbert
7125297323 isisd: apply fast-reroute on an adjacency failure
When a adjacency falls down, the primary routes are not deleted on the
dataplane until the SPF is recomputed. Even the backup routes are
pre-installed on the dataplane, there is no fast-route optimization.

Reasons for an adjacency to come down are:
- BFD down
- Hello timer timeout
- User adjacency clear

Apply the backup route switchover for fast-reroute as soon an IS-IS
adjacency falls down before the first SPF re-computation. Pre-computed
backup routes are applied sooner.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2022-05-23 10:44:20 +02:00
Donatas Abraitis
6006b807b1 *: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
    Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:47 +03:00
Philippe Guibert
c7fd8c62d9 isisd: enable BFD messaging debug when isis bfd is used
In addition to turning on isis bfd debugging traces, the internal
bfd messaging debug is also enabled. Reversely, when isis bfd traces
are off, the internal messaging debug traces are off too.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-04-20 16:45:17 +02:00
Philippe Guibert
cdfb430e2f isisd: fix typo in show debugging
fix typo in show debugging.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-03-31 11:19:26 +02:00
Javier Garcia
a2cac12a63 isisd: Add json to show isis database command.
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
2022-03-02 16:20:44 +01:00
Javier Garcia
a21177f280 isisd: Add json to show isis neighbor command.
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
2022-03-01 17:57:21 +01:00
Javier Garcia
9fee4d4c60 isisd: Add json to show isis interface command.
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
2022-02-25 12:36:17 +01:00
Javier Garcia
471bb5da52 isisd. Add json to show summary command.
Signed-off-by: Javier Garcia <javier.martin.garcia@ibm.com>
2022-02-25 12:36:11 +01:00
Russ White
18ed776ca2
Merge pull request #9938 from Orange-OpenSource/isis_ls
isisd: Add Link State Traffic Engineering support
2022-01-18 10:12:08 -05:00
Igor Ryzhov
ac2cb9bf94 *: rework renaming the default VRF
Currently, it is possible to rename the default VRF either by passing
`-o` option to zebra or by creating a file in `/var/run/netns` and
binding it to `/proc/self/ns/net`.

In both cases, only zebra knows about the rename and other daemons learn
about it only after they connect to zebra. This is a problem, because
daemons may read their config before they connect to zebra. To handle
this rename after the config is read, we have some special code in every
single daemon, which is not very bad but not desirable in my opinion.
But things are getting worse when we need to handle this in northbound
layer as we have to manually rewrite the config nodes. This approach is
already hacky, but still works as every daemon handles its own NB
structures. But it is completely incompatible with the central
management daemon architecture we are aiming for, as mgmtd doesn't even
have a connection with zebra to learn from it. And it shouldn't have it,
because operational state changes should never affect configuration.

To solve the problem and simplify the code, I propose to expand the `-o`
option to all daemons. By using the startup option, we let daemons know
about the rename before they read their configs so we don't need any
special code to deal with it. There's an easy way to pass the option to
all daemons by using `frr_global_options` variable.

Unfortunately, the second way of renaming by creating a file in
`/var/run/netns` is incompatible with the new mgmtd architecture.
Theoretically, we could force daemons to read their configs only after
they connect to zebra, but it means adding even more code to handle a
very specific use-case. And anyway this won't work for mgmtd as it
doesn't have a connection with zebra. So I had to remove this option.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-21 22:09:29 +03:00
Olivier Dugeon
d9884a758c isisd: Prepare IS-IS for Link State support
In order to provide Link State Traffic Engineering features to IS-IS, this
patch adds some modifications to base IS-IS:

- Solve bug in lsp iterate function to avoid infinite loop in isis_lsp.c by
  adding condition to recurse call
- Add new trigger event to parse LSP in isis_lsp.c
- Add new TE debug flag to track Traffic Engineering events in isisd.[c,h]
- Correct small bug in isis_tlvs.c where delay and min/max delay are not
  correctly handle
- Handle Opaque LSA Traffic Engineering Zebra API in isis_zebra.[c,h]

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-11-30 15:22:28 +01:00
Igor Ryzhov
2f9a06f060 isisd: fix circuit is-type configuration
Currently, we have a lot of checks in CLI and NB layer to prevent
incompatible IS-types of circuits and areas. All these checks become
completely meaningless when the interface is moved between VRFs. If the
area IS-type is different in the new VRF, previously done checks mean
nothing and we still end up with incorrect circuit IS type. To actually
prevent incorrect IS type, all checks must be done in the processing
code.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-30 03:17:49 +03:00
Philippe Guibert
29263027ac isisd: make isis work with default vrf name different than 'default'
The problem is related to startup configuration, which is not operational
on default vrf name.

To reproduce the issue, run the two daemons:
zebra -o vrf0 &
isisd -f /tmp/isisd.conf

router isis 1
 lsp-gen-interval 2
 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00
 metric-style wide
 redistribute ipv4 connected level-2
 redistribute ipv6 connected level-2

The obtained show running-config looks like below:

router isis 1 vrf default
 lsp-gen-interval 2
 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00
 metric-style wide
 redistribute ipv4 connected level-2
 redistribute ipv6 connected level-2

The default vrf name is obtained by zebra daemon. While isis is not
connected to zebra, i.e. at startup, when loading a startup configuration,
the macro VRF_DEFAULT_NAME is used and returns 'default'.

But because zebra connected and forces to a new default vrf name, the
configuration is not seen as the default one, and further attempts to
configure the isis instance via 'router isis 1' will trigger creation
of an other instance.

To handle this situation, at vrf_enable() event, which is called for
each default vrf name change, the associated isis instance is updated
with th new vrf name. The same is done for NB yang path.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-10-27 16:54:19 +02:00
David Lamparter
8268be3d16
Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-arg
lib: remove unused argument from vrf_cmd_init
2021-08-27 10:39:45 +02:00
Igor Ryzhov
cfc369c43a lib: remove unused argument from vrf_cmd_init
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26 12:01:22 +03:00
Igor Ryzhov
07679ad98a *: explicitly print "exit" at the end of every node config
There is a possibility that the same line can be matched as a command in
some node and its parent node. In this case, when reading the config,
this line is always executed as a command of the child node.

For example, with the following config:
```
router ospf
 network 193.168.0.0/16 area 0
!
mpls ldp
 discovery hello interval 111
!
```
Line `mpls ldp` is processed as command `mpls ldp-sync` inside the
`router ospf` node. This leads to a complete loss of `mpls ldp` node
configuration.

To eliminate this issue and all possible similar issues, let's print an
explicit "exit" at the end of every node config.

This commit also changes indentation for a couple of existing exit
commands so that all existing commands are on the same level as their
corresponding node-entering commands.

Fixes #9206.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23 22:08:20 +03:00
Igor Ryzhov
a4777e465a isisd: fix processing of the attached bit
There are two problems with the current code for processing the attached
bit:
- we should process it when acting both a level-1-only and level-1-2
- we should add the default route when we don't have L2 adjacensies, not
  when we don't have other routers configured on the device

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-13 14:49:49 +03:00
Russ White
4cc0f752dd
Merge pull request #8905 from donaldsharp/isis_argv
Isis argv
2021-06-22 14:22:55 -04:00
Quentin Young
f4e7b6ba47
Merge pull request #8902 from idryzhov/isis-lsp-for-arg
isisd: fix uninitialized variable when searching for LSP
2021-06-22 18:22:44 +00:00
Donald Sharp
1d88e63a4e isisd: using argv as a string name is categorically wrong
We are passing around the system id using the variable name
of `argv`.  Let's name the variable correctly and pass it around
correctly named.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-22 13:03:00 -04:00
Donald Sharp
730649da0e isisd: already checked for NULL
in lsp_for_arg we have already checked for NULL and returned
if argv is null.  We do not need to check for it again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-22 12:36:16 -04:00
Igor Ryzhov
9ff7c74bdd isisd: fix uninitialized variable when searching for LSP
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-22 17:53:26 +03:00
Igor Ryzhov
f5eef2d5a8 lib: remove vrf-interface config when removing the VRF
If we have the following configuration:
```
vrf red
 smth
 exit-vrf
!
interface red vrf red
 smth
```
And we delete the VRF using "no vrf red" command, we end up with:
```
interface red
 smth
```
Interface config is preserved but moved to the default VRF.

This is not an expected behavior. We should remove the interface config
when the VRF is deleted.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-21 18:04:46 +03:00
Donald Sharp
21b0c655e1
Merge pull request #8843 from idryzhov/isis-dyn-hostname-cache
isisd: per-instance dynamic hostname cache
2021-06-18 08:20:25 -04:00
Igor Ryzhov
6eadfc2d41 isisd: fix adding a circuit to the wrong area
When creating a new area, we're adding all circuits in the same VRF to
this area. We should only add circuits configured with the same tag.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-18 03:27:29 +03: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
2582d02c55 isisd: fix missing VRF parameter
It was incorrectly removed in 1cbf96a.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-21 20:29:13 +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
Igor Ryzhov
8c6482db8c isisd: fix redistribution in vrf
When the redistribution is configured in non-default VRF, isisd should
redistribute routes from this VRF instead of default.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-14 17:12:35 +03:00
Igor Ryzhov
164ab8965e isisd: deregister vrf from zebra when vrf is disabled
Currently the VRF is deregistered only when it is re-enabled again.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-14 17:12:33 +03:00
Igor Ryzhov
13bf38300e isisd: rework BFD integration
Rewrite the BFD integration code to use the new library.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-07 12:03:57 +03:00
Fredi Raspall
098fc8a9cd isisd: fix show LFA debug in show debugging cmd
When enabling 'debug isis lfa', the option was correctly enabled
but not displayed by 'show debugging' command.

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-05-01 16:05:22 +02: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
David Lamparter
66b9a3816a isisd: kill isis_memory.h, use MTYPE_STATIC
Convert most DEFINE_MTYPE into the _STATIC variant, and move the
remaining non-static ones to appropriate places.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 18:27:58 +01:00
David Lamparter
96244aca23 *: require semicolon after DEFINE_QOBJ & co.
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:37 +01:00
lynne
1ee746d990 isisd: support for snmp
Add support for read only mib objects from RFC4444.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2021-03-02 10:06:31 -05:00
lynne
77d73edfcd isisd: When adjacencies go up and down add support to modify attached-bit
When adjacencies change state the attached-bits in LSPs in other areas
on the router may need to be modified.

 1. If a router no longer has a L2 adjacency to another area the
    attached-bit must no longer be sent in the LSP
 2. If a new L2 adjacency comes up in a different area then the
    attached-bit should be sent in the LSP

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-02-01 16:04:10 -05:00
lynne
f3abc412a5 isisd: Fix Attach-bit processing
The purpose of the Attach-bit is to accomplish inter-area routing.  In other
venders, the Attached-bit is automatically set when a router is configured
as a L1|L2 router and has two adjacencies.  When a L1 router receives a LSP
with the Attached-bit set it is supposed to create a default route pointing
toward the neighbor to provide a default path out of the L1 area.

ISIS implementation has been fixed to support the above definition:
Setting the Attach-bit is now the default behavior and we allow the user to
turn it off.

We will only set the Default Attach-bit when creating a L1 LSP, if we are
a L1|L2 router and have a L2 adjacency up.

When a L1 router receives a LSP with the Attach-bit set, we will create a
default route pointing to the L1|L2 router as the nexthop.

The default route will be removed if the LSP is received with the Attach-bit
cleared.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-01-20 09:24:35 -05:00
Renato Westphal
16fe8cffa1 isisd: implement Remote LFA
Remote LFA (RFC 7490) is an extension to the base LFA mechanism
that uses dynamically determined tunnels to extend the IP-FRR
protection coverage.

RLFA is similar to TI-LFA in that it computes a post-convergence
SPT (with the protected interface pruned from the network topology)
and the P/Q spaces based on that SPT. There are a few differences
however:
* RLFAs can push at most one label, so the P/Q spaces need to
  intersect otherwise the destination can't be protected (the
  protection coverage is topology dependent).
* isisd needs to interface with ldpd to obtain the labels it needs to
  create a tunnel to the PQ node. That interaction needs to be done
  asynchronously to prevent blocking the daemon for too long. With
  TI-LFA all required labels are already available in the LSPDB.

RLFA and TI-LFA have more similarities than differences though,
and thanks to that both features share a lot of code.

Limitations:
* Only RLFA link protection is implemented. The algorithm used
  to find node-protecting RLFAs (RFC 8102) is too CPU intensive and
  doesn't always work. Most vendors implement RLFA link protection
  only.
* RFC 7490 says it should be a local matter whether the repair path
  selection policy favors LFA repairs over RLFA repairs. It might be
  desirable, for instance, to prefer RLFAs that satisfy the downstream
  condition over LFAs that don't. In this implementation, however,
  RLFAs are only computed for destinations that can't be protected
  by local LFAs.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-01-08 22:22:11 -03:00
Renato Westphal
e886416f81 isisd: add support for classic LFA (RFC 5286)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-11-24 20:15:52 -03:00
Renato Westphal
2866b11911 isisd: rename the "debug isis ti-lfa" command to make it more generic
Rename "debug isis ti-lfa" to "debug isis lfa". Having different
debug guards for different kinds of LFA (classic, remote and TI-LFA)
doesn't make sense since all LFA solutions share code to certain
extent.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-11-24 20:15:51 -03:00
Donald Sharp
d53e72e594 isisd: Free created tables
On redistribution into isis we were creating a table for
handling the redistributed routes, but never cleaning them
up on shutdown properly.  Do so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-14 18:20:21 -05:00
Donald Sharp
8f15843bba isisd: On shutdown leaking spf_timer thread data
When isis is being shutdown the area->spf_timer thread has
special data assigned to that was never being freed.
Free this data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-14 18:17:27 -05:00
Renato Westphal
8bc3b727ba
Merge pull request #7379 from donaldsharp/isis_mem_leak
isisd: Fix memory leak on shutdown
2020-10-24 15:28:18 -03:00
Mark Stapp
5047884528 *: unify thread/event cancel macros
Replace all lib/thread cancel macros, use thread_cancel()
everywhere. Only the THREAD_OFF macro and thread_cancel() api are
supported. Also adjust thread_cancel_async() to NULL caller's pointer (if
present).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23 12:16:52 -04:00
Donald Sharp
e76731cf04 isisd: Fix memory leak on shutdown
==935465== 40 bytes in 1 blocks are definitely lost in loss record 71 of 546
==935465==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==935465==    by 0x48D6611: qcalloc (memory.c:110)
==935465==    by 0x48CFE02: list_new (linklist.c:32)
==935465==    by 0x15DBF0: isis_new (isisd.c:213)
==935465==    by 0x15DAC4: isis_global_instance_create (isisd.c:179)
==935465==    by 0x121892: main (isis_main.c:264)
==935465== 64 (40 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 101 of 546
==935465==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==935465==    by 0x48D6611: qcalloc (memory.c:110)
==935465==    by 0x48CFE02: list_new (linklist.c:32)
==935465==    by 0x15DBE3: isis_new (isisd.c:212)
==935465==    by 0x15DAC4: isis_global_instance_create (isisd.c:179)
==935465==    by 0x121892: main (isis_main.c:264)

On isis shutdown we are seeing the above memory leaks.  Modify
the code to start cleaning this up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-23 11:36:38 -04:00
Renato Westphal
c951ee6eee isisd: add support for Topology Independent LFA (TI-LFA)
TI-LFA is a modern fast-reroute (FRR) solution that leverages Segment
Routing to pre-compute backup nexthops for all destinations in the
network, helping to reduce traffic restoration times whenever a
failure occurs. The backup nexthops are expected to be installed
in the FIB so that they can be activated as soon as a failure
is detected, making sub-50ms recovery possible (assuming an
hierarchical FIB).

TI-LFA is a huge step forward compared to prior IP-FRR solutions,
like classic LFA and Remote LFA, as it guarantees 100% coverage
for all destinations. This is possible thanks to the source routing
capabilities of SR, which allows the backup nexthops to steer traffic
around the failures (using as many SIDs as necessary). In addition
to that, the repair paths always follow the post-convergence SPF
tree, which prevents transient congestions and suboptimal routing
from happening.

Deploying TI-LFA is very simple as it only requires a single
configuration command for each interface that needs to be protected
(both link protection and node protection are available). In addition
to IPv4 and IPv6 routes, SR Prefix-SIDs and Adj-SIDs are also
protected by the backup nexthops computed by the TI-LFA algorithms.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-10-14 16:27:37 -03:00
Igor Ryzhov
2b55d9532b isisd: fix node for clear commands
These are only clear commands in FRR available from view node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-01 17:11:35 +03:00