]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
3 years agoMerge pull request #8996 from FRRouting/mergify/bp/dev/8.0/pr-7674
Martin Winter [Thu, 8 Jul 2021 01:35:16 +0000 (03:35 +0200)]
Merge pull request #8996 from FRRouting/mergify/bp/dev/8.0/pr-7674

Convert the packaging to use git-buildpackage (backport #7674)

3 years agodebian: Merge the official Debian changelog into d/changelog
Ondřej Surý [Mon, 17 May 2021 18:20:33 +0000 (20:20 +0200)]
debian: Merge the official Debian changelog into d/changelog

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 4ebb9e9d2019e0c250cf606377b399db3498074c)

3 years agotools: Simplify the script to build Debian binary package
Igor Ryzhov [Mon, 17 May 2021 18:18:01 +0000 (20:18 +0200)]
tools: Simplify the script to build Debian binary package

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit c54e2a8144074f36f185f6a21fe57896488c3bf5)

3 years agodebian: Update the upstream version to 7.7~dev-1
Ondřej Surý [Tue, 4 May 2021 20:53:33 +0000 (22:53 +0200)]
debian: Update the upstream version to 7.7~dev-1

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 1b3fe7ab548b990f31d96c50f52f380f56df4af8)

3 years agodoc: Use dpkg-buildpackage to build packages (add note about debuild)
Ondřej Surý [Mon, 15 Feb 2021 07:43:26 +0000 (08:43 +0100)]
doc: Use dpkg-buildpackage to build packages (add note about debuild)

The debuild command fails when we are doing source package only build
because it expects the arch-dependent .changes file to be present.  Thus
in the instructions we switch to using dpkg-buildpackage directly and
add a note about using debuild in more complicated scenarios.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit c4783c325a03545255b9da5deca7b5a9f05772a3)

3 years agodoc: Add instructions on how to build only source packages
Ondřej Surý [Mon, 15 Feb 2021 07:40:08 +0000 (08:40 +0100)]
doc: Add instructions on how to build only source packages

In the CI, it's better to build the source package only once and then
instead of checking out the whole repository, only distribute the source
packages to the individual jobs.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 4c65fb08f7a6b3bfafdadc6cd8b6dc0e95e13649)

3 years agodoc: Update debian packaging instructions
Ondřej Surý [Thu, 11 Feb 2021 20:27:49 +0000 (21:27 +0100)]
doc: Update debian packaging instructions

The debian packaging instructions have been updated, so they actually
work.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit f36c3644e7808408433ce90691a6c106008c5315)

3 years agodebian: Add support for Debian bullseye to the packaging script
Ondřej Surý [Thu, 11 Feb 2021 19:53:43 +0000 (20:53 +0100)]
debian: Add support for Debian bullseye to the packaging script

The Debian bullseye is frozen now, so this adds support to this
Debian release to the packaging script.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit dfbc6c046e54ca0f955ae2afeca47b8f6fd5b1fd)

3 years agodebian: Fix the debian packaging script to build on non-default branch
Ondřej Surý [Thu, 11 Feb 2021 19:44:09 +0000 (20:44 +0100)]
debian: Fix the debian packaging script to build on non-default branch

The packaging script would fail to run on non-master branch, fix that
by pulling original branch name.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 9ea548cf3c81452f46cd0f52ff678db242e8d971)

3 years agodebian: Make the autopkgtest more resilient (Closes: #980111)
Ondřej Surý [Sun, 7 Feb 2021 11:52:35 +0000 (12:52 +0100)]
debian: Make the autopkgtest more resilient (Closes: #980111)

The Debian autopkgtest would fail with new PAM introduced in Debian bullseye.
Add a little loop to wait a little longer for the changes to propagate.

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 33ce95cad08d40aca84e254a26547aac5054e232)

3 years agodebian: Update the tools/build-debian-package.sh to be example build script
Ondřej Surý [Sun, 27 Sep 2020 11:17:57 +0000 (13:17 +0200)]
debian: Update the tools/build-debian-package.sh to be example build script

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 223766ead45908e3950b1a7cc85ea2acae7054a0)

3 years agodebian: Remove now obsolete tarsource.sh script
Ondřej Surý [Sun, 27 Sep 2020 10:18:21 +0000 (12:18 +0200)]
debian: Remove now obsolete tarsource.sh script

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit aa1e17f5ca7d47107f74dd8c6815b52c714957a9)

3 years agodebian: Remove the changelog-auto automation in favor of dch
Ondřej Surý [Sun, 27 Sep 2020 09:46:31 +0000 (11:46 +0200)]
debian: Remove the changelog-auto automation in favor of dch

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 06417e9f1803949a620cb37ce79054ddaa804387)

3 years agodebian: Update tools/build-debian-package.sh to use git-buildpackage
Ondřej Surý [Sun, 27 Sep 2020 09:08:13 +0000 (11:08 +0200)]
debian: Update tools/build-debian-package.sh to use git-buildpackage

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit bcd053ee8d75968f03f77c7975c0bbc85de3a4e1)

3 years agodebian: Adjust tarsource.sh to use native debian/changelog
Ondřej Surý [Sat, 26 Sep 2020 16:53:34 +0000 (18:53 +0200)]
debian: Adjust tarsource.sh to use native debian/changelog

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit 25785834afb2dde5e1f6608bc4a1de53b9f4bc4b)

3 years agodebian: Merge various debian changelogs in debian/changelog
Ondřej Surý [Sat, 26 Sep 2020 16:33:06 +0000 (18:33 +0200)]
debian: Merge various debian changelogs in debian/changelog

Signed-off-by: Ondřej Surý <ondrej@sury.org>
(cherry picked from commit b7abcded1a9e08da6e2e7a231d0cffec479c9b69)

3 years agoMerge pull request #8933 from FRRouting/mergify/bp/dev/8.0/pr-8925
Donald Sharp [Tue, 29 Jun 2021 19:49:11 +0000 (15:49 -0400)]
Merge pull request #8933 from FRRouting/mergify/bp/dev/8.0/pr-8925

ospf6d: fix duplicated packet read (backport #8925)

3 years agoMerge pull request #8934 from FRRouting/mergify/bp/dev/8.0/pr-8904
Donald Sharp [Tue, 29 Jun 2021 19:48:55 +0000 (15:48 -0400)]
Merge pull request #8934 from FRRouting/mergify/bp/dev/8.0/pr-8904

ospf6d: Show neighbor displays twice for every neighbor. (backport #8904)

3 years agoospf6d: Show neighbor displays twice for every neighbor.
Abhinay Ramesh [Tue, 22 Jun 2021 16:41:25 +0000 (16:41 +0000)]
ospf6d: Show neighbor displays twice for every neighbor.

Problem Statement:
=================
When show ipv6 ospf6 neighbor is executed each neighbor gets
displayed twice.

frr# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:39     Full/DR              00:00:10 ens192[BDR]
1.1.1.1           1    00:00:39     Full/DR              00:00:10 ens192[BDR]

RCA:
====
Since ospf6_interface gets added twice to if_list we see multiple
display output.

Fix:
====
add ospf6_interface to if_list only when newly area gets attached
to the interface. If its already added no need to add it again.

Risk:
=====
Low

Tests Executed:
===============
Have tested the defect scenario.

frr# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
1.1.1.1           1    00:00:35     Full/DR              00:36:04 ens192[BDR]
frr#

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
(cherry picked from commit 40699728315d3c7a79059e55a7921308c80eb23d)

3 years agoospf6d: fix duplicated packet read
Igor Ryzhov [Fri, 25 Jun 2021 11:59:28 +0000 (14:59 +0300)]
ospf6d: fix duplicated packet read

When OSPFv3 router is configured in both default and non-default VRFs,
every packet destined to a non-default VRF is read twice. This makes it
impossible to establish neighborship because every DbDesc packet is
treated as duplicated and we end up infinitely exchanging DbDescs.

We should drop packets received in the default VRF if an interface we
received it on is bound to another VRF.

Same thing was done for OSPFv2 in 555691e.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 709bd204214c9d31592e4c2ccbb78b6b3f79a99b)

3 years agoMerge pull request #8929 from FRRouting/mergify/bp/dev/8.0/pr-8907
Donald Sharp [Mon, 28 Jun 2021 11:43:51 +0000 (07:43 -0400)]
Merge pull request #8929 from FRRouting/mergify/bp/dev/8.0/pr-8907

Fix ISIS config batching (backport #8907)

3 years agoisisd: fix interface ldp-sync configuration
Igor Ryzhov [Tue, 22 Jun 2021 21:27:55 +0000 (00:27 +0300)]
isisd: fix interface ldp-sync configuration

There are two checks done when configuring ldp-sync on an interface:
- interface is not a loopback
- interface is in the default VRF
Both checks are incorrectly done using the operational data.

The second check can be done using only config data - do that.

The first check can't be done using only configurational data, but it's
not necessary. LDP sync code doesn't operate on loopback interfaces
already. There's no harm in allowing this to be configured.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit e432649280b47b55723ca3ce6b39bacc039b6e18)

3 years agoisisd: fix instance ldp-sync configuration
Igor Ryzhov [Tue, 22 Jun 2021 21:23:18 +0000 (00:23 +0300)]
isisd: fix instance ldp-sync configuration

Don't rely on operational data to validate that configuration is applied
to the default VRF. The VRF name is stored in the config - use it instead.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 80ab95b134b00a115175adc46b82a3f69f58ec87)

3 years agoisisd: fix NET NB configuration
Igor Ryzhov [Tue, 22 Jun 2021 21:21:24 +0000 (00:21 +0300)]
isisd: fix NET NB configuration

Don't rely on operational data to check for system ID consistency. This
is purely configurational data thing.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 0a156eecf2d4db42e3f21b35fbc09e2516898c53)

3 years agoMerge pull request #8882 from idryzhov/8.0-backports-06-18
Donald Sharp [Sat, 19 Jun 2021 19:46:33 +0000 (15:46 -0400)]
Merge pull request #8882 from idryzhov/8.0-backports-06-18

8.0 backports

3 years agoMerge pull request #8879 from FRRouting/mergify/bp/dev/8.0/pr-8876
Donald Sharp [Sat, 19 Jun 2021 19:45:52 +0000 (15:45 -0400)]
Merge pull request #8879 from FRRouting/mergify/bp/dev/8.0/pr-8876

lib: remove pure attribute from functions that modify memory (backport #8876)

3 years agolib: remove pure attribute from functions that modify memory
Igor Ryzhov [Fri, 18 Jun 2021 10:06:13 +0000 (13:06 +0300)]
lib: remove pure attribute from functions that modify memory

Almost all functions currently marked with pure attribute acquire a
route_node lock. By marking them pure we allow compiler to optimize the
code and not call them when it already knows the return value. This is
completely incorrect.

Only two of eleven functions can be marked as pure. And they still won't
be optimized because they are never called from the same function twice.
Let's remove the ext_pure macro completely to reduce the chance of
repeating this mistake in the future.

Fixes #8866, #8809, #8595, #6992.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 4f08c715db6893ff439d0a39bf4506cd26256d13)

3 years agolib: cleanup and stop grpc pthread
Mark Stapp [Mon, 7 Jun 2021 17:55:11 +0000 (13:55 -0400)]
lib: cleanup and stop grpc pthread

At shutdown, try to stop the grpc module and its
dedicated pthread cleanly.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agodocker: Use tini unilaterally and stop tailing /dev/null
Wesley Coakley [Wed, 9 Jun 2021 03:50:43 +0000 (23:50 -0400)]
docker: Use tini unilaterally and stop tailing /dev/null

tini is a hyper-minimal PID 0 which spawns a child process (watchfrr.sh
in our case), reaps zombies and forwards signals to the script. Starting
watchfrr.sh directly instead of through the old `tail /dev/null` or
`sleep 365d` helps keep things clean too :)

While tini was previously only used in the Alpine container it is useful
to apply this PID 0 to all containers except the special CI ones.

Fixes: #8788
Signed-off-by: Wesley Coakley <w@wesleycoakley.com>
3 years agobgpd: fix routemap update with disabled delay timer
Igor Ryzhov [Thu, 10 Jun 2021 17:21:51 +0000 (20:21 +0300)]
bgpd: fix routemap update with disabled delay timer

- vnc_routemap_update is called only for the last bgp instance
- vpn_policy_routemap_event is not called at all
- unguarded debug (there's already a debug inside the called function)

Make the code consistent with the callback code that is used when the
delay timer is enabled.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: per-instance dynamic hostname cache
Igor Ryzhov [Fri, 11 Jun 2021 15:27:46 +0000 (18:27 +0300)]
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>
3 years agoisis: fix double-adding a circuit to the area
Igor Ryzhov [Wed, 16 Jun 2021 12:54:17 +0000 (15:54 +0300)]
isis: fix double-adding a circuit to the area

isis_circuit_enable can be called for an already enabled circuit. In this
case we would add the circuit to the area multiple times.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix adding a circuit to the wrong area
Igor Ryzhov [Wed, 16 Jun 2021 12:52:14 +0000 (15:52 +0300)]
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>
3 years agoospfd: fix routemap update
Igor Ryzhov [Thu, 17 Jun 2021 16:31:03 +0000 (19:31 +0300)]
ospfd: fix routemap update

Currently, if the routemap already exists, we delete the pointer to it
when it is updated. We should delete the pointer only if the route-map
is actually deleted.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: add a note of domainname
anlancs [Thu, 10 Jun 2021 01:36:19 +0000 (09:36 +0800)]
doc: add a note of domainname

Signed-off-by: anlancs <anlan_cs@tom.com>
3 years agolib: terminate default vrf last
Stephen Worley [Thu, 10 Jun 2021 20:52:35 +0000 (16:52 -0400)]
lib: terminate default vrf last

Always terminate default VRF last during FRR shutdown.

On shutdown we were simply looping over the RB tree and terminating
VRFs from the ROOT. This is not guaranteed to be the default last ever.

Instead switch to RB_SAFE and skip the default VRF till the very end.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
3 years agoMerge pull request #8858 from FRRouting/mergify/bp/dev/8.0/pr-8838
Donald Sharp [Fri, 18 Jun 2021 12:06:28 +0000 (08:06 -0400)]
Merge pull request #8858 from FRRouting/mergify/bp/dev/8.0/pr-8838

lib: do not attempt to create default nodes from NULL tree node (backport #8838)

3 years agoMerge pull request #8827 from idryzhov/8.0-backports-06-10
Mark Stapp [Wed, 16 Jun 2021 20:01:29 +0000 (16:01 -0400)]
Merge pull request #8827 from idryzhov/8.0-backports-06-10

8.0 backports

3 years agolib: do not attempt to create default nodes from NULL tree node
Christian Hopps [Fri, 11 Jun 2021 13:18:24 +0000 (13:18 +0000)]
lib: do not attempt to create default nodes from NULL tree node

Perform same NULL check for dependent node creation code too.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 4da08e016b5753558ffe61db532af8a2f9b6a8a5)

3 years agotests: replace "interface IFNAME area" with "ipv6 ospf6 area"
Igor Ryzhov [Mon, 7 Jun 2021 19:58:30 +0000 (22:58 +0300)]
tests: replace "interface IFNAME area" with "ipv6 ospf6 area"

Only one test is modified yet, to have both new and deprecated commands
tested by the CI.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: replace "interface IFNAME area" with "ipv6 ospf6 area"
Igor Ryzhov [Tue, 25 May 2021 23:05:11 +0000 (02:05 +0300)]
doc: replace "interface IFNAME area" with "ipv6 ospf6 area"

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix interface area configuration
Igor Ryzhov [Tue, 25 May 2021 22:49:30 +0000 (01:49 +0300)]
ospf6d: fix interface area configuration

Currently the interface area is configured from the router node using
"interface IFNAME area ID" command. There are multiple problems with
this command:
- it is not in line with all other interface-related commands - other
  parameters are configured from the interface node using "ipv6 ospf6"
  prefix
- it is not in line with OSPFv2 - area is configured from the interface
  node using "ip ospf area" command
- most importantly, it doesn't work correctly when the interface is in
  a different VRF - instead of configuring the interface, it creates a
  new fake interface and configuring it instead

To fix all the problems, this commit adds a new command to the interface
configuration node - "ipv6 ospf6 area ID". The purpose of the command is
completely the same, but it works correctly in a multi-VRF environment.

The old command is preserved for the backward compatibility, but the
warning is added that it is deprecated because it doesn't work correctly
with VRFs.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agotests: fix ospf6_topo1_vrf
Igor Ryzhov [Mon, 7 Jun 2021 18:58:26 +0000 (21:58 +0300)]
tests: fix ospf6_topo1_vrf

ospf6d (and all other daemons except zebra) doesn't correctly process
`interface X vrf Y`, because it doesn't know existing VRFs at the time
of configuration file reading. Therefore it doesn't apply configuration
provided in the interface node.

Fix the problem by removing `vrf Y` part, having just an interface name
is enough.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: fix memory leaks in summarization
Igor Ryzhov [Tue, 8 Jun 2021 14:01:56 +0000 (17:01 +0300)]
ospfd: fix memory leaks in summarization

To reproduce the issue:
1. Create summary-address: `summary-address 1.1.1.0/24`.
2. Try to delete it with the wrong tag: `no summary-address 1.1.1.0/24 tag 1`.
   Each time this command is executed, route_node_lookup is called which
   locks route node one more time. As the tag is wrong, the function
   return immediately without unlock.
3. Finally delete the summary-address: `no summary-address 1.1.1.0/24`.

The route node won't be deleted.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agozebra: Give extra space and stop processing if we run out of space
Donald Sharp [Tue, 8 Jun 2021 19:38:11 +0000 (15:38 -0400)]
zebra: Give extra space and stop processing if we run out of space

When processing bulk messages we need more space to handle more
mroutes.  In this case we are doubling the stream size from
16k -> 32k, which should roughly double the number of mroutes
we can handle in one go.

Additionally.   If we cannot parse the passed message into
the stream to pass up to pimd then gracefully stop processing

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoospfd: fix crash when displaying neighbor data in JSON
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix crash when displaying neighbor data in JSON

Add a null check to protect against the case where the neighbor
inactive timer is disabled. That can happen when the router is
acting as a helper for another router that is attempting to restart
gracefully.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agolib, ospfd, ospf6d: fix logging of pointer addresses
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
lib, ospfd, ospf6d: fix logging of pointer addresses

The %p printf format specifier does already print the pointer address
with a leading "0x" prefix (indicating a hexadecimal number). There's
no need to add that prefix manually.

While here, replace explicit function names in log messages by
__func__.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix wrong NSSA debug guards
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix wrong NSSA debug guards

Fix usage of NSSA debug guards in code paths that have nothing to
do with NSSA areas.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agozebra, ospfd: fix typos in the graceful restart code
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
zebra, ospfd: fix typos in the graceful restart code

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix logging of what triggered the SPF run
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix logging of what triggered the SPF run

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix cleanup of MaxAge LSAs on exit
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix cleanup of MaxAge LSAs on exit

During shutdown, the ospf->maxage_lsa table is iterated over to
clean up all existing entries. While doing that, route_unlock_node()
should be called only for the nodes that have an associated entry,
otherwise the table will get corrupted and ospfd will crash.

As a side note, using a routing table to store MaxAge LSAs was a
very poor choice of a data structure, considering that a simple
rb-tree or hash table would get the job done with a much simpler
(and less error-prone) API. Something to cleanup in the future...

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix null pointer dereference when flushing an opaque LSA
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix null pointer dereference when flushing an opaque LSA

Call ospf_lsa_flush() before free_opaque_info_per_id() since the
latter can deallocate the LSA that is going to be flushed.

Also, there's no need to set the LSA MaxAge to OSPF_LSA_MAXAGE
manually as the ospf_lsa_flush() function already takes care of that.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix dangling pointer when exiting from the helper mode
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix dangling pointer when exiting from the helper mode

When exiting from the helper mode for a given router after an
unsuccessful graceful restart, removing the neighborship to that
router straight away leads to a dangling pointer in the associated
interface, which inevitably leads to a crash. To solve this
problem, schedule the removal of the neighbor instead of removing
it immediately.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix crash when logging a Grace-LSA
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix crash when logging a Grace-LSA

Change the "show_ospf_grace_lsa_info" callback to account for the
fact that the "vty" parameter can be null.

This fixes a crash that happens when "debug ospf packet ls-update
detail" is configured and a Grace-LSA is sent or received.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix small issue when exiting from the GR helper mode
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix small issue when exiting from the GR helper mode

When exiting from the GR helper mode, recalculate the DR only for
interfaces of the appropriate types (broadcast and NMBA).

This fixes a problem where the state of a neighbor reachable over a
p2p interface was changing from Full/DROther to Full/Backup across
a graceful restart.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agoospfd: fix GR helper initialization and termination
Renato Westphal [Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)]
ospfd: fix GR helper initialization and termination

Since a single ospfd process can have multiple OSPF interfaces
configured, we need to separate the global GR initialization and
termination from per-instance initialization and termination.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
3 years agodoc: replace "passive-interface IFNAME" with "ip ospf passive"
Igor Ryzhov [Sat, 5 Jun 2021 14:53:23 +0000 (17:53 +0300)]
doc: replace "passive-interface IFNAME" with "ip ospf passive"

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: fix passive interface configuration
Igor Ryzhov [Fri, 4 Jun 2021 14:47:32 +0000 (17:47 +0300)]
ospfd: fix passive interface configuration

Currently, passive interface flag is configured from the router node
using "passive-interface IFNAME". There are multiple problems with this
command:
- it is not in line with all other interface-related commands - other
  parameters are configured from the interface node using "ip ospf"
  prefix
- it is not in line with OSPFv3 - passive flag is configured from the
  interface node using "ipv6 ospf6 passive" command
- most importantly, it doesn't work correctly when the interface is in
  a different VRF - when using VRF-lite, it incorrectly changes the
  vrf_id of the interface and it becomes desynced with the actual state;
  when using netns, it creates a new fake interface and configures it
  instead of configuring the necessary interface

To fix all the problems, this commit adds a new command to the interface
configuration node - "ip ospf passive". The purpose of the command is
completely the same, but it works correctly in a multi-VRF environment.

The old command is preserved for the backward compatibility, but the
warning is added that it is deprecated because it doesn't work correctly
with VRFs.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix address sanitizer crash on `find`
Rafael Zalamena [Mon, 7 Jun 2021 14:02:16 +0000 (11:02 -0300)]
lib: fix address sanitizer crash on `find`

Fix the following address sanitizer crash when running the command `find`:

  ERROR: AddressSanitizer: dynamic-stack-buffer-overflow
  WRITE of size 1 at 0x7fff4840fc1d thread T0
      0  in print_cmd ../lib/command.c:1541
      1  in cmd_find_cmds ../lib/command.c:2364
      2  in find ../vtysh/vtysh.c:3732
      3  in cmd_execute_command_real ../lib/command.c:995
      4  in cmd_execute_command ../lib/command.c:1055
      5  in cmd_execute ../lib/command.c:1219
      6  in vtysh_execute_func ../vtysh/vtysh.c:486
      7  in vtysh_execute ../vtysh/vtysh.c:671
      8  in main ../vtysh/vtysh_main.c:721
      9  in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
      10 in _start (/usr/bin/vtysh+0x21f64d)

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agozebra: fix config after exit from vrf
Igor Ryzhov [Wed, 2 Jun 2021 14:27:02 +0000 (17:27 +0300)]
zebra: fix config after exit from vrf

When the VRF node is exited using "exit" or "quit", there's still a VRF
pointer stored in the vty context. If you try to configure some router
related command, it will be applied to the previous VRF instead of the
default VRF. For example:

```
(config)# vrf test
(config-vrf)# ip router-id 1.1.1.1
(config-vrf)# do show run
...
!
vrf test
 ip router-id 1.1.1.1
 exit-vrf
!
...
(config-vrf)# exit
(config)# ip router-id 2.2.2.2
(config)# do show run
...
!
vrf test
 ip router-id 2.2.2.2
 exit-vrf
!
...
```

`vrf-exit` works correctly, because it stores a pointer to the default
VRF into the vty context (but weirdly keeping the VRF_NODE instead of
changing it to CONFIG_NODE).

Instead of relying on the behavior of exit function, always use the
default VRF when in CONFIG_NODE.

Another problem is missing `VTY_CHECK_CONTEXT`. If someone deletes the
VRF in which node the user enters the command, then zebra applies the
command to the default VRF instead of throwing an error.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobfdd: forbid setting interface for multihop sessions
Igor Ryzhov [Fri, 28 May 2021 12:25:36 +0000 (15:25 +0300)]
bfdd: forbid setting interface for multihop sessions

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobfdd: don't store interface pointer for multihop sessions
Igor Ryzhov [Fri, 28 May 2021 11:33:44 +0000 (14:33 +0300)]
bfdd: don't store interface pointer for multihop sessions

It breaks "neighbor A.B.C.D update-source" config in BGP.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix default ttl for single-hop bfd sessions
Igor Ryzhov [Tue, 1 Jun 2021 14:59:24 +0000 (17:59 +0300)]
lib: fix default ttl for single-hop bfd sessions

The TTL field is actually the number of hops, not a TTL.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix bfd multihop
Igor Ryzhov [Thu, 27 May 2021 17:02:56 +0000 (20:02 +0300)]
lib: fix bfd multihop

Never send an interface name/index for multihop sessions. It breaks
"neighbor A.B.C.D update-source" config in BGP.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobgpd: fix enabling bfd debug
Igor Ryzhov [Fri, 28 May 2021 08:55:27 +0000 (11:55 +0300)]
bgpd: fix enabling bfd debug

When enabling bfd debug from the enable mode, library debugging is not
enabled.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix output of "list" and "find" commands
Igor Ryzhov [Wed, 2 Jun 2021 23:02:45 +0000 (02:02 +0300)]
lib: fix output of "list" and "find" commands

Currently, we output the command exactly how it is defined in DEFUN.
We shouldn't output varnames and excessive whitespace.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib, vtysh: reduce code duplication
Igor Ryzhov [Wed, 2 Jun 2021 21:29:51 +0000 (00:29 +0300)]
lib, vtysh: reduce code duplication

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: add separate section for nexthop tracking
Igor Ryzhov [Wed, 2 Jun 2021 14:51:09 +0000 (17:51 +0300)]
doc: add separate section for nexthop tracking

"ip nht resolve-via-default" is currently placed in "Link Parameters
Commands" section. Add a separate section and missing IPv6 counterpart.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: fix link-params commands
Igor Ryzhov [Wed, 2 Jun 2021 14:39:26 +0000 (17:39 +0300)]
doc: fix link-params commands

Remove redundant prefix.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobfdd: fix bfd key structure
Igor Ryzhov [Tue, 1 Jun 2021 17:30:13 +0000 (20:30 +0300)]
bfdd: fix bfd key structure

There's a padding byte between "mhop" and "peer" fields in this structure.
This structure is sometimes passed by value to functions and used in
assignments. The standard doesn't guarantee that the padding bytes are
copied on assignments. As this structure is used as a hash key, having
this padding byte with unspecified value can lead to unwanted behavior.

Fix the possible issue by making the "mhop" field to be 2 bytes. Also
make the struct packed as a precaution for future changes.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: remove varnames from command descriptions
Igor Ryzhov [Wed, 2 Jun 2021 23:19:36 +0000 (02:19 +0300)]
doc: remove varnames from command descriptions

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: if destroy the whole ospf, then remove ospf's interface config: passive-interface
anlancs [Wed, 2 Jun 2021 02:51:49 +0000 (10:51 +0800)]
ospfd: if destroy the whole ospf, then remove ospf's interface config: passive-interface

Signed-off-by: anlancs <anlan_cs@tom.com>
3 years agodoc: Replace single tick with double tick under developer/topotests.rst
Donatas Abraitis [Wed, 2 Jun 2021 05:48:25 +0000 (08:48 +0300)]
doc: Replace single tick with double tick under developer/topotests.rst

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agopathd: fix render candidate-path bandwidth
Emanuele Di Pascale [Tue, 18 May 2021 13:52:44 +0000 (15:52 +0200)]
pathd: fix render candidate-path bandwidth

the config for dynamic candidate paths with bandwidth preferences
was using a different order of keywords (required bandwidth X) than
the corresponding command (bandwidth X required). This confuses
frr-reload, and possibly users too. Make both use the same order.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
3 years agodoc: update VRF support description
Igor Ryzhov [Wed, 12 May 2021 15:49:00 +0000 (18:49 +0300)]
doc: update VRF support description

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agotests: remove tcp_l3mdev_accept setting
Igor Ryzhov [Fri, 7 May 2021 08:19:58 +0000 (11:19 +0300)]
tests: remove tcp_l3mdev_accept setting

This is not necessary anymore with fixed `vrf_bind`.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix binding to a vrf
Igor Ryzhov [Thu, 6 May 2021 23:49:40 +0000 (02:49 +0300)]
lib: fix binding to a vrf

There are two possible use-cases for the `vrf_bind` function:
- bind socket to an interface in a vrf
- bind socket to a vrf device

For the former case, there's one problem - success is returned when the
interface is not found. In that case, the socket is left unbound without
throwing an error.

For the latter case, there are multiple possible problems:
- If the name is not set, then the socket is left unbound (zebra, vrrp).
- If the name is "default" and there's an interface with that name in the
  default VRF, then the socket is bound to that interface.
- In most daemons, if the router is configured before the VRF is actually
  created, we're trying to open and bind the socket right after the
  daemon receives a VRF registration from zebra. We may not receive the
  VRF-interface registration from zebra yet at that point. Therefore,
  `if_lookup_by_name` fails, and the socket is left unbound.

This commit fixes all the issues and updates the function description.

Suggested-by: Pat Ruddy <pat@voltanet.io>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobgpd: pass correct vrf_id to vrf_socket when creating bgp view socket
Igor Ryzhov [Mon, 31 May 2021 19:12:31 +0000 (22:12 +0300)]
bgpd: pass correct vrf_id to vrf_socket when creating bgp view socket

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix using vrf interface as a loopback
Igor Ryzhov [Fri, 28 May 2021 13:14:34 +0000 (16:14 +0300)]
ospf6d: fix using vrf interface as a loopback

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix using vrf interface as a loopback
Igor Ryzhov [Fri, 28 May 2021 15:45:40 +0000 (18:45 +0300)]
isisd: fix using vrf interface as a loopback

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd, ospf6d, pimd: set vrf_id when creating bfd sessions
Igor Ryzhov [Mon, 31 May 2021 10:57:55 +0000 (13:57 +0300)]
isisd, ospf6d, pimd: set vrf_id when creating bfd sessions

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agopceplib: fix mixup of global/local variables
Igor Ryzhov [Fri, 28 May 2021 17:39:37 +0000 (20:39 +0300)]
pceplib: fix mixup of global/local variables

CID 1502790

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: unlink router from vrf on deletion
Igor Ryzhov [Thu, 27 May 2021 10:16:40 +0000 (13:16 +0300)]
ospf6d: unlink router from vrf on deletion

Otherwise `ospf6_lookup_by_vrf_id` returns stale pointer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoMerge pull request #8791 from LabNConsulting/chopps/backport-always-batch
Donald Sharp [Tue, 8 Jun 2021 15:31:13 +0000 (11:31 -0400)]
Merge pull request #8791 from LabNConsulting/chopps/backport-always-batch

northbound: KISS always batch yang config (file read), it's faster

3 years agoMerge pull request #8786 from pjdruddy/backport_ospf6_socket_non_blocking_read
Rafael Zalamena [Mon, 7 Jun 2021 12:41:46 +0000 (09:41 -0300)]
Merge pull request #8786 from pjdruddy/backport_ospf6_socket_non_blocking_read

Backport ospf6 socket non blocking read

3 years agoMerge pull request #8799 from FRRouting/mergify/bp/dev/8.0/pr-8706
Mark Stapp [Mon, 7 Jun 2021 11:54:21 +0000 (07:54 -0400)]
Merge pull request #8799 from FRRouting/mergify/bp/dev/8.0/pr-8706

lib: fix threading bug in GRPC code (backport #8706)

3 years agolib: fix threading bug in GRPC code
Christian Hopps [Thu, 20 May 2021 06:50:34 +0000 (06:50 +0000)]
lib: fix threading bug in GRPC code

The code that actually calls FRR northbound functions needs to be running in the
master thread. The previous code was running on a GRPC pthread. While fixing
moved to more functional vs OOP to make this easier to see.

Also fix ly merge to merge siblings not throw the originals away.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit b680134e1122cdbb67f5c6ed158ee712255ee3cc)

3 years agoMerge pull request #8787 from mjstapp/fix_zmq_xref_8_0
Rafael Zalamena [Fri, 4 Jun 2021 17:41:37 +0000 (14:41 -0300)]
Merge pull request #8787 from mjstapp/fix_zmq_xref_8_0

lib: [8.0] fix use of xrefs in zmq wrapper

3 years agonorthbound: KISS always batch yang config (file read), it's faster
Christian Hopps [Fri, 28 May 2021 19:16:18 +0000 (19:16 +0000)]
northbound: KISS always batch yang config (file read), it's faster

The backoff code assumed that yang operations always completed quickly.
It checked for > 100 YANG modeled commands happening in under 1 second
to enable batching. If 100 yang modeled commands always take longer than
1 second batching is never enabled. This is the exact opposite of what
we want to happen since batching speeds the operations up.

Here are the results for libyang2 code without and with batching.

| action        |  1K rts |  2K rts | 1K rts | 2K rts | 20k rts |
|               | nobatch | nobatch |  batch |  batch |   batch |
| Add IPv4      |    .881 |    1.28 |   .703 |   1.04 |    8.16 |
| Add Same IPv4 |    28.7 |     113 |   .590 |   .860 |    6.09 |
| Rem 1/2 IPv4  |    .376 |    .442 |   .379 |   .435 |    1.44 |
| Add Same IPv4 |    28.7 |     113 |   .576 |   .841 |    6.02 |
| Rem All IPv4  |    17.4 |    71.8 |   .559 |   .813 |    5.57 |

(IPv6 numbers are basically the same as iPv4, a couple percent slower)

Clearly we need this. Please note the growth (1K to 2K) w/o batching is
non-linear and 100 times slower than batched.

Notes on code: The use of the new `nb_cli_apply_changes_clear_pending`
is to commit any pending changes (including the current one). This is
done when the code would not correctly handle a single diff that
included the current changes with possible following changes. For
example, a "no" command followed by a new value to replace it would be
merged into a change, and the code would not deal well with that. A good
example of this is BGP neighbor peer-group changing. The other use is
after entering a router level (e.g., "router bgp") where the follow-on
command handlers expect that router object to now exists. The code
eventually needs to be cleaned up to not fail in these cases, but that
is for future NB cleanup.

Signed-off-by: Christian Hopps <chopps@labn.net>
3 years agolib: logic and macro cleanup in frr_zmq shim
Mark Stapp [Tue, 6 Apr 2021 18:41:45 +0000 (14:41 -0400)]
lib: logic and macro cleanup in frr_zmq shim

Fix a couple of logic/macro issues in the frr_zmq shim
module.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agolib: use public task-scheduling apis
Mark Stapp [Tue, 6 Apr 2021 18:40:39 +0000 (14:40 -0400)]
lib: use public task-scheduling apis

The frr_zmq shim was trying to use some internal scheduling
macros, and that was causing trouble. Just use the public
apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoospf6d: read ospf6 socket until failure
Pat Ruddy [Wed, 3 Mar 2021 11:59:30 +0000 (11:59 +0000)]
ospf6d: read ospf6 socket until failure

To ensure we read all the datagrams availabe from a socket when the
read task is scheduled, make the read helper return and error or
continue enum and loop unitl an error is received.
This requires the read from the socket to be non blocking

Signed-off-by: Pat Ruddy <pat@voltanet.io>
3 years agoospf6d: create an ospf_read_helper function
Pat Ruddy [Wed, 3 Mar 2021 11:17:38 +0000 (11:17 +0000)]
ospf6d: create an ospf_read_helper function

Take the contents of ospf6_receive and split the funtionality that
deals with a single packet receipt and place it in a separate helper
function.
This is the first step in a refactor process to allow the ospf6_read
task to read until failure.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
3 years agoMerge pull request #8774 from FRRouting/mergify/bp/dev/8.0/pr-8769
Mark Stapp [Wed, 2 Jun 2021 12:29:59 +0000 (08:29 -0400)]
Merge pull request #8774 from FRRouting/mergify/bp/dev/8.0/pr-8769

lib: Time to remove CONFDATE block (backport #8769)

3 years agolib: Time to remove CONFDATE block
Donatas Abraitis [Tue, 1 Jun 2021 07:07:58 +0000 (10:07 +0300)]
lib: Time to remove CONFDATE block

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit ef3b48cfe1c2516c6c6490fc38682a7f640b534b)

3 years agoMerge pull request #8766 from idryzhov/8.0-backports-05
Donald Sharp [Tue, 1 Jun 2021 12:14:44 +0000 (08:14 -0400)]
Merge pull request #8766 from idryzhov/8.0-backports-05

8.0 backports

3 years agoospf6: fix memory leak in ospf6_abr_examin_summary
Pat Ruddy [Tue, 25 May 2021 08:38:26 +0000 (09:38 +0100)]
ospf6: fix memory leak in ospf6_abr_examin_summary

Ensure that if allocated route is not added to a table then it is
deleted to avoid leaking memory.
Add a new memory type for route table so that ospf6 routes can be
distinguished in the show memory output in isolation.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
3 years agostaticd: return SUCCESS when deleting non-existent route
Mark Stapp [Wed, 26 May 2021 18:30:51 +0000 (14:30 -0400)]
staticd: return SUCCESS when deleting non-existent route

Return SUCCESS if trying to delete route that doesn't exist.
This was always staticd's behavior before the northbound
conversion.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agogrpc: improve checks for GRPC C++ requirements
Christian Hopps [Thu, 20 May 2021 06:46:34 +0000 (06:46 +0000)]
grpc: improve checks for GRPC C++ requirements

Signed-off-by: Christian Hopps <chopps@labn.net>
3 years agodocker: fix ubuntu containers
Igor Ryzhov [Thu, 27 May 2021 12:57:03 +0000 (15:57 +0300)]
docker: fix ubuntu containers

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>