]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
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 8799/head
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 8791/head
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 8787/head
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 8786/head
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 8774/head
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 8766/head
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>
3 years agoRevert "build: libyangv2 is mainlined, update"
Igor Ryzhov [Thu, 27 May 2021 12:56:06 +0000 (15:56 +0300)]
Revert "build: libyangv2 is mainlined, update"

This partially reverts commit 250335d47cc338fa1951494a9b78bf429016a7e5.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobuild: libyangv2 is mainlined, update
Christian Hopps [Thu, 27 May 2021 10:28:01 +0000 (10:28 +0000)]
build: libyangv2 is mainlined, update

Signed-off-by: Christian Hopps <chopps@gmail.com>
3 years agoospf6d: Fix route map "set tag" command
Martin Buck [Wed, 26 May 2021 14:03:51 +0000 (16:03 +0200)]
ospf6d: Fix route map "set tag" command

So far, "set tag" was 99% implemented in ospf6d, but registration of the
hook functions was missing, causing "set tag" actions in route maps to be
ignored in ospf6d.

This commit adds the missing hook registration.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
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 agoospf6d: fix debug message config write
Igor Ryzhov [Wed, 26 May 2021 08:48:09 +0000 (11:48 +0300)]
ospf6d: fix debug message config write

Fix the following issues:
- if "send" is combined with "recv-hdr", only "send" is shown
- if "recv" is combined with "send-hdr", only "recv" is shown
- if both "send-hdr" and "recv-hdr" are enabled, "; header only" is shown

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix invalid "no debug ospf6 message unknown"
Igor Ryzhov [Wed, 26 May 2021 08:45:07 +0000 (11:45 +0300)]
ospf6d: fix invalid "no debug ospf6 message unknown"

The message is always shown in the config, because IS_OSPF6_DEBUG_MESSAGE
works incorrectly when negated because of missing outer brackets.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix possible crashes
Igor Ryzhov [Tue, 25 May 2021 18:58:55 +0000 (21:58 +0300)]
ospf6d: fix possible crashes

OSPF6 instance may not exist when processing interface state change.
Do not execute processing steps that require an instance if an area is
not configured for an interface.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agostaticd: fix distance processing
Igor Ryzhov [Tue, 25 May 2021 12:49:46 +0000 (15:49 +0300)]
staticd: fix distance processing

When the user adds the route + nexthop pair that already exists with a
different distance, we should replace it instead of adding a new one.

Likewise, when the user wants to delete the route + nexthop pair without
explicitly entering the distance, we should delete the route.

Fixes #8695.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: Fix quick interface down up event handling in ospf
Donald Sharp [Mon, 24 May 2021 17:45:29 +0000 (13:45 -0400)]
ospfd: Fix quick interface down up event handling in ospf

When we get this sequence of events:

- zebra receives interface up, sends to ospf
- ospf receives intf up, processes( including neighbor formation and spf )
  and sends route to zebra for installation.
- zebra receives route for processing, schedules it too happen in the future
- zebra receives interface down event, sends to ospf
- zebra processes route X and marks it inactive because nexthop
  interface is down
- zebra receives interface up event, sends to ospf
- ospf receives both events and processes the change and decides
  that nothing has changed so it does not send any route change for X to zebra.

At this point zebra has a route from ospf that is marked as inactive, while
ospf believes that the route should be installed properly.

Modify the code such that on an interface down event, ospf marks the routes
as changed if the ifindex is being used for a nexthop, so that when ospf
is deciding if routes have changed post spf that it can just automatically
send that route down again if it still exists.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agodoc: remove "no" commands
Igor Ryzhov [Mon, 24 May 2021 15:38:48 +0000 (18:38 +0300)]
doc: remove "no" commands

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix address sanitizer crash
Rafael Zalamena [Mon, 24 May 2021 11:30:26 +0000 (08:30 -0300)]
ospf6d: fix address sanitizer crash

Don't `memcpy` a `struct prefix` the memory size varies depending on the
original intended type. In this case the original type was (casted away)
`struct prefix_ipv6` and we tried to copy `struct prefix` which is
bigger.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
3 years agolib: fix missing newline
Igor Ryzhov [Mon, 24 May 2021 10:26:49 +0000 (13:26 +0300)]
lib: fix missing newline

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix missing VRF parameter
Igor Ryzhov [Fri, 21 May 2021 17:13:51 +0000 (20:13 +0300)]
isisd: fix missing VRF parameter

It was incorrectly removed in 1cbf96a.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobgpd: fix aggregate-address command
Igor Ryzhov [Fri, 21 May 2021 17:10:41 +0000 (20:10 +0300)]
bgpd: fix aggregate-address command

Additional parameters are not mandatory.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: expand documentation on gRPC
Christian Hopps [Thu, 20 May 2021 14:03:37 +0000 (14:03 +0000)]
doc: expand documentation on gRPC

Add C++ and Python examples, and add compiling info, and known gRPC
version that works.

Signed-off-by: Christian Hopps <chopps@gmail.com>
3 years agoospfd: "ip ospf area" command can select wrong process
Don Slice [Wed, 19 May 2021 18:23:28 +0000 (14:23 -0400)]
ospfd: "ip ospf area" command can select wrong process

Found that in some circumstances, when the "ip ospf area"
command was entered for the default vrf, the wrong ospf
process would be used to check for the presence of a
"network" statement, causing the "ip ospf area" command to
be rejected. This was due to the command using the ospf
instance lookup to find the right ospf process, which can
be in error depending on when the processes were created.

Signed-off-by: Don Slice <dslice@nvidia.com>
3 years agolib: fix northbound merge code (libyang)
Christian Hopps [Thu, 20 May 2021 06:49:32 +0000 (06:49 +0000)]
lib: fix northbound merge code (libyang)

lyd_merge_tree replaces dest siblings with source siblings, not what we
want. Instead lyd_merge_siblings to keep both. Instead lyd_merge_siblings
to keep both.

Signed-off-by: Christian Hopps <chopps@labn.net>
3 years agoospfd: New code adds newline to log files
Donald Sharp [Wed, 19 May 2021 18:51:23 +0000 (14:51 -0400)]
ospfd: New code adds newline to log files

FRR is not using newlines in log messages.  Remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopbrd: fix coverity warning
Igor Ryzhov [Wed, 19 May 2021 13:24:21 +0000 (16:24 +0300)]
pbrd: fix coverity warning

CID 1500586

There was an attempt to fix it in 920bb6f7 but the commit didn't
actually fix the warning.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agolib: fix coverity warnings
Igor Ryzhov [Wed, 19 May 2021 12:53:16 +0000 (15:53 +0300)]
lib: fix coverity warnings

CID 1504894

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agozebra: fix possible uninitialized value
Igor Ryzhov [Wed, 19 May 2021 11:59:00 +0000 (14:59 +0300)]
zebra: fix possible uninitialized value

Found by Coverity.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobgpd: fix zebra bfd registration
Igor Ryzhov [Tue, 18 May 2021 20:31:52 +0000 (23:31 +0300)]
bgpd: fix zebra bfd registration

If there's no default router configured at the moment when bgpd is
connected to zebra, bgpd is not registered as a BFD client.

We should do the registration regardless of the config existence.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: fix SID/Label Sub TLV size
Igor Ryzhov [Tue, 18 May 2021 15:25:14 +0000 (18:25 +0300)]
ospfd: fix SID/Label Sub TLV size

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agobgpd: raise privs for SO_BINDTODEVICE
Igor Ryzhov [Tue, 18 May 2021 14:07:06 +0000 (17:07 +0300)]
bgpd: raise privs for SO_BINDTODEVICE

The priv raise was incorrectly dropped in 97896a9.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agodoc: remove redundant index directives
Igor Ryzhov [Tue, 18 May 2021 12:29:59 +0000 (15:29 +0300)]
doc: remove redundant index directives

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agotests: Fix for multicast_pim_sm failure
Kuldeep Kashyap [Tue, 18 May 2021 01:50:49 +0000 (18:50 -0700)]
tests: Fix for multicast_pim_sm failure

Test case test_verify_mroute_when_5_different_receiver_joining_same_sources_p0
is failing intermittently in master. Fixed the issue.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
3 years agoospf6d: fix "default-information originate" in non-existing vrf
Igor Ryzhov [Mon, 17 May 2021 22:24:22 +0000 (01:24 +0300)]
ospf6d: fix "default-information originate" in non-existing vrf

If the default route redistribution is configured in OSPF6 router before
the VRF is created, then this is not currently registered in zebra after
the VRF creation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospfd: fix "default-information originate" in non-existing vrf
Igor Ryzhov [Mon, 17 May 2021 22:23:35 +0000 (01:23 +0300)]
ospfd: fix "default-information originate" in non-existing vrf

If the default route redistribution is configured in OSPF router before
the VRF is created, then this is not currently registered in zebra after
the VRF creation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix build warning and simplify code
Igor Ryzhov [Mon, 17 May 2021 10:07:24 +0000 (13:07 +0300)]
isisd: fix build warning and simplify code

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agopimd: Fix rare crash situation
Donald Sharp [Fri, 14 May 2021 13:46:36 +0000 (09:46 -0400)]
pimd: Fix rare crash situation

When running pim on an interface and that interface has
state and we move that interface into a different vrf
there exists a call path where we have not created the pimreg
device yet.  Prevent a crash in this rare situation.

Ticket: #2552763
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopimd: When bind fails give some extra data
Donald Sharp [Fri, 14 May 2021 13:44:12 +0000 (09:44 -0400)]
pimd: When bind fails give some extra data

When bind to a socket fails, let's give some color so we can
understand and fix the issue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopathd: Fix affinity command to exclude options to match implementation.
Javier Garcia [Thu, 13 May 2021 11:38:41 +0000 (13:38 +0200)]
pathd: Fix affinity command to exclude options to match implementation.

Including documentation update.

Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
3 years agopathd: Clean coverity issues after merge pathd link state feature.
Javier Garcia [Thu, 13 May 2021 11:17:44 +0000 (13:17 +0200)]
pathd: Clean coverity issues after merge pathd link state feature.

Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
3 years agotests: fix bgp_l3vpn_to_bgp_vrf
Igor Ryzhov [Wed, 12 May 2021 15:55:40 +0000 (18:55 +0300)]
tests: fix bgp_l3vpn_to_bgp_vrf

Too many arguments for format string.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: free "default-information originate" config when removing router
Igor Ryzhov [Fri, 7 May 2021 14:53:13 +0000 (17:53 +0300)]
ospf6d: free "default-information originate" config when removing router

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: fix crash when removing router from vrf that doesn't exist
Igor Ryzhov [Fri, 7 May 2021 14:52:41 +0000 (17:52 +0300)]
ospf6d: fix crash when removing router from vrf that doesn't exist

`listgetdata(listhead(list))` crashes for an empty list.

Reproducible with:
```
router ospf6 vrf doesntexist
 default-information originate always
 exit
no router ospf6 vrf doesntexist
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoospf6d: always free redistribute config
Igor Ryzhov [Fri, 7 May 2021 14:05:40 +0000 (17:05 +0300)]
ospf6d: always free redistribute config

When the ospf6 instance in unknown VRF is deleted, the redistribution
config is not freed, because it is not registered in zebra. We should
always free the config regardless of zebra registration status.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix dangling instances
Igor Ryzhov [Sun, 9 May 2021 13:43:29 +0000 (16:43 +0300)]
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>
3 years agoisisd: fix memleak when deleting area and instance
Igor Ryzhov [Sun, 9 May 2021 13:09:38 +0000 (16:09 +0300)]
isisd: fix memleak when deleting area and instance

Release memory for all redistributed route info.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: fix redistribution in vrf
Igor Ryzhov [Tue, 4 May 2021 21:10:31 +0000 (00:10 +0300)]
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>
3 years agoisisd: fix "default-information originate always"
Igor Ryzhov [Sun, 9 May 2021 14:07:39 +0000 (17:07 +0300)]
isisd: fix "default-information originate always"

We don't need to register for default routes from zebra, when the
origination type is set to "always".

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoisisd: deregister vrf from zebra when vrf is disabled
Igor Ryzhov [Tue, 4 May 2021 18:58:23 +0000 (21:58 +0300)]
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>
3 years agopimd: Remove pim->vrf_id and use pim->vrf->vrf_id
Donald Sharp [Wed, 12 May 2021 18:31:45 +0000 (14:31 -0400)]
pimd: Remove pim->vrf_id and use pim->vrf->vrf_id

VRF creation can happen from either cli or from
knowledged about the vrf learned from zebra.
In the case where we learn about the vrf from
the cli, the vrf id is UNKNOWN.  Upon actual
creation of the vrf, lib/vrf.c touches up the vrf_id
and calls pim_vrf_enable to turn it on properly.
At this point in time we have a pim->vrf_id of
UNKNOWN and the vrf->vrf_id of the right value.

There is no point in duplicating this data.  So just
remove all pim->vrf_id and use the vrf->vrf_id instead
since we keep a copy of the pim->vrf pointer.

This will remove some crashes where we expect the
pim->vrf_id to be usable and it's not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agopimd: There exists a path where on vrf bringup we do not create the pimreg
Donald Sharp [Mon, 3 May 2021 18:39:47 +0000 (14:39 -0400)]
pimd: There exists a path where on vrf bringup we do not create the pimreg

When creating configuration for a vrf *Before* the vrf has been
created, pim will not properly create the pimreg device and
we will promptly crash when we try to pass data.

Put some code checks in place to ensure that the pimreg is
created for vrf's.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoospfd: Correct Coverity defects
Olivier Dugeon [Tue, 6 Apr 2021 10:09:25 +0000 (12:09 +0200)]
ospfd: Correct Coverity defects

When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().

To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.

This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
3 years agoMerge pull request #8743 from taspelund/fix_pfx-tree_default_8.0
Igor Ryzhov [Thu, 27 May 2021 07:14:09 +0000 (10:14 +0300)]
Merge pull request #8743 from taspelund/fix_pfx-tree_default_8.0

[8.0] lib: fix handling of rmap prefix-tree default node

3 years agolib: fix handling of rmap prefix-tree default node 8743/head
Trey Aspelund [Fri, 21 May 2021 22:04:15 +0000 (22:04 +0000)]
lib: fix handling of rmap prefix-tree default node

Prior to this commit, updating a prefix-list that is referenced by a
route-map clause will unconditionally delete the root node of that
route-map's prefix-tree (used with route-map optimization).
This is problematic because routes not matching a more specific node
in the tree (i.e. other prefix-list sequences) will not fall-back to
the default node, thus they will not hit any route-map sequences.
This commit ensures that an update to a prefix-list will only delete
the default node while adding the first/only seq to the list.

Example config:
========
ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16
ip prefix-list peer475-out-pfxlist seq 50 permit 0.0.0.0/0
!
route-map peer475-out permit 5
 match ip address prefix-list peer475-out-pfxlist

Before:
========
ub20# do show route-map peer475-out prefix-table
ZEBRA:

IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5

    2.138.0.0/16 (2)
(P) 0.0.0.0/0

                                                      peer475-out seq 5
IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________
BGP:
IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5
    2.138.0.0/16 (2)
(P) 0.0.0.0/0
                                                      peer475-out seq 5
IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________
ub20# conf t
ub20(config)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32
ub20(config)# do show route-map peer475-out prefix-table
ZEBRA:
IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    2.138.0.0/16 (2)
(P)
                                                      peer475-out seq 5
IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________
BGP:
IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    2.138.0.0/16 (2)
(P)
                                                      peer475-out seq 5
IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________
ub20(config)#

After:
========
ub20(config)# do show route-map peer475-out prefix-table
ZEBRA:

IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5

    2.138.0.0/16 (2)
(P) 0.0.0.0/0

                                                      peer475-out seq 5

IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________

BGP:

IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5

    2.138.0.0/16 (2)
(P) 0.0.0.0/0

                                                      peer475-out seq 5

IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________

ub20(config)# ip prefix-list peer475-out-pfxlist seq 45 permit 2.138.0.0/16 le 32
ub20(config)# do show route-map peer475-out prefix-table
ZEBRA:

IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5

    2.138.0.0/16 (2)
(P) 0.0.0.0/0

                                                      peer475-out seq 5

IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________

BGP:

IPv4 Prefix                                           Route-map Index List
_______________                                       ____________________
    0.0.0.0/0 (2)
(P)
                                                      peer475-out seq 5

    2.138.0.0/16 (2)
(P) 0.0.0.0/0

                                                      peer475-out seq 5

IPv6 Prefix                                           Route-map Index List
_______________                                       ____________________

ub20(config)#

Fixes: 8410
Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
(cherry picked from commit 4718791c8f7101379f99fa7174e8ccaf80573433)

3 years agoMerge pull request #8717 from idryzhov/8.0-fix-missing-commands
Donald Sharp [Mon, 24 May 2021 10:47:32 +0000 (06:47 -0400)]
Merge pull request #8717 from idryzhov/8.0-fix-missing-commands

[8.0] bgpd: fix missing command installations

3 years agobgpd: fix missing command installations 8717/head
Igor Ryzhov [Fri, 21 May 2021 17:11:41 +0000 (20:11 +0300)]
bgpd: fix missing command installations

They were missed during BGP NB revert.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoMerge pull request #8670 from idryzhov/bgp-nb-revert
Donald Sharp [Thu, 20 May 2021 15:26:32 +0000 (11:26 -0400)]
Merge pull request #8670 from idryzhov/bgp-nb-revert

[8.0] BGP NB revert

3 years agoMerge pull request #8702 from donaldsharp/dc_80
Donatas Abraitis [Thu, 20 May 2021 06:29:01 +0000 (09:29 +0300)]
Merge pull request #8702 from donaldsharp/dc_80

bgpd: recalc peer's sort after changing confed peers

3 years agobgpd: recalc peer's sort after changing confed peers 8702/head
Alexander Chernavin [Mon, 17 May 2021 09:34:03 +0000 (05:34 -0400)]
bgpd: recalc peer's sort after changing confed peers

Currently, when AS number of an existing BGP neighbor is added in a BGP
confederation, AS_CONFED_SEQUENCE segment attribute will be missing in
prefixes advertised to the neighbor. Also, receiving prefixes from the
neighbor will be withdrawn because of "Malformed AS path from A.B.C.D".

    neighbor 10.100.200.3 remote-as 123
    bgp confederation identifier 65001
    bgp confederation peers 123

With this change, update peer's sort after adding or removing its AS
number in a BGP confederation.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
3 years agoRevert "tests/bgpd: initialized candidate_config to vtysh" 8670/head
Igor Ryzhov [Fri, 14 May 2021 12:36:24 +0000 (15:36 +0300)]
Revert "tests/bgpd: initialized candidate_config to vtysh"

This reverts commit 64fb3f86661c0f5ac2f9017a7b6b999dbcb8e2e4.

3 years agoRevert "tests: add bgp yang module registery to attr test"
Igor Ryzhov [Fri, 14 May 2021 00:06:04 +0000 (03:06 +0300)]
Revert "tests: add bgp yang module registery to attr test"

This reverts commit 15cbc382061ee8807dbe79827c96ae94a4aa90c6.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: register northbound callbacks to bootstrap"
Igor Ryzhov [Thu, 13 May 2021 23:57:30 +0000 (02:57 +0300)]
Revert "bgpd: register northbound callbacks to bootstrap"

This reverts commit e4a464160dee2b53f2851879b2c736139061e74c.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: bgp northbound callbacks prototypes"
Igor Ryzhov [Thu, 13 May 2021 23:21:54 +0000 (02:21 +0300)]
Revert "bgpd: bgp northbound callbacks prototypes"

This reverts commit a1950c80a570e721503de4cf86de7a247e900781.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: convert global config to transactional cli"
Igor Ryzhov [Thu, 13 May 2021 23:20:04 +0000 (02:20 +0300)]
Revert "bgpd: convert global config to transactional cli"

This reverts commit ff8a8a7ac10b3211d5586c29dfcc5a3b32841029.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: register nb routing hook"
Igor Ryzhov [Thu, 13 May 2021 23:16:29 +0000 (02:16 +0300)]
Revert "bgpd: register nb routing hook"

This reverts commit 374069da83f5f00f53156e1886372391c3f00b3f.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: shorten northbound callback names"
Igor Ryzhov [Thu, 13 May 2021 23:15:46 +0000 (02:15 +0300)]
Revert "bgpd: shorten northbound callback names"

This reverts commit 906ebeec9800d3aef0eddb70ce74b48e370cb5ce.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agoRevert "bgpd: correct bgp global context"
Igor Ryzhov [Thu, 13 May 2021 23:13:40 +0000 (02:13 +0300)]
Revert "bgpd: correct bgp global context"

This reverts commit 87ce25646be36bb9a27e75d177615e3d19a07df0.

3 years agoRevert "bgpd: move router bgp nb callback"
Igor Ryzhov [Thu, 13 May 2021 23:13:20 +0000 (02:13 +0300)]
Revert "bgpd: move router bgp nb callback"

This reverts commit 5e42cb2fb088a28202e60ec57a4116f3d1f0afd5.

3 years agoRevert "bgpd: no router bgp check candidate config"
Igor Ryzhov [Thu, 13 May 2021 23:13:15 +0000 (02:13 +0300)]
Revert "bgpd: no router bgp check candidate config"

This reverts commit 4b63e358bc213bfa9d1baeda6fbbdfa39df60d2e.

3 years agoRevert "bgpd: fix SA warnings in bgp northbound"
Igor Ryzhov [Thu, 13 May 2021 23:12:55 +0000 (02:12 +0300)]
Revert "bgpd: fix SA warnings in bgp northbound"

This reverts commit 082de39e7155e958416564f65286d4b57434ce4a.

3 years agoRevert "bgpd: Use default VRF name if using `router bgp` command"
Igor Ryzhov [Thu, 13 May 2021 23:12:49 +0000 (02:12 +0300)]
Revert "bgpd: Use default VRF name if using `router bgp` command"

This reverts commit 5ce106b72bac1c45567159c4dfcc9276164bd18b.

3 years agoRevert "bgpd: rename router bgp callbacks"
Igor Ryzhov [Thu, 13 May 2021 23:12:33 +0000 (02:12 +0300)]
Revert "bgpd: rename router bgp callbacks"

This reverts commit feded4118b89eba5a1629f45cfe623277612e404.

3 years agoRevert "bgpd: fix crash in bgp instance creation"
Igor Ryzhov [Thu, 13 May 2021 23:12:29 +0000 (02:12 +0300)]
Revert "bgpd: fix crash in bgp instance creation"

This reverts commit a5ab756f2483594a19837e0c30f6184cd966940f.

3 years agoRevert "bgpd: use common api in bgp_get"
Igor Ryzhov [Thu, 13 May 2021 23:12:24 +0000 (02:12 +0300)]
Revert "bgpd: use common api in bgp_get"

This reverts commit bdaadb91e8adc103197d8f57a6a3358ff313a23c.