zebra: allocate one nexthop id per-VTEP instead of one per-ES-VTEP
This is an optimization to reduce the number of L2 nexthops. A
l2 or fdb nexthop simply provides the dataplane with a nexthop ip-
torm-12:mgmt:~# ip nexthop
id 268435461 via 27.0.0.20 scope link fdb
id 268435463 via 27.0.0.20 scope link fdb
id 268435465 via 27.0.0.20 scope link fdb
So there is no need to allocate a nexthop per-ES/per-VTEP. There
can be 100+ ESs per-VTEP so this change cuts the scale down by a
factor of 100.
zebra: support for slow-failover of local MACs on an ES
When a local ES flaps there are two modes in which the local
MACs are failed over -
1. Fast failover - A backup NHG (ES-peer group) is programmed in the
dataplane per-access port. When a local ES flaps the MAC entries
are left unaltered i.e. pointing to the down access port. And the
dataplane redirects traffic destined to the oper-down access port
via the backup NHG.
2. Slow failover - This mode needs to be turned on to allow dataplanes
not capable of re-directing traffic. In this mode local MAC entries
on a down local ES are re-programmed to point to the ES-peers'
NHG. And vice-versa i.e. when the ES comes up the MAC entries
are re-programmed with the access port as dest.
Fast failover is on by default. Slow failover can be enabled via the
following config -
evpn mh redirect-off
zebra: on local mac add from the dplane a re-install maybe need as static
As a part of extended MM handing a MAC can be updated from local
to remote while being referenced by SYNC neighs (this is really a
temporary/small window). During this window if the MAC transitions
back to local again we need to re-inforce the previous SYNC flags
(based on the sync-neigh count) as subsequent SYNC updates to the
MAC will be de-duped and ignored.
zebra: set inactive bit when zebra re-installs the MAC on dplane del
When a local mac is deleted by the dataplane zebra can re-install it
if the MAC is a SYNC MAC (learned from ES peers). The "local_inactive"
bit must be set as a part of the re-install to prevent zebra turning
around and advertising the MAC as locally active.
Also fixed up some debug logs in the slow-fail path to include the VNI.
zebra: remove FDB entries before de-activating a L2-NHG
NHG is activated i.e. programmed in the dataplane only if there
are active-VTEPs associated with it. When a NHG is de-activated
all the remote-mac entries associated with it need to be removed
before the NHG is removed.
Donald Sharp [Tue, 1 Dec 2020 12:57:45 +0000 (07:57 -0500)]
pimd: Remove pim_version.c it is never used
The pim_version.[c|h] files are never used and we are getting
warnings about PIM_VERSION changing pointer sizes from
newer versions of the compiler. I see no reason to keep this
Javier Garcia [Tue, 1 Dec 2020 11:28:39 +0000 (12:28 +0100)]
tools: Fix run folder permissions
In the case of some linux distros the /var/run dir is mounted
with tmpfs so in every reboot it's removed.
Then the frrcommon.sh will recreate it without 'x' perm
So no pid file cannot be created in /var/run/frr
Rafael Zalamena [Tue, 1 Dec 2020 11:01:37 +0000 (08:01 -0300)]
bfdd: session specific command type checks
Replace the unclear error message:
```
% Failed to edit configuration.
YANG error(s):
Schema node not found.
YANG path: /frr-bfdd:bfdd/bfd/sessions/single-hop[dest-addr='192.168.253.6'][interface=''][vrf='default']/minimum-ttl
```
With:
```
frr(config-bfd-peer)# minimum-ttl 250
% Minimum TTL is only available for multi hop sessions.
! or
frr(config-bfd-peer)# echo
% Echo mode is only available for single hop sessions.
frr(config-bfd-peer)# echo-interval 300
% Echo mode is only available for single hop sessions.
```
Reported-by: Trae Santiago Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Igor Ryzhov [Mon, 30 Nov 2020 15:50:51 +0000 (18:50 +0300)]
vtysh: fix incorrect memory statistics
As code comment states, 1 count of MTYPE_COMPLETION is leaked for each
autocompleted token. Let's manually decrement the counter before passing
the pointer to readline.
Pat Ruddy [Wed, 25 Nov 2020 10:18:45 +0000 (10:18 +0000)]
bgpd: correctly store allocated ES struct
in the rare situation where we allocate the ES during the path link
we fail to check/store the allocated ES pointer thus leading to a
NULL dereference later in the function.
Philippe Guibert [Tue, 24 Nov 2020 13:10:16 +0000 (13:10 +0000)]
topotests: precise importation folder
the topolog importation folder must be precised. otherwise following
error message appears:
root@dut-vm:~/topotests/bgp_flowspec# python3 test_bgp_flowspec_topo.py
Traceback (most recent call last):
File "test_bgp_flowspec_topo.py", line 96, in <module>
from lib.lutil import lUtil
File "/root/topotests/bgp_flowspec/../lib/lutil.py", line 25, in <module>
from topolog import logger
ImportError: No module named 'topolog'
root@dut-vm:~/topotests/bgp_flowspec#
The same error occurs with lutil and bgprib which are 2 libraries
located under lib/ folder. Some precisions are added too.
PR=71290 Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Donald Sharp [Wed, 25 Nov 2020 14:49:28 +0000 (09:49 -0500)]
ospfd: Prevent crash by accessing memory not owned.
When allocating memory for the `struct ospf_metric` we
were using `uint32_t` instead of the actual size of this
structure. When we wrote to it we would be writing
into other people's memory.
Found-by: Amol Lad Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Two L3 next groups are installed per-VRF per-ES for v4 and v6. These
NHGs are used as an indirect destination for symmetric IRB host routes.
Using L3NHGs allows for efficient failover of an ES (similar to the
use of L2NHGs) i.e. when an ES goes down the number of dataplane
updates are limited to 2xN (where N is the number of tenant VRFs
associated with the ES) instead of updating all host-routes behind the
ES.
zebra: change the nhg format from hex to dec for easy match up with the dp
Dataplane/kernel prints the NHG and NH ids as decimal. Zebra
was printing it as hex (to display type vs. val). This became a
debugging hassle hence normalizing the format.
1. MAC-IP routes in the VPN routing table are linked to the
destination ES for efficient handling for remote ES link flaps.
2. Only MAC-IP paths whose nexthops are active (added via EAD-ES)
are imported into the VRF routing table.
bgpd: L3NHG infrastructure for host routes in EVPN
ES-VRF entries are maintained for the purpose of L3-NHG creation -
1. Each ES-EVI entry is associated with a tenant VRF. This associaton
triggers the creation of an ES-VRF entry.
2. Type-2/MAC-IP routes are imported into a tenant VRF and programmed as
a /32 or host route entry in the dataplane. If the destination of
the host route is a remote-ES the route is programmed with the
corresponding (keyed in by {vrf,ES-id}) L3-NHG.
3. The reason for this indirection (route->L3-NHG, L3-NHG->list-of-VTEPs)
is to avoid route updates to the dplane when a remote-ES link flaps i.e.
instead of updating all the dependent routes the NHG's contents are
updated. This reduces the amount of dataplane updates (fewer nhg updates vs.
route updates) allowing for a faster failover.
Renato Westphal [Fri, 20 Nov 2020 03:54:41 +0000 (00:54 -0300)]
isisd, tests: fix bug when sending TI-LFA repair paths to zebra
Commit 4c75f7c7730220b fixed a bug in which the TI-LFA repair paths
weren't preserving the original Prefix-SID of the routes. That
commit, however, didn't update the zebra interface code to account
for backup nexthops that don't have a repair list but do have a
SR label. As a consequence, backup nexthops that didn't have any
repair label were not preserving the original Prefix-SID of the
corresponding routes. Fix this and update the TI-LFA topotest
accordingly.
Renato Westphal [Fri, 20 Nov 2020 22:26:45 +0000 (19:26 -0300)]
isisd: check vertex type before checking its data
vertex->N is an union whose "id" and "ip" fields are only valid
depending on the vertex type (IS adjacency or IP reachability
information). As such, add a vertex type check before consulting
vertex->N.id in order to prevent unexpected behavior from happening.
Renato Westphal [Fri, 6 Nov 2020 13:02:16 +0000 (10:02 -0300)]
isisd: fix some crashes with --tcli
The "ifp" variable returned by nb_running_get_entry() might be
NULL when using the transactional CLI mode. Make the required
modifications to avoid null pointer dereferences.
Renato Westphal [Thu, 5 Nov 2020 12:40:26 +0000 (09:40 -0300)]
isisd: uninstall local routes that don't have any valid nexthop
Once the remote end of a connected link is shut down (or lose
its address), isisd will remove the corresponding route from its
RIB after SPF runs. A new route for the same destination should
be computed based on the local LSP, and that route by definition
doesn't have any nexthop. The problem is that, when isisd tries
to replace the old route by the new one, it fails because routes
without nexthops can't be installed. That causes the old invalid
route to remain in the RIB when it shouldn't. To fix this problem,
change the zebra interface code to uninstall a route whenever it
can't be installed (because it lacks nexthops) instead of doing
nothing in that case.
This change should fix occasional failures of the test_isis_sr_topo1
topotest.
ckishimo [Fri, 20 Nov 2020 21:53:20 +0000 (13:53 -0800)]
ospfd: fix NSSA translate-always
When an ABR NSSA router is configured to be ALWAYS the translator:
r22(config-router)# area 1 nssa translate-always
It will advertise this condition in the type-1 LSA setting the Nt
bit, taking over the translator role from r33
r22# show ip ospf
We are an ABR and always an NSSA Translator.
r33# show ip ospf
We are an ABR, but not the NSSA Elected Translator.
However when the command above is removed:
r22(config-router)# no area 1 nssa translate-always
the bit Nt needs to be cleared otherwise we end up with no translator
in the area
r22# show ip ospf
We are an ABR, but not the NSSA Elected Translator.
r33# show ip ospf
We are an ABR, but not the NSSA Elected Translator.
This PR forces the ABR to send a type-1 LSA with the Nt bit updated
according to the translator role
Donald Sharp [Fri, 20 Nov 2020 13:00:08 +0000 (08:00 -0500)]
bgpd: Remove restriction on certain connection types under HAVE_CUMULUS
Current code when we are establishing a peering relationship when
under the HAVE_CUMULUS block will dissallow v4/v6 connections if
we do not have v4/v6 addresses applied. This restriction is
a bit harsh and should be allowed but warned against.