]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
4 years agoisisd: fix node for clear commands
Igor Ryzhov [Thu, 1 Oct 2020 14:11:35 +0000 (17:11 +0300)]
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>
4 years ago*: make failure to decode nht update an error
Quentin Young [Wed, 30 Sep 2020 22:37:15 +0000 (18:37 -0400)]
*: make failure to decode nht update an error

This should never happen; no need to debug guard it and it's not a
warning, if this isn't working then NHT is not working at all.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agolib: fix zapi_nexthop_update_decode error rc
Quentin Young [Wed, 30 Sep 2020 22:22:33 +0000 (18:22 -0400)]
lib: fix zapi_nexthop_update_decode error rc

This function returns true on success and false otherwise. Returning -1
on error is equivalent to returning true.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agozebra: don't touch mlag read event pointer
Mark Stapp [Wed, 30 Sep 2020 17:24:54 +0000 (13:24 -0400)]
zebra: don't touch mlag read event pointer

Don't touch the mlag read event pointer, it's not safe.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agobfdd: Make new multihop peer if local-address is unique
Tashana Mehta-Wilson [Tue, 29 Sep 2020 00:47:53 +0000 (13:47 +1300)]
bfdd: Make new multihop peer if local-address is unique

Previously if there were two multihop peers created that had the same
peer address but different local addresses then the second peer to be
created would be merged with the first one and niether would be able to
be deleted. This was due to an issue in the function bfd_key_lookup().
When the second peer was created its key would be sent into the lookup
function and would reach the last section, even though it shouldn't
have. A check has been placed around the section so that it will not be
entered if a peer is multihop.

Signed-off-by: Tashana Mehta-Wilson <tashana.mehta-wilson@alliedtelesis.co.nz>
4 years agopbrd: use bool for pbr_send_pbr_map() return val
Stephen Worley [Wed, 23 Sep 2020 18:17:15 +0000 (14:17 -0400)]
pbrd: use bool for pbr_send_pbr_map() return val

Use a bool as the return val for pbr_send_pbr_map() to make
the code a bit more readable. Dont expect there to be need
for values other than true or false anyway.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agopbrd: cleanup pbr ifp info if not sent to zebra
Stephen Worley [Thu, 17 Sep 2020 19:34:36 +0000 (15:34 -0400)]
pbrd: cleanup pbr ifp info if not sent to zebra

Properly cleanup the pbr interface data if nothing actually
gets sent to zebra, since we will never get the callback
notification from zapi to issue final deletion.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agopbrd: add return val for pbr_send_pbr_map()
Stephen Worley [Thu, 17 Sep 2020 19:32:01 +0000 (15:32 -0400)]
pbrd: add return val for pbr_send_pbr_map()

Add a return val so caller can know if something was actually sent to
zebra here. Some things need to be cleanued up by the caller
if we arent getting a callback from zapi.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agozebra: avoid duplication node in l3vni l2vni-list
Chirag Shah [Sun, 27 Sep 2020 21:09:43 +0000 (14:09 -0700)]
zebra: avoid duplication node in l3vni l2vni-list

With l2vni flap leading to duplicate entry creation
in l3vni's l2vni-list.
Use list sorted add with no duplicates.

root@TORC11:mgmt:~# show evpn vni 4001
VNI: 4001
  Type: L3
  Tenant VRF: vrf1
  State: Up
  ...
  L2 VNIs: 1000 1000 1000 0 0 1002
root@TORC11:mgmt:~# ip link set down vx-1002
root@TORC11:mgmt:~# ip link set up vx-1002
root@TORC11:mgmt:~# show evpn vni 4001
VNI: 4001
  Type: L3
  Tenant VRF: vrf1
  State: Up
  ...
  L2 VNIs: 1000 1000 1000 0 0 1002 1002

Ticket:CM-31545
Reviewed By:
Testing Done:

With Fix:
Multiple time flaps vni counts remained the same.

root@TORC11:mgmt:~# ip link set down vx-1002
root@TORC11:mgmt:~# ip link set up vx-1002
root@TORC11:mgmt:~# ip link set down vx-1002
root@TORC11:mgmt:~# ip link set up vx-1002
root@TORC11:mgmt:~# net show evpn vni 4001
VNI: 4001
  Type: L3
  Tenant VRF: vrf1
  State: Up
  ...
  L2 VNIs: 1000 1002

Signed-off-by: Chirag Shah <chirag@nvidia.com>
4 years agozebra: Make nexthop_active check use the same debug
Donald Sharp [Tue, 29 Sep 2020 11:54:35 +0000 (07:54 -0400)]
zebra: Make nexthop_active check use the same debug

When debugging why a route was not successfully installed into the
rib, it would be preferable that the end user only have to turn
on `debug zebra rib detail` as that is what we have been telling
people to do for the last couple of years.  Consolidate *back*
to this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: Add missing reason we could not make an active_nexthop check
Donald Sharp [Tue, 29 Sep 2020 11:45:19 +0000 (07:45 -0400)]
zebra: Add missing reason we could not make an active_nexthop check

Add a missing reason as to why we are unable to make an active nexthop
check be successful.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agovtysh: fix exit from keychain node
Igor Ryzhov [Mon, 28 Sep 2020 14:17:05 +0000 (17:17 +0300)]
vtysh: fix exit from keychain node

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agovtysh: fix exit from babeld node
Igor Ryzhov [Mon, 28 Sep 2020 14:13:40 +0000 (17:13 +0300)]
vtysh: fix exit from babeld node

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agobuild: remove redundant commas
Igor Ryzhov [Sun, 27 Sep 2020 16:22:02 +0000 (19:22 +0300)]
build: remove redundant commas

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoisisd: guard against adj timer display overflow
Emanuele Di Pascale [Wed, 23 Sep 2020 14:46:44 +0000 (16:46 +0200)]
isisd: guard against adj timer display overflow

An adjacency should be removed when the holdtimer expires, but if the
system is overloaded we may end up doing it late. In the meanwhile vtysh
will display an incorrect value in the show isis neighbor output, due to
an overflow of the unsigned variable used to display the Holdtime, e.g.:

pe1# show isis neighbor
Area test:
 System Id     Interface   L   state   Holdtime  SNPA
 Spirent-1     2.201       1   Down    26        2020.2020.2020
 Spirent-1     2.203       1   Up      21        2020.2020.2020
 Spirent-1     2.204       1   Up      18446744073709551615  2020.2020.2020
 Spirent-1     2.207       1   Up      18446744073709551615  2020.2020.2020
 Spirent-1     2.208       1   Up      18446744073709551615  2020.2020.2020
 Spirent-1     2.209       1   Up      0         2020.2020.2020
 Spirent-1     2.210       1   Up      18446744073709551615  2020.2020.2020
 pe2           12.200      1   Up      30        2020.2020.2020

Guard against that by printing an "Expiring" message instead.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agoisisd: simplify adj_change hook call
Emanuele Di Pascale [Wed, 23 Sep 2020 14:37:21 +0000 (16:37 +0200)]
isisd: simplify adj_change hook call

There is no need to call isis_adj_state_change_hook once per level
in isis_adj_state_change, we can just do it once at the end.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years ago*: move all userdata when changing node xpath
Igor Ryzhov [Thu, 24 Sep 2020 18:05:32 +0000 (21:05 +0300)]
*: move all userdata when changing node xpath

The same thing was done for interfaces in commit f7c20aa1f.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agobgpd: Remove dest variable from route_out_vty_flowspec
Donald Sharp [Thu, 24 Sep 2020 12:20:24 +0000 (08:20 -0400)]
bgpd: Remove dest variable from route_out_vty_flowspec

The dest variable was never really used.  Just remove
from the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: pbra is already derefed in all paths to this spot
Donald Sharp [Thu, 24 Sep 2020 12:16:57 +0000 (08:16 -0400)]
bgpd: pbra is already derefed in all paths to this spot

The pbra variable is already derefed in all paths to this spot
and as such we cannot be NULL at this point.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agopimd: When bind fails we could leave an open socket
Donald Sharp [Thu, 24 Sep 2020 12:12:49 +0000 (08:12 -0400)]
pimd: When bind fails we could leave an open socket

Clean up the rare situation when bind fails to not
close the fd that was just opened and have the socket
leaked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agopimd: NULL not 0
Donald Sharp [Thu, 24 Sep 2020 12:10:26 +0000 (08:10 -0400)]
pimd: NULL not 0

When handling data pointers explicity use NULL not
0.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: Ensure we do integer size promotions
Donald Sharp [Thu, 24 Sep 2020 12:07:12 +0000 (08:07 -0400)]
bgpd: Ensure we do integer size promotions

When doing multiplication of (int) * (uint_8t) we can
have overflow and end up in a weird state.  Intentionally
upgrade the type then do the math.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: Don't ignore setsockopt return
Donald Sharp [Thu, 24 Sep 2020 11:42:51 +0000 (07:42 -0400)]
zebra: Don't ignore setsockopt return

When attempting to limit the amount of data sent from the kernel
to FRR, some kernels we can run against may not have this ability
in which case the setsockopt will fail.  Notice that in the log.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: fix use of freed es during zebra shutdown
Anuradha Karuppiah [Tue, 15 Sep 2020 23:50:14 +0000 (16:50 -0700)]
zebra: fix use of freed es during zebra shutdown

This problem was reported by the sanitizer -
=================================================================
==24764==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0000115c8 at pc 0x55cb9cfad312 bp 0x7fffa0552140 sp 0x7fffa0552138
READ of size 8 at 0x60d0000115c8 thread T0
    #0 0x55cb9cfad311 in zebra_evpn_remote_es_flush zebra/zebra_evpn_mh.c:2041
    #1 0x55cb9cfad311 in zebra_evpn_es_cleanup zebra/zebra_evpn_mh.c:2234
    #2 0x55cb9cf6ae78 in zebra_vrf_disable zebra/zebra_vrf.c:205
    #3 0x7fc8d478f114 in vrf_delete lib/vrf.c:229
    #4 0x7fc8d478f99a in vrf_terminate lib/vrf.c:541
    #5 0x55cb9ceba0af in sigint zebra/main.c:176
    #6 0x55cb9ceba0af in sigint zebra/main.c:130
    #7 0x7fc8d4765d20 in quagga_sigevent_process lib/sigevent.c:103
    #8 0x7fc8d4787e8c in thread_fetch lib/thread.c:1396
    #9 0x7fc8d4708782 in frr_run lib/libfrr.c:1092
    #10 0x55cb9ce931d8 in main zebra/main.c:488
    #11 0x7fc8d43ee09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #12 0x55cb9ce94c09 in _start (/usr/lib/frr/zebra+0x8ac09)
=================================================================

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
4 years agozebra: evpn-mh: add error logs on ES processing failures
Anuradha Karuppiah [Wed, 20 May 2020 21:56:36 +0000 (14:56 -0700)]
zebra: evpn-mh: add error logs on ES processing failures

Cleanup some of the XXX added during development of MH.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
4 years agozebra: Increase the read/write mlag buffer sizes
Donald Sharp [Wed, 23 Sep 2020 17:06:08 +0000 (13:06 -0400)]
zebra: Increase the read/write mlag buffer sizes

The read/write mlag buffer sizes of 2k were sufficient
for ~100 S,G notifications at one go.  Increase to 32k
to give us 16 times the space.

Ticket: CM-31576
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: Ensure that message received from mlag will fit
Donald Sharp [Wed, 23 Sep 2020 17:04:20 +0000 (13:04 -0400)]
zebra: Ensure that message received from mlag will fit

If we receive a message that is greater than our buffer
size we are in a situation where both the read and write
buffers are fubar'ed beyond the end.  Assert when we notice
this fact.

Ticket: CM-31576
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: modify mlag code to only need 1 stream when generating data
Donald Sharp [Wed, 23 Sep 2020 16:26:13 +0000 (12:26 -0400)]
zebra: modify mlag code to only need 1 stream when generating data

The normal pattern of writing the type/length at the beginning
of the packet was not being quite followed.  Modify the mlag
code to respect the proper way of doing things and get rid
of a stream_new and copy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agozebra: stop neigh hold timer when the neigh is deleted
Anuradha Karuppiah [Tue, 26 May 2020 13:24:17 +0000 (06:24 -0700)]
zebra: stop neigh hold timer when the neigh is deleted

The neigh hold timer was firing after the neigh was deleted resulting
in the following crash -
[
    at ./zebra/zebra_evpn_neigh.h:155
    at zebra/zebra_evpn_neigh.c:447
    at lib/thread.c:1578
    at zebra/main.c:488
]

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
4 years agozebra: fix deletion of evpn mh neigh-holdtime
Don Slice [Thu, 4 Jun 2020 15:23:09 +0000 (15:23 +0000)]
zebra: fix deletion of evpn mh neigh-holdtime

Found that the command "evpn mh neigh-holdtime" can be set but
not deleted.  This fix solves the delete process

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
4 years agozebra: Move debug information gathering to inside guard
Donald Sharp [Wed, 23 Sep 2020 00:47:33 +0000 (20:47 -0400)]
zebra: Move debug information gathering to inside guard

Let's not make the entire `depend_finds` function pay
for the data gathering needed for the debug.  There
are numerous other places in the code that check
the NEXTHOP_FLAG_RECURSIVE and do the same output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agovrf: VRF_DEFAULT must be 0, remove useless code
Christophe Gouault [Mon, 24 Aug 2020 16:01:15 +0000 (18:01 +0200)]
vrf: VRF_DEFAULT must be 0, remove useless code

Code was added in the past to support a value of VRF_DEFAULT different
from 0. This option was abandoned, the default vrf id is always 0.

Remove this code, this will simplify the code and improve performance
(use a constant value instead of a function that performs tests).

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
4 years agozebra: always display vrf in show ip route json
Christophe Gouault [Thu, 20 Aug 2020 09:15:33 +0000 (11:15 +0200)]
zebra: always display vrf in show ip route json

In route json outputs, always display the vrf even if it is the
default vrf.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
4 years agozebra: simplify and optimize vrf display in show ip route
Christophe Gouault [Thu, 20 Aug 2020 09:15:33 +0000 (11:15 +0200)]
zebra: simplify and optimize vrf display in show ip route

In all outputs (text and json): simplify and optimize the vrf name
display, use the vrf_id_to_name() handler.

Note: vrf_id_to_name() has a safeguard system that prevents from
crashing when the vrf cannot be found because it changed in some
(unexpected) manner, it returns "n/a".

Note: "vrf n/a" will now be displayed instead of "vrf UNKNOWN" in this
case, like in most other frr components.

This safeguard was missing for show ip route json, so this
optimization also fixes a potential crash.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
4 years agolib: optimize vrf_id_to_name(VRF_DEFAULT) case
Christophe Gouault [Wed, 26 Aug 2020 14:26:49 +0000 (16:26 +0200)]
lib: optimize vrf_id_to_name(VRF_DEFAULT) case

vrf_id_to_name() looks up in a RB_TREE to find the VRF entry, then
reads the name.

Avoid it for VRF_DEFAULT, which always exists and for which the
translation is straightforward.

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
4 years agozebra: fix show ip route output
Christophe Gouault [Thu, 20 Aug 2020 09:15:33 +0000 (11:15 +0200)]
zebra: fix show ip route output

Variable "show ip route" commands invoke the same helper
(do_show_ip_route), potentially several times.

When asking to dump a non-default vrf, all vrfs or all tables, the
output is messy, the header summarizing abbreviations is repeated
several times, excess line feeds appear, the default table of default
VRF is concatenated to the previous table output...

Normalize the output:

- whatever the case, display the common header at most once, if there
  is at least an entry to dump.

- when using a "vrf all" or "table all" command, prepend a line with
  the VRF and table (even for the default vrf or table).

- when dumping a specific vrf or table, prepend a line with the VRF
  and table.

Example (vrf all)
=================

router# show ip route vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:09
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:09
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:26

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:00:29
C>* 10.125.0.0/24 is directly connected, loop0, 00:00:42

Example (main vrf)
==================

router# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

C>* 10.0.2.0/24 is directly connected, mgmt0, 00:24:41
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:24:41
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:00:58

Example (specific vrf)
======================

router# show ip route vrf private
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF private:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:01:23
C>* 10.125.0.0/24 is directly connected, loop0, 00:01:36

Example (all tables)
====================

router# show ip route table all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:01:51

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:34
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:34
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:01:51

Example (all vrf, all table)
============================

router# show ip route table all vrf all
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:02:15

VRF main table 254:
C>* 10.0.2.0/24 is directly connected, mgmt0, 00:25:58
K>* 10.0.2.2/32 [0/100] is directly connected, mgmt0, 00:25:58
C>* 10.125.0.0/24 is directly connected, ntfp2, 00:02:15

VRF private table 200:
S>* 2.2.2.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18

VRF private table 254:
S>* 1.1.1.0/24 [1/0] via 10.125.0.2, loop0, 00:02:18
C>* 10.125.0.0/24 is directly connected, loop0, 00:02:31

Example (specific table)
========================

router# show ip route table 200
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

VRF main table 200:
S>* 4.4.4.4/32 [1/0] via 10.125.0.3, ntfp2, 00:05:26

Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
4 years agoospfd: do not generate type 4 LSA from NSSA ABR
ckishimo [Thu, 17 Sep 2020 09:51:26 +0000 (02:51 -0700)]
ospfd: do not generate type 4 LSA from NSSA ABR

In a topology like R1 -- R2 -- R5, with R2 being NSSA ABR and R5 being
ASBR redistributing external routes, the ABR R2 will translate type-7
LSA into type-5 and advertise to the backbone. In the current implementation
R2 is also advertising a type-4 LSA when there is no need.

RFC 3101: "...NSSA's border routers never originate Type-4 summary-LSAs
for the NSSA's AS boundary routers, since Type-7 AS-external-LSAs are
never flooded beyond the NSSA's border..."

With this PR a type-4 LSA will not be advertised

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 years agoripd, ripngd: info -> debug
Donald Sharp [Mon, 21 Sep 2020 11:55:36 +0000 (07:55 -0400)]
ripd, ripngd: info -> debug

There are a couple info messages in rip/ripng that really should
be debugs.  Modify code to be so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agolib: don't execute command if pre-processing hook has failed
Igor Ryzhov [Mon, 21 Sep 2020 13:00:33 +0000 (16:00 +0300)]
lib: don't execute command if pre-processing hook has failed

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agolib: fix regcomp error processing
Igor Ryzhov [Mon, 21 Sep 2020 12:35:56 +0000 (15:35 +0300)]
lib: fix regcomp error processing

 * use actual error code instead of "false"
 * add missing new line

Before:
```
nfware# show interface | include (a]
% Regex compilation error: Success% Bad regexp '(a]'
% Unknown command: show interface | include (a]
```

After:
```
nfware# show interface | include (a]
% Regex compilation error: Unmatched ( or \(
% Bad regexp '(a]'
% Unknown command: show interface | include (a]
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agoospfd : Fix for ospf dead interval and hello due.
Kaushik [Sat, 19 Sep 2020 07:29:25 +0000 (00:29 -0700)]
ospfd : Fix for ospf dead interval and hello due.

1. Ospf dead-interval will be set as 4 times of hello-interval, incase
if it is not set by using "ip ospf dead-interval <dead-val>".
2. On resetting hello-interval using "no ip ospf hello-interval" the
dead interval and hello due will be changed accordingly.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
4 years agodoc: clarify python and pip2 for ubuntu 20
Mark Stapp [Mon, 14 Sep 2020 13:52:16 +0000 (09:52 -0400)]
doc: clarify python and pip2 for ubuntu 20

Must run the pip2 install script with python2 on ubuntu 20.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: Add topotest for BGP metric change
Martin Winter [Mon, 14 Sep 2020 19:58:57 +0000 (21:58 +0200)]
tests: Add topotest for BGP metric change

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agodoc: updated user doc for routemap set metric cmd
David Schweizer [Mon, 14 Sep 2020 15:08:50 +0000 (17:08 +0200)]
doc: updated user doc for routemap set metric cmd

Updated the user documentation to reflect changes made to routemaps "set
metric" VTY shell command.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agolib: fix negating set metric route-map command
David Schweizer [Thu, 10 Sep 2020 07:14:58 +0000 (09:14 +0200)]
lib: fix negating set metric route-map command

Changed negating set metric route-map command to be usable in
conjunction with the affirming command.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
4 years agolib: fix the "set metric" route-map command
Renato Westphal [Wed, 9 Sep 2020 16:28:47 +0000 (13:28 -0300)]
lib: fix the "set metric" route-map command

The "set metric" command wasn't processing metric additions and
subtractions (using + and -) correctly. Fix those problems.

Also, remove the "+metric" and "-metric" options since they don't
work and don't make any sense (they could be interpreted as unitary
increments/decrements but that was never supported).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agoospfd : Resolving conflict in distribute-list update during MaxAge LSA.
Kaushik [Thu, 10 Sep 2020 08:58:56 +0000 (01:58 -0700)]
ospfd : Resolving conflict in distribute-list update during MaxAge LSA.

1. Fix for duplicating calls of ospf_external_lsa_refresh()
   in ospf_distribute_list_update_timer().
2. Added the comment and change from PR 6981.

Signed-off-by: Kaushik <kaushik@niralnetworks.com>
4 years agoospfd: flush type 5 when type 7 is removed
ckishimo [Fri, 11 Sep 2020 14:20:29 +0000 (07:20 -0700)]
ospfd: flush type 5 when type 7 is removed

When the ASBR stops announcing a prefix into the NSSA area, the LSA
type 7 is removed from the area. However the ABR is refreshing the
type 5 in its LSDB while removing the Type 7 LSA. Routers outside
the area do not get an update.

With this change the LSA type 5 is flushed from the LSDB and the
change is announced to routers outside the area

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 years agoospfd: fix debug ospf nssa prints wrong info
ckishimo [Thu, 10 Sep 2020 19:20:44 +0000 (12:20 -0700)]
ospfd: fix debug ospf nssa prints wrong info

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
4 years agolib: Remove debug associated with vrf_get
Donald Sharp [Fri, 18 Sep 2020 11:14:55 +0000 (07:14 -0400)]
lib: Remove debug associated with vrf_get

The vrf_get function is called throughout the code base
so much so that when you turn on vrf debugging it eclipses
everything else to a degree that is completely unreasonable.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agolib: Add vrf name to vrf debugs
Donald Sharp [Fri, 18 Sep 2020 00:17:14 +0000 (20:17 -0400)]
lib: Add vrf name to vrf debugs

The vrf name was not being printed out in some vrf debugs.  Add
this data in so people don't have to remember the vrf id.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agolib: Actually call nexthop_group_disable_vrf
Donald Sharp [Fri, 18 Sep 2020 00:13:44 +0000 (20:13 -0400)]
lib: Actually call nexthop_group_disable_vrf

When the nexthop-groups were added to FRR for some
reason the call to nexthop_group_disable_vrf was
not added although it was written.

Add it in.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agotools: fix vtysh failure error handling
Quentin Young [Thu, 17 Sep 2020 19:46:55 +0000 (15:46 -0400)]
tools: fix vtysh failure error handling

Based on the current code, I think the intent was to gracefully handle
vtysh failures and print a useful error message. Barriers in the way of
that:

- Despite reading the results of subprocess.communicate(), there won't
  be anything there, because we aren't passing subprocess.PIPE as stdin
  and stderr when calling subprocess.Popen()
- Despite catching subprocess.TimeoutExpired, if we were to actually hit
  this case frr-reload.py would just crash because it's calling
  .communicate() on an unbound process variable, probably a copy-paste
  error
- Aside from that, building a kwargs dict to pass to a function that
  contains something if something else is not None and nothing if it is,
  is pointless when we could just pass the thing itself

Net result is that if vtysh fails to read an frr.conf due to syntax
errors, instead of crashing with a traceback, we actually handle the
error condition, log the problem and vtysh's output, and exit. Actually
we were printing the failed line just by chance because stderr wasn't
captured from the subprocess and I guess showed up as part of systemd's
error capturing or something, but the traceback did a good job of
obscuring that with useless noise.

Old:

frrinit.sh[32183]:  * Started watchfrr
frrinit.sh[32183]: line 20: % Unknown command: eee
frrinit.sh[32183]: Traceback (most recent call last):
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 1316, in <module>
frrinit.sh[32183]:     newconf.load_from_file(args.filename)
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 231, in load_from_file
frrinit.sh[32183]:     file_output = self.vtysh.mark_file(filename)
frrinit.sh[32183]:   File "/usr/lib/frr/frr-reload.py", line 146, in mark_file
frrinit.sh[32183]:     % (child.returncode, stderr))
frrinit.sh[32183]: __main__.VtyshException: vtysh (mark file) exited with status 2:
frrinit.sh[32183]: None

New:

frrinit.sh[30090]:  * Started watchfrr
frrinit.sh[30090]: vtysh failed to process new configuration: vtysh (mark file) exited with status 2:
frrinit.sh[30090]: line 20: % Unknown command: eee

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agobgpd: Avoid memset when tip hash is empty
Donald Sharp [Wed, 16 Sep 2020 21:48:15 +0000 (17:48 -0400)]
bgpd: Avoid memset when tip hash is empty

The tip hash is only used when we are dealing with
evpn.  In bgp_nexthop_self we are doing a memset
irrelevant of whether we will ever find data.  Yes
hash_lookup will return pretty quickly.

Modify the code to avoid doing a memset in the case
where the tip hash is empty as that we know we'll
never find anything.  With full BGP feeds this
small memset does take some time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd: remove extra hold-timer reset
Quentin Young [Wed, 16 Sep 2020 00:15:08 +0000 (20:15 -0400)]
bgpd: remove extra hold-timer reset

Handler function doesn't need to reset the hold timer, this is done
during the FSM update.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
4 years agolib: simplify handling of the sysrepo startup configuration
Renato Westphal [Sat, 12 Sep 2020 01:39:50 +0000 (22:39 -0300)]
lib: simplify handling of the sysrepo startup configuration

In the new Sysrepo, all SR_EV_ENABLED notifications are followed by
SR_EV_DONE notifications (assuming no errors occur), so there's no
need to special case the SR_EV_ENABLED event anymore (e.g. do full
transactions in one step).

While here, add a few more guarded debug messages to facilitate
troubleshooting.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agolib: fix handling of deleted nodes in the sysrepo plugin
Renato Westphal [Sat, 12 Sep 2020 01:39:35 +0000 (22:39 -0300)]
lib: fix handling of deleted nodes in the sysrepo plugin

Make the sysrepo plugin ignore the deletion of configuration
nodes that don't exist anymore instead of logging an error and
rejecting the changes. This is necessary because Sysrepo delivers
delete notifications for all nodes of a deleted data tree instead
of delivering a single delete notification of the top-level subtree
node (which would suffice for the northbound layer).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agolib: postpone the sysrepo plugin initialization
Renato Westphal [Sat, 12 Sep 2020 01:39:11 +0000 (22:39 -0300)]
lib: postpone the sysrepo plugin initialization

From Sysrepo's documentation:
"Note: do not use fork() after creating a connection. Sysrepo
internally stores PID of every created connection and this way a
mismatch of PID and connection is created".

Introduce a new "frr_very_late_init" hook in libfrr that is only
called after the daemon is forked (when the '-d' option is used)
and after the configuration is read. This way we can initialize
the sysrepo plugin correctly even when the daemon is daemonized,
and after the Sysrepo CLI commands are processed (only "debug
northbound client sysrepo" for now).

Fixes #7062

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agoisisd: fix pseudonode LSP bug
Emanuele Di Pascale [Fri, 11 Sep 2020 09:07:37 +0000 (11:07 +0200)]
isisd: fix pseudonode LSP bug

Currently, when the is-type of an area is changed and its circuits resign,
we are not resetting the DIS flag. Consequently, if the area type is reverted
we are not running the DR election and not regenerating the pseudonode LSP.

Also adding event debug logs for circuit commence/resign.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
4 years agobgpd: correct community-list replace logic
Don Slice [Thu, 10 Sep 2020 12:40:28 +0000 (12:40 +0000)]
bgpd: correct community-list replace logic

Problem rerported that if you enter an existing community list
sequence number with new community information, the entire community
list would be deleted.  This commit fixes the replace logic to do
the right thing.

Ticket: CM-30555
Signed-off-by: Don Slice <dslice@nvidia.com>
4 years agopbrd: Ensure rule is installed on interface up
Donald Sharp [Fri, 11 Sep 2020 17:05:55 +0000 (13:05 -0400)]
pbrd: Ensure rule is installed on interface up

If we are experiencing an interface that is bouncing
very fast and the last operation that we experienced
was a ifdown we will send rule deletions associated
with that interface.  If we have not received notification
that hte rule was removed *but* we immiedately get another
ifup notification when we go to install the rule we
are deciding that it's not ready to send down again,
as that we still think it is installed.

Force the rule installation when we have a interface up
event.

Ticket: CM-31042
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgpd, lib, pbrd, zebra: Pass by ifname
Donald Sharp [Thu, 10 Sep 2020 15:31:39 +0000 (11:31 -0400)]
bgpd, lib, pbrd, zebra: Pass by ifname

When installing rules pass by the interface name across
zapi.

This is being changed because we have a situation where
if you quickly create/destroy ephermeal interfaces under
linux the upper level protocol may be trying to add
a rule for a interface that does not quite exist
at the moment.  Since ip rules actually want the
interface name ( to handle just this sort of situation )
convert over to passing the interface name and storing
it and using it in zebra.

Ticket: CM-31042
Signed-off-by: Stephen Worley <sworley@nvidia.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agodoc: fix rpm link under libyang help
Stephen Worley [Fri, 11 Sep 2020 18:11:48 +0000 (14:11 -0400)]
doc: fix rpm link under libyang help

Fix the rpm link under libyang help. The link was assuming
it was local without the https.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agolib: fix crashes with leafrefs that point to non-implemented modules
Renato Westphal [Fri, 11 Sep 2020 13:43:49 +0000 (10:43 -0300)]
lib: fix crashes with leafrefs that point to non-implemented modules

Whenever libyang loads a module that contains a leafref, it will
also implicitly load the module of the referring node if it's
not loaded already. That makes sense as otherwise it wouldn't be
possible to validate the leafref value correctly.

The problem is that loading a module implicitly violates the
assumption of the northbound layer that all loaded modules
are implemented (i.e. they have a northbound node associated
to each schema node). This means that loading a module that
isn't implemented can lead to crashes as the "priv" pointer
of schema nodes is no longer guaranteed to be valid. To fix this
problem, add a few null checks to ignore data nodes associated
to non-implemented modules.

The side effect of this change is harmless. If a daemon receives
configuration it doesn't support (e.g. BFD peers on staticd),
that configuration will be stored but otherwise ignored. This can
only happen when using a northbound client like gRPC, as the CLI
will never send to a daemon a command it doesn't support. This
minor problem should go away in the long run as FRR migrates to
a centralized management model, at which point the YANG-modeled
configuration of all daemons will be maintained in a single place.

Finally, update some daemons to stop implementing YANG modules
they don't need to (i.e. revert 1b741a01c and a74b47f5).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agopimd: Warn when we try to build MAXVIFS > 256
Donald Sharp [Fri, 11 Sep 2020 12:27:28 +0000 (08:27 -0400)]
pimd: Warn when we try to build MAXVIFS > 256

We use the pim mroute socket for kernel notifications of events.
Currently this is limited to 8 bits of data.  There are patches
coming down the pike in kernel land to allow this to expand.
Rather than fix this and all the other places we assume MAXVIFS < 256
in the pim code right now.  Leave a land mine for the developer
doing this work to point them in the right direction.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoisisd: ifp cannot be NULL
Donald Sharp [Fri, 11 Sep 2020 18:30:24 +0000 (14:30 -0400)]
isisd: ifp cannot be NULL

the ifp pointer cannot be NULL when we get to this point
in the code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
4 years agostaticd: fix display of the "nexthop-vrf" parameter of static routes
Renato Westphal [Fri, 11 Sep 2020 00:27:48 +0000 (21:27 -0300)]
staticd: fix display of the "nexthop-vrf" parameter of static routes

When the static route VRF and its nexthop VRF are inactive in the
kernel, both VRFs will have the same ID (VRF_UNKNOWN) even though
they might not be the same. This can cause "sh run" to not display
the "nexthop-vrf" parameter correctly when necessary. Change the
code to compare VRFs by their names to fix this problem.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agostaticd: remove checks that are no longer necessary
Renato Westphal [Thu, 10 Sep 2020 21:45:42 +0000 (18:45 -0300)]
staticd: remove checks that are no longer necessary

All call sites of static_route_leak() are passing a non-null pointer
to the 'vty' parameter, hence remove the 'vty' null checks that
are no longer necessary.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
4 years agozebra: Solve the problem of high CPU and memory usage when creating thousands of vrf
liuze [Wed, 26 Aug 2020 09:41:29 +0000 (17:41 +0800)]
zebra: Solve the problem of high CPU and memory usage when creating thousands of vrf

Signed-off-by: liuze <liuze@asterfusion.com>
4 years agodoc: add blurb for rpm package server in overview
Stephen Worley [Thu, 10 Sep 2020 21:16:11 +0000 (17:16 -0400)]
doc: add blurb for rpm package server in overview

Add a blurb about the rpm package server in the overview page
so its easier to know where it is. Should be with the debian
one anyway.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
4 years agoMerge pull request #7231 from idryzhov/7.5-topotest-fixes
Martin Winter [Mon, 5 Oct 2020 21:27:25 +0000 (23:27 +0200)]
Merge pull request #7231 from idryzhov/7.5-topotest-fixes

[7.5] backport topotest fixes

4 years agotests: Skip comparing neighbor-extended-circuit-id in yang output. They are not consi... 7231/head
Martin Winter [Fri, 2 Oct 2020 20:07:25 +0000 (22:07 +0200)]
tests: Skip comparing neighbor-extended-circuit-id in yang output. They are not consistent

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agotests: don't compare internal vrfId in topotests
Igor Ryzhov [Fri, 2 Oct 2020 08:24:16 +0000 (11:24 +0300)]
tests: don't compare internal vrfId in topotests

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
4 years agotests: Topotest fixes to skip comparing InterfaceIndex and Internal status in json_cmp
Martin Winter [Thu, 1 Oct 2020 19:33:55 +0000 (21:33 +0200)]
tests: Topotest fixes to skip comparing InterfaceIndex and Internal status in json_cmp

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
4 years agotests: fix typos in zebra_rib and _netlink
Mark Stapp [Thu, 1 Oct 2020 18:17:06 +0000 (14:17 -0400)]
tests: fix typos in zebra_rib and _netlink

Fix a couple of typos in the zebra_rib and _netlink topotest
suites.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: fix regex in all_proto test
Mark Stapp [Thu, 1 Oct 2020 14:21:03 +0000 (10:21 -0400)]
tests: fix regex in all_proto test

Make sure the all-protocols test_isis_interfaces testcase uses
a regex substitution that includes all the hex characters.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agotests: Kernel version check for topojson scripts.
naveen [Wed, 12 Aug 2020 05:45:57 +0000 (11:15 +0530)]
tests: Kernel version check for topojson scripts.

1. Added linux kernel version check to avoid failures
in CI systems if matching kernel version not found.

Signed-off-by: naveen <nguggarigoud@vmware.com>
4 years agoMerge pull request #7207 from deastoe/zebra-fpm-blackhole-abort_7.5
Rafael Zalamena [Wed, 30 Sep 2020 12:39:35 +0000 (09:39 -0300)]
Merge pull request #7207 from deastoe/zebra-fpm-blackhole-abort_7.5

[7.5] zebra: fix FPM abort for unreach/prohibit routes

4 years agozebra: fix FPM abort for unreach/prohibit routes 7207/head
Duncan Eastoe [Mon, 28 Sep 2020 11:51:19 +0000 (12:51 +0100)]
zebra: fix FPM abort for unreach/prohibit routes

b0e9567ed162da708f8d0b3a3caf87cd03b62e96 fixed an issue whereby
zebra would abort while building an update for a blackhole route.

The same issue, `assert(data_len)` failing in
`zfpm_build_route_updates()`, can be observed when building updates
for unreachable and prohibit routes.

To address this `netlink_route_info_fill()` is updated to not
indicate failure, due to lack of nexthops, for any blackhole routes.

Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
(cherry picked from commit 94f7786375030e08063cdae5b4577edf26adb456)

4 years agoMerge pull request #7190 from ton31337/feature/bgpd_cherry_picks
Donald Sharp [Mon, 28 Sep 2020 12:59:02 +0000 (08:59 -0400)]
Merge pull request #7190 from ton31337/feature/bgpd_cherry_picks

bgpd: [7.5] timers, static routes, router-id backports

4 years agobgpd: allow derived router-id update if previously 0x0 7190/head
Don Slice [Tue, 22 Sep 2020 13:14:52 +0000 (06:14 -0700)]
bgpd: allow derived router-id update if previously 0x0

Problem found that if a router-id was not defined or derived
initially, the bgp->router_id would be set to 0x0 and used
for determining auto-rd values. When bgp received a subsequent
router-id update from zebra, bgp would not completely process
the update since it was treated as updating an already derived
router-id with a new value, which is not desired.  This also
could leave the auto rd/rt inforamation missing or invalid in
some cases.  This fix allows updating the derived router-id if
the previous value was 0/0.

Ticket: CM-31441
Signed-off-by: Don Slice <dslice@nvidia.com>
4 years agobgpd: Use bgp instance's default keepalive interval if < (holdtime/3)
Trey Aspelund [Wed, 23 Sep 2020 18:16:50 +0000 (14:16 -0400)]
bgpd: Use bgp instance's default keepalive interval if < (holdtime/3)

bgp->default_keepalive was not considered when setting
peer->v_keepalive, causing the effective keepalive interval to
always be (holdtime/3), even when default_keepalive < (holdtime/3).
This ensures that the default_keepalive is used when it's set and
is < (holdtime/3).

Signed-off-by: Trey Aspelund <taspelund@cumulusnetworks.com>
(cherry picked from commit d8bf8c6128f2e493d473148213bd663a500c7f73)

4 years agobgpd: Allow bgp static routes to use /32's
Donald Sharp [Fri, 25 Sep 2020 13:45:24 +0000 (09:45 -0400)]
bgpd: Allow bgp static routes to use /32's

If you are including a network statement of a /32
then the current bgp martian checks will match the /32
together.

Problem:
!
router bgp 3235
 neighbor 192.168.161.2 remote-as external
 neighbor 192.168.161.131 remote-as external
 !
 address-family ipv4 unicast
  network 10.10.3.11/32
  network 192.168.161.0/24
  no neighbor 192.168.161.2 activate
  neighbor 192.168.161.2 route-map BLUE in
 exit-address-family
!
eva# show bgp ipv4 uni
BGP table version is 1, local router ID is 10.10.3.11, vrf id 0
Default local pref 100, local AS 3235
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
   10.10.3.11/32    0.0.0.0(eva)             0         32768 i
*> 192.168.161.0/24 0.0.0.0(eva)             0         32768 i
Displayed  2 routes and 2 total paths
eva# show bgp import-check-table
Current BGP import check cache:
 192.168.161.0 valid [IGP metric 0], #paths 1
  if enp39s0
  Last update: Fri Sep 25 08:00:42 2020
 10.10.3.11 valid [IGP metric 0], #paths 1
  if lo
  Last update: Fri Sep 25 08:00:42 2020
eva# show bgp ipv4 uni summ
BGP router identifier 10.10.3.11, local AS number 3235 vrf-id 0
BGP table version 1
RIB entries 3, using 576 bytes of memory
Peers 1, using 21 KiB of memory
Neighbor                 V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
janelle(192.168.161.131) 4      60000        69        70        0    0    0 00:03:21            0        1
Total number of neighbors 1

When we are deciding that a nexthop is valid there is not much point in checking
that a static route has a martian nexthop or not, since we self derived it already.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agoMerge pull request #7140 from pguibert6WIND/netns_refactor_v75
Donald Sharp [Wed, 23 Sep 2020 20:26:22 +0000 (16:26 -0400)]
Merge pull request #7140 from pguibert6WIND/netns_refactor_v75

Netns refactor v75

4 years agoMerge pull request #7161 from mjstapp/fix_topo_daemons_list_7_5
Stephen Worley [Wed, 23 Sep 2020 18:47:46 +0000 (14:47 -0400)]
Merge pull request #7161 from mjstapp/fix_topo_daemons_list_7_5

[7.5] tests: fix bug in handling of daemons to start

4 years agotests: fix bug in handling of daemons to start 7161/head
Mark Stapp [Wed, 23 Sep 2020 12:48:25 +0000 (08:48 -0400)]
tests: fix bug in handling of daemons to start

Ensure the list of daemons to start is either the one specified
by a caller or the default one from the router configuration.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
4 years agozebra: fix fd going out of scope leaks the handle 7140/head
Philippe Guibert [Tue, 22 Sep 2020 12:17:15 +0000 (14:17 +0200)]
zebra: fix fd going out of scope leaks the handle

the file descriptor is closed if it has been locally created.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agoMerge pull request #7151 from donaldsharp/7.5_bsd_address
Mark Stapp [Tue, 22 Sep 2020 16:30:32 +0000 (12:30 -0400)]
Merge pull request #7151 from donaldsharp/7.5_bsd_address

zebra: Allow FreeBSD to set and delete addresses from an interface

4 years agozebra: Allow FreeBSD to set and delete addresses from an interface 7151/head
Donald Sharp [Mon, 21 Sep 2020 00:21:41 +0000 (20:21 -0400)]
zebra: Allow FreeBSD to set and delete addresses from an interface

This series of events:

$ sudo ifconfig lo0 add 4.4.4.4/32
$ sudo ifconfig lo0 inet 4.4.4.4/32 delete

would end up leaving the 4.4.4.4/32 address on the interface under
freebsd.

This all boils down to the fact that the interface is not
considered connected yet we have a destination.  If the
destination is the same and we are not connected ignore
it on freebsd.

I am sure there are other fun scenarios that someone
will have to squirrel out.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
4 years agobgp: remove duplicate command installs
Pat Ruddy [Wed, 10 Jun 2020 13:39:37 +0000 (14:39 +0100)]
bgp: remove duplicate command installs

[no_]neighbor_nexthop_self_cmd & [no_]neighbor_nexthop_self_force_cmd
have duplicate install_element actions on the EVPN_NODE. This causes
duplicate command log errors which are caught by topotests. Remove
these.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
4 years agotest: topotest bgp_evpn_rt5 runs on kernel > 4.18
Philippe Guibert [Tue, 9 Jun 2020 14:49:51 +0000 (16:49 +0200)]
test: topotest bgp_evpn_rt5 runs on kernel > 4.18

if kernel is less than 4.18, then test will not run.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agotopotests: bgp_evpn_rt5 test uses ip link instead of bridge-utils
Philippe Guibert [Fri, 5 Jun 2020 13:59:43 +0000 (15:59 +0200)]
topotests: bgp_evpn_rt5 test uses ip link instead of bridge-utils

bridge-utils package is not available on tested distributions.
use ip link instead.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agotopotests: add bgp_evpn_rt5 test with vrf netns backend
Philippe Guibert [Tue, 3 Mar 2020 09:45:34 +0000 (10:45 +0100)]
topotests: add bgp_evpn_rt5 test with vrf netns backend

this test checks connectivity between a vrf-lite device and a vrf-netns
device. this ensures that evpn serice is importing appropriate evpn rt5
entries in the correct vrf.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agozebra: support for macvlan interfaces
Philippe Guibert [Thu, 6 Feb 2020 08:33:21 +0000 (09:33 +0100)]
zebra: support for macvlan interfaces

mac vlan interfaces are supported in different network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agodoc: add some documentation about bgp evpn netns support
Philippe Guibert [Sat, 15 Aug 2020 14:54:26 +0000 (07:54 -0700)]
doc: add some documentation about bgp evpn netns support

a linux configuration gives some explanation on how to set up an evpn
overlay in network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agozebra: dynamically detect vxlan link interfaces in other netns
Philippe Guibert [Mon, 6 Jan 2020 16:39:17 +0000 (17:39 +0100)]
zebra: dynamically detect vxlan link interfaces in other netns

this is used when parsing the newly network namespaces. actually, to
track the link of some interfaces like vxlan interfaces, both link index
and link nsid are necessary. if a vxlan interface is moved to a new
netns, the link information is in the default network namespace, then
LINK_NSID is the value of the netns by default in the new netns. That
value of the default netns in the new netns is not known, because the
system does not automatically assign an NSID of default network
namespace in the new netns. Now a new NSID of default netns, seen from
that new netns, is created. This permits to store at netns creation the
default netns relative value for further usage.
Because the default netns value is set from the new netns perspective,
it is not needed anymore to use the NETNSA_TARGET_NSID attribute only
available in recent kernels.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agobgpd: sanity check when updating nexthop from bgp to zebra
Philippe Guibert [Fri, 3 Jan 2020 18:03:18 +0000 (19:03 +0100)]
bgpd: sanity check when updating nexthop from bgp to zebra

nexthop may sometimes not be passed through zebra, like for onlink
messages.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agolib, zebra: reuse and adapt ns_list walk functionality
Philippe Guibert [Fri, 20 Dec 2019 16:51:37 +0000 (17:51 +0100)]
lib, zebra: reuse and adapt ns_list walk functionality

the walk routine is used by vxlan service to identify some contexts in
each specific network namespace, when vrf netns backend is used. that
walk mechanism is extended with some additional paramters to the walk
routine.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agozebra: local mac entries populated in correct netnamespace
Philippe Guibert [Mon, 28 Oct 2019 11:02:17 +0000 (12:02 +0100)]
zebra: local mac entries populated in correct netnamespace

MAC address neighbours are read on the same netnamespace where the vxlan
interface is.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
4 years agozebra: when parsing local entry against dad, retrieve config
Philippe Guibert [Fri, 25 Oct 2019 12:25:00 +0000 (14:25 +0200)]
zebra: when parsing local entry against dad, retrieve config

when duplicate address detection is observed, some incrementation,
some timing mechanisms need to be done. For that the main evpn
configuration is retrieved. Until now, the VRF that was storing the dad
config parameters was the same VRF that hosted the VXLAN interface. With
netns backend, this is not true, as the VXLAN interface is in the
same VRF as the bridge interface. The modification takes same definition
as in BGP, that is to say that there is a single bgp evpn instance, and
this is that instance that will give the correct config settings.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>