Commit Graph

32 Commits

Author SHA1 Message Date
David Lamparter
224ccf29d9 zebra: kill zebra_memory.h, use MTYPE_STATIC
This one also needed a bit of shuffling around, but MTYPE_RE is the only
one left used across file boundaries now.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 20:02:17 +01:00
David Lamparter
ef7b8be459 zebra: use printfrr exts in EVPN/VXLAN code
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14 22:56:07 +01:00
Anuradha Karuppiah
8e1337c5dd zebra: del/add remote mac if there is a change from es->non-es dst and vicevera
This is needed as kernel currently doesn't allow a mac replace if the dst
changes from a L2NHG to a single-VTEP and viceversa.

Ticket: CM-31561

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-24 08:11:26 -08:00
Anuradha Karuppiah
8b07f173e8 zebra: link local MACs to destination port for efficient lacp-bypass processing
When an ES-bond comes out of bypass FRR needs to flush the local MACs learnt
while the bond was in bypass. To do that efficiently local MACs are linked
to the dest-access port. This only happens if the access-port is in
LACP-bypass or if it is non-ES.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-24 08:11:24 -08:00
Anuradha Karuppiah
00a7710c25 zebra: support for lacp bypass with EVPN MH
Feature overview:
=================
A 802.3ad bond can be setup to allow lacp-bypass. This is done to enable
servers to pxe boot without a LACP license i.e. allows the bond to go oper
up (with a single link) without LACP converging.

If an ES-bond is oper-up in an "LACP-bypass" state MH treats it as a non-ES
bond. This involves the following special handling -
1. If the bond is in a bypass-state the associated ES is placed in a
bypass state.
2. If an ES is in a bypass state -
a. DF election is disabled (i.e. assumed DF)
b. SPH filter is not installed.
3. MACs learnt via the host bond are advertised with a zero ESI.
When the ES moves out of "bypass" the MACs are moved from a zero-ESI to
the correct non-zero id. This is treated as a local station move.

Implementation:
===============
When (a) an ES is detached from a hostbond or (b) an ES-bond goes into
LACP bypass zebra deletes all the local macs (with that ES as destination)
in the kernel and its local db. BGP re-sends any imported MAC-IP routes
that may exist with this ES destination as remote routes i.e. zebra can
end up programming a MAC that was perviously local as remote pointing
to a VTEP-ECMP group.

When an ES is attached to a hostbond or an ES-bond goes
LACP-up (out of bypss) zebra again deletes all the local macs in the
kernel and its local db. At this point BGP resends any imported MAC-IP
routes that may exist with this ES destination as sync routes i.e.
zebra can end up programming a MAC that was perviously remote
as local pointing to an access port.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-24 08:09:33 -08:00
Anuradha Karuppiah
e4c3ece6e0 zebra: fix problem with SVI MAC not being sent to BGP
For MH the SVI MAC is advertised to prevent flooding of ARP replies.
But because of a bug the SVI MAC was being added to the zebra database
but not sent to bgpd for advertising.

Ticket: CM-33329

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-02-19 08:11:15 -08:00
Anuradha Karuppiah
243b74eda6 zebra: changes to advertise SVI mac by default if evpn-mh is enabled
Added support for advertising SVI MAC if EVPN-MH is enabled.

In the case of EVPN MH arp replies from an attached server can be sent to
the ES-peer. To prevent flooding of the reply the SVI MAC needs to be
advertised by default.

Note:
advertise-svi-ip could have been used as an alternate way to advertise
SVI MAC. However that config cannot be turned on if SVI IPs are
re-used (which is done to avoid wasting IP addresses in a subnet).

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-19 08:11:15 -08:00
Pat Ruddy
46d6f5a2c6 zebra: resolve multiple functions for local MAC delete
the old VXLAN function for local MAC deletion was still in
existence and being called from the VXLAN code whilst the new
generic function was not being called at all. Resolve this so
the generic function matches the old function and is called
exclusively.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2021-02-03 12:22:00 +00:00
Donald Sharp
700cae7698 zebra: in zebra_evpn_mac.c use size_t for buffer length
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-13 13:22:29 -05:00
Donald Sharp
b16e800423 zebra: Create a dump function for mac->flags and use it
Create a function that can dump the mac->flags in human readable
output and convert all debugs to use it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-13 13:22:29 -05:00
Donald Sharp
bf902d4c52 zebra: Create function to dump MACIP flags
Create a function to dump MACIP flags and to use it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-13 13:22:27 -05:00
Anuradha Karuppiah
16de1338a9 zebra: accept bgp remote mac-ip update if the higher-seq-local mac is not bgp-ready
If a local-MAC or local-neigh is not active locally it is not sent to BGP.
At this point if BGP rxes a remote route it accepts it and installs in
zebra. Zebra was rejecting BGP's update if it had a higher seq local (inactive)
entry. This would result in bgp and zebra falling out of sync.

In some cases zebra would delete the local-inactive entries in sometime (as
a part of the dplane/kernel garbage collection). This would leave zebra
with missing remote entries (which were still present in bgpd).

This change allows lower-seq BGP updates to overwrite zebra's local entry if
that entry happens to be local-inactive.

Note: This logic was already in use for sync-mac-ip updates. Extended the
same logic to remote-mac-ip updates.

Ticket: CM-31626

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
c1735c08c9 zebra: fix a problem with local MAC pointing to a remote ES
If a remote MAC update is rxed from BGP with a lower sequence number than
the local one zebra ignores the MAC update. This typically happens if
there is a race condition (where updates are in flight from zebra to BGP).

There was a bug in zebra because of which the dest ES was being updated
before this check. This left the local MAC pointing to a remote ES.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Relevant Dumps:
===============
root@leaf21:mgmt:~# net show evpn mac vni 101101 mac 00:93:00:00:00:01
MAC: 00:93:00:00:00:01
 ESI: 03:00:00:00:77:01:03:00:00:0d
 Intf: - VLAN: 101
 Sync-info: neigh#: 1 peer-proxy
 Local Seq: 3 Remote Seq: 0
 Neighbors:
    21.1.13.1 Active
root@leaf21:mgmt:~# net sho evpn es
Type: L local, R remote, N non-DF
ESI                            Type ES-IF                 VTEPs
03:00:00:00:77:01:02:00:00:0c  R    -                     6.0.0.10,6.0.0.11
03:00:00:00:77:01:03:00:00:0d  R    -                     6.0.0.10,6.0.0.11,6.0.0.12
03:00:00:00:77:01:04:00:00:0e  R    -                     6.0.0.10,6.0.0.11,6.0.0.12,6.0.0.13
03:00:00:00:77:02:02:00:00:16  LR   bondP2-H2             6.0.0.15
03:00:00:00:77:02:03:00:00:17  LR   bondP2-H3             6.0.0.15,6.0.0.16
03:00:00:00:77:02:04:00:00:18  LR   bondP2-H4             6.0.0.15,6.0.0.16,6.0.0.17
root@leaf21:mgmt:~#

Relevant logs:
===============
2020/07/29 15:41:27.110846 ZEBRA: Recv MACIP ADD VNI 101101 MAC 00:93:00:00:00:01 IP 21.1.13.1 flags 0x0 seq 2 VTEP 0.0.0.0 ESI 03:00:00:00:77:01:03:00:00:0d from bgp
2020/07/29 15:41:27.110867 ZEBRA: Ignore remote MACIP ADD VNI 101101 MAC 00:93:00:00:00:01 IP 21.1.13.1 as existing MAC has higher seq 3 flags 0x401
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Ticket: CM-30273

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
46bf266c1c zebra: debug logs to detect incorrect mac deletions
A MAC entry cannot be deleted while a neigh is referencing it. It seems
there is some race condition where this may be happening. The log is
to help identify those cases.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:46:28 -08:00
Anuradha Karuppiah
15400f95b7 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

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:46:26 -08:00
Anuradha Karuppiah
69711b3f83 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.

Ticket: CM-29636

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:44:37 -08:00
Anuradha Karuppiah
1a4f9efd54 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.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:44:37 -08:00
Anuradha Karuppiah
f3722826a4 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.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-01 09:44:37 -08:00
Anuradha Karuppiah
b2ee2b71f4 zebra: Keep DAD disabled if EVPN MH is turned on
DAD is not supported currently with EVPN-MH so we turn it off internally
when the first ES config is detected.

PS: Note that when all local ESs are deleted DAD will stay off and
will need to be cleared via a daemon restart.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-24 10:20:32 -08:00
Donald Sharp
f1dbb1c7e1 zebra: Add uptime to show evpn mac vni ... detail
Add the uptime a mac entry has been in the system.

New Output:

eva# show evpn mac vni all detail

VNI 1000 #MACs (local and remote) 16

MAC: 4e:2d:f3:75:ff:db
 ESI: 03:44:38:39:ff:ff:01:00:00:02
 Intf: hostbond2(10) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 7a:a4:f2:30:dd:5d
 ESI: 03:44:38:39:ff:ff:01:00:00:01
 Intf: hostbond1(9) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 66:9e:d7:3a:f1:f1
 Remote VTEP: 192.168.100.18
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:26
 Neighbors:
    45.0.0.5 Active
    fe80::649e:d7ff:fe3a:f1f1 Active

MAC: 26:f1:bd:5f:e1:77
 Remote ES: 03:44:38:39:ff:ff:02:00:00:02
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:23
 Neighbors:
    No Neighbors

MAC: 16:80:eb:c4:43:6d
 ESI: 03:44:38:39:ff:ff:01:00:00:01
 Intf: hostbond1(9) VLAN: 1000
 Sync-info: neigh#: 0 peer-active
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:28
 Neighbors:
    No Neighbors

MAC: 00:00:00:00:00:22
 Remote ES: 03:44:38:39:ff:ff:02:00:00:02
 Sync-info: neigh#: 0
 Local Seq: 0 Remote Seq: 0
 Uptime: 00:00:26
 Neighbors:
    No Neighbors

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-26 16:47:07 -04:00
Mark Stapp
9bcef951be zebra: replace inet_ntoa
Stop using inet_ntoa - use %pI4 or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:37:25 -04:00
Russ White
0a6e6613d7
Merge pull request #7089 from pguibert6WIND/netns-refactor
Netns refactor
2020-09-18 11:02:30 -04:00
Chirag Shah
839dfe29a6 zebra: dup detected mac avoid update to bgpd
When a MAC is detected duplicate on a local
learn event (with freeze action),
do not send update to bgp to advertise into
evpn control plane.

With evpn mh, inform_client flag is set and
sends notification to bgp albeit dup detect
is set.

Check mac are detected as duplicate before
setting inform_client to true.

Ticket:CM-29817
Reviewed By:CCR-10329
Testing Done:

Enable DAD with freeze action
Upon local learn MAC detected as duplica

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-09-15 16:12:44 -07:00
Philippe Guibert
47c5892955 zebra: add ns_id attribute to mac structure
this information is necessary for local information, because the
interface associated to the mac address is stored with its ifindex, and
the ifindex may not be enough to get to the right interface when it
comes with multiple network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-18 09:25:06 -07:00
Pat Ruddy
2bdd4461c1 zebra: clean up SA warning in EVPN code
Use asserts rather thank test where the values should definitely
not be NULL.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 18:03:21 +01:00
Pat Ruddy
8b5fdf2e66 zebra: extract core EVPN functions from zebra_vxlan.c
extract the core EVPN functions from zebra_vxlan.c and put them in
a new file zebra_evpn.c.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
7bce35354f zebra: extract gateway mac add from zebra_vxlan.c
extract mac_gateway add code from zevi_gw_macip_add and move it to
a new generic function zebra_evpn_mac_gw_macip_add in zebra_evpn_mac.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
ad6ca5f423 zebra: extract local mac del from zebra_vxlan.c
extract generic local mac add code from zebra_vxlan_local_mac_del
into a new function zebra_evpn_del_local_mac in zebra_evpn_mac.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
d9d3455e09 zebra: extract local mac add code from vxlan
extract the local mac add code from zebra_vxlan_local_mac_add_update
and create a new generic local mac add function
zebra_evpn_add_update_local_mac

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
19fdd1be29 zebra: split out mac_add code from process_remote_macip_add
Move MAC add code from process_remote_macip_add in zebra_vxlan.c
to a generic function process_mac_remote_macip_add in
zebra_evpn_mac.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:33 +01:00
Pat Ruddy
b299808662 zebra: extract evpn mac functions from zebra_vxlan.c
Move MAC dB specific functions to zebra_evpn_mac.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:33 +01:00
Pat Ruddy
24268cd07e zebra: clone zebra_vxlan.c to zebra_evpn_mac.c
clone zebra_vxlan.c to create a file zebra_evpn_mac.c for MAC dB
functions whilst retaining the history of zebra_vxlan.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:33 +01:00