Commit Graph

52 Commits

Author SHA1 Message Date
Donald Sharp
7d7be47ef0 zebra: Use __func__ instead of __PRETTY_FUNCTION__
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 12:02:05 -04:00
Quentin Young
693fc882d7 zebra: use safe stream decodes for evpn zapi msg
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-04-28 11:43:50 -04:00
Anuradha Karuppiah
7bfa7d0233 lib/zebra: zapi for installing EVPN nexthops from bgp
EVPN nexthops are installed as remote neighs by zebra. This was earlier
done only via VRF IPvX uni routes imported from EVPN routes.

With EVPN-MH these VRF routes now reference a L3NHG which is setup based
on the EAD and doesn't include the RMAC. To workaround that BGP now
consolidates and maintains EVPN nexthops which are then sent to zebra.

zebra sets up these nexthops as L3-VNI nh entries using a dummy type-1
route as reference.

Ticket: CM-31398

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-03-25 17:09:53 -07:00
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
Anuradha Karuppiah
fd40906be9 zebra: flush macs linked to the bond when it moves out of bypass
When a ES-bond is in bypass state MACs learnt on it are linked to the
access port instead of the ES. When LACP converges on the bond it moves
out of bypass and the MACs previously learnt on it are flushed to force
a re-learn on new traffic.

Ticket: CM-31326

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-24 08:11:26 -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
bd2ac9a794 zebra: drop the SVI MAC cleanup done as a part of interface delete
As a part of FRR shutdown interfaces are force flushed (in an arbitary
order). Interfaces are already down at that point i.e. resources like
SVI-MAC have already been released. Attempting to clean it up again
as a part of the force-flush was resulting in access of freed up memory -

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
==26457== Thread 1:
==26457== Invalid read of size 8
==26457==    at 0x1AE6B0: zebra_evpn_acc_bd_svi_set (zebra_evpn_mh.c:606)
==26457==    by 0x1B1460: zebra_evpn_if_cleanup (zebra_evpn_mh.c:1040)
==26457==    by 0x13CA69: if_zebra_delete_hook (interface.c:244)
==26457==    by 0x48A0E34: hook_call_if_del (if.c:59)
==26457==    by 0x48A0E34: if_delete_retain (if.c:290)
==26457==    by 0x48A2F94: if_delete (if.c:313)
==26457==    by 0x48A3169: if_terminate (if.c:1217)
==26457==    by 0x48E0024: vrf_delete (vrf.c:254)
==26457==    by 0x48E0024: vrf_delete (vrf.c:225)
==26457==    by 0x48E02FE: vrf_terminate (vrf.c:551)
==26457==    by 0x1442E1: sigint (main.c:203)
==26457==    by 0x1442E1: sigint (main.c:141)
==26457==    by 0x48CF862: quagga_sigevent_process (sigevent.c:103)
==26457==    by 0x48DD324: thread_fetch (thread.c:1404)
==26457==    by 0x48A926A: frr_run (libfrr.c:1122)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
(gdb) bt
(gdb) fr 5
1037    zebra/zebra_evpn_mh.c: No such file or directory.
(gdb) p zif->ifp->name
$2 = "vlan131", '\000' <repeats 12 times>
(gdb) p zif->link->info
$5 = (void *) 0x1
(gdb) p/x zif->ifp->flags
$7 = 0x1002
(gdb)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Ticket: CM-32435

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-02-19 08:11:15 -08:00
Chirag Shah
3b63732a42 zebra: prevent crash in evpn if cleanup
zebra crash is seen while cleaning up evpn interface
during shutdown event.
evpn interface clean up is called from vrf_delete callback

(gdb) frame 4
(is_up=false, br_zif=0x0, vlan_zif=0x557f31fb36f0) at zebra/zebra_evpn_mh.c:614
614     zebra/zebra_evpn_mh.c: No such file or directory.
(gdb) p tmp_br_zif
$1 = (struct zebra_if *) 0x0
(gdb) p vlan_zif->link
$2 = (struct interface *) 0x557f31fb2d40
(gdb) p vlan_zif->link->info
$3 = (void *) 0x0
(gdb) p zebra_if->ifp->name
No symbol "zebra_if" in current context.
(gdb) p vlan_zif->ifp->name
$4 = "peerlink-3.4094\000\000\000\000"

Ticket:CM-32435
Reviewed By:CCR-10957
Testing Done:

Signed-off-by: Chirag Shah <chirag@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
Anuradha Karuppiah
0b05c9bbe1 zebra: skip EVI setup if an ES is applied to a pseudo interface
zebra maintains pseudo interface for hanging off user config after
the interface is deleted in the kernel. If an user tried to config
an ES against such an interface zebra would crash with the following
call stack -
    at zebra/zebra_evpn_mh.c:2095
    sysmac=sysmac@entry=0x55cfbadd3160) at zebra/zebra_evpn_mh.c:2258
    at zebra/zebra_evpn_mh.c:3222
    argv=<optimized out>, es_lid_str=<optimized out>, es_lid=1, no=0x0, vty=0x55cfbaf4c7b0)
    at zebra/zebra_evpn_mh.c:3222
    argv=<optimized out>) at ./zebra/zebra_evpn_mh_clippy.c:202
    vty=vty@entry=0x55cfbaf4c7b0, cmd=cmd@entry=0x0, filter=FILTER_RELAXED)
    at lib/command.c:1073

Ticket: CM-31702

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
c7bfd08568 zebra: advertise stale neighs if EVPN-MH is not enabled
With EVPN-MH, Type-2 routes are also used for MAC-IP syncing between
ES peers so a change was done to only treat REACHABLE local neigh
entries as local-active and advertise them as Type-2 routes i.e. STALE
neigh entries are no longer advertised as Type-2s.

This however exposed some unexpected problems with MLAG where a
secondary reboot followed by a primary reboot left a lot of neighs
in STALE state (on the primary) resulting in them not being
advertised. And remote routed traffic to those hosts being
blackholed in a sym-IRB setup.

This commit is a workaround to fix the regression (it doesn't fix
the underlying problems with entries not becoming REACHABLE; which
maybe a day-1 problem). The workaround is to continue advertising
STALE neighbors if EVPN-MH is not enabled.

Ticket: CM-30303

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:15 -08:00
Anuradha Karuppiah
362c8f2d73 zebra: handle "show evpn es-evi" a non-existent VNI
zebra was crashing when the command was run on a non-existent VNI.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-12:mgmt:~# net show evpn es-evi vni 16777215
VNI 16777215 doesn't exist
root@torm-12:mgmt:~# net show evpn es-evi vni 16777215 detail
VNI 16777215 doesn't exist
root@torm-12:mgmt:~# net show evpn es-evi vni 16777215 json
[
]
root@torm-12:mgmt:~# net show evpn es-evi vni 16777215 detail json
[
]
root@torm-12:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Ticket: CM-30232

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:40:07 -08:00
Anuradha Karuppiah
35f5c31b0e zebra: add support for DF delay timer
When a new ES is created it is held in a non-DF state for 3 seconds
as specified by RFC7432. This allows the switch time to import
the Type-4 routes from the peers. And the peers time to rx the new
Type-4 route.

root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01"|grep DF
 DF status: non-df
 DF delay: 00:00:01
 DF preference: 50000
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01"|grep DF
 DF status: df
 DF preference: 50000
root@torm-11:mgmt:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-15 10:03:50 -08:00
Anuradha Karuppiah
0109f42f86 zebra: display DF status only for local ESs
For remote ESs it is not relevant and confuses the admin.

Local ES sample -
===============
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01"
ESI: 03:44:38:39:ff:ff:01:00:00:01
 Type: Local,Remote
 Interface: hostbond1
 State: up
 Bridge port: yes
 Ready for BGP: yes
 VNI Count: 10
 MAC Count: 3
 DF: status: df preference: 50000 >>>>>>>>>>>>>>>
 Nexthop group: 536870913
 VTEPs:
     27.0.0.16 df_alg: preference df_pref: 32767 nh: 268435465
     27.0.0.17 df_alg: preference df_pref: 32767 nh: 268435466

root@torm-11:mgmt:~#

Remote ES sample -
===============
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:02:00:00:01"
ESI: 03:44:38:39:ff:ff:02:00:00:01
 Type: Remote
 Interface: -
 Ready for BGP: no
 VNI Count: 0
 MAC Count: 6
 DF: status: - preference: 0 >>>>>>>>>>>>>>>
 Nexthop group: 536870919
 VTEPs:
     27.0.0.18 nh: 268435464
     27.0.0.19 nh: 268435467
     27.0.0.20 nh: 268435461

root@torm-11:mgmt:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-15 10:02:03 -08:00
Patrick Ruddy
bedf36e327
Merge pull request #7636 from AnuradhaKaruppiah/type-0-esi
zebra: support for type-0 ESI
2020-12-15 17:33:46 +00:00
Anuradha Karuppiah
dc261b8de4 zebra: restart start-up delay timer when the first uplink comes up
When all the uplinks go down the VTEP is disconnected from the
VxLAN overlay and this was handled by proto-downing the ES bonds. When
the uplinks come up again we need to re-enable the ES bonds but that
needs to be done after a delay to allow the EVPN network to converge.

And that is done by firing off the startup-delay timer on first
uplink-up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-14 10:32:41 -08:00
Anuradha Karuppiah
2bcf92e18b zebra: re-sync protodown state with the dplane on new ES add
1. When a bond is associated with an ES we may need to re-sync
the dplane protodown state (which maybe stale/set by some other
app).
2. Also change the uplink state display to avoid confusion with
protodown reason code (both used to show uplink-up).

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-14 10:32:40 -08:00
Anuradha Karuppiah
26ba45e33d zebra: update protodown display
protodown state is a combination of the dplane and zebra states.
protodown reason is maintained exclusively by zebra. Display this
information on two separate lines to make that ownership clearer.

Also display n/a for bonds as the dplane doesn't support protodowning
the bond device.

Sample output -
==============
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"|grep -i protodown
  protodown: off (n/a)
  protodown reasons: (uplinks-down)
root@torm-11:mgmt:~# vtysh -c "show interface swp5"|grep -i protodown
  protodown: on
  protodown reasons: (uplinks-down)
root@torm-11:mgmt:~#

PS: Cosmetic changes only, no functional change.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-14 10:32:40 -08:00
Anuradha Karuppiah
5c84327054 zebra: re-sync protodown state when a port/mbr is linked to an ES-bond
The code for this was already there but was not kicking in because of a
zebra local reason-code dup check. Even if the reason-code is the same,
if the dplane and zebra disagree about the protodown state zebra will
need to re-program the dplane.

Fixed a couple of spelling errors in the protodown logs to make greps
easy.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-14 10:32:40 -08:00
Anuradha Karuppiah
5de10c3705 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.

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
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
de86cc5bb1 zebra: free up the L2 NHG bitmap as a part of shutdown
Fix for a shutdown time memory leak found during review.

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
Patrick Ruddy
0091461961
Merge pull request #7483 from AnuradhaKaruppiah/evpn-mh-dad
bgpd, zebra: Keep DAD disabled if EVPN MH is turned on
2020-12-01 17:37:32 +00:00
Anuradha Karuppiah
325d694b93 zebra: support for type-0 ESI
Earlier type-3 ESI was the only format supported for evpn-mh. Updated the
CLI to allow a 10-byte type-0 ESI.

Both type-0 and type-3 ESIs are statically configured; just in two different
ways -
1. type-0 is configured as a complete 10-byte string
2. type-3 is configured as a 6-byte es-sys-mac and a 3-byte
local-discriminator.

Sample config -
!
interface hostbond1
 evpn mh es-id 00:44:38:39:ff:ff:01:00:00:01
!

This is a CLI-only change and has no functional impact.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-30 12:36:41 -08:00
Anuradha Karuppiah
dfa3d3d70a 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.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-24 11:06:08 -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
Anuradha Karuppiah
c36e442c4b zebra: uplink tracking and startup delay for EVPN-MH
Local ethernet segments are held in a protodown or error-disabled state
if access to the VxLAN overlay is not ready -
1. When FRR comes up the local-ESs/access-port are kept protodown
for the startup-delay duration. During this time the underlay and
EVPN routes via it are expected to converge.
2. When all the uplinks/core-links attached to the underlay go down
the access-ports are similarly protodowned.

The ES-bond protodown state is propagated to each ES-bond member
and programmed in the dataplane/kernel (per-bond-member).

Configuring uplinks -
vtysh -c "conf t" vtysh -c "interface swp4" vtysh -c "evpn mh uplink"

Configuring startup delay -
vtysh -c "conf t" vtysh -c "evpn mh startup-delay 100"

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EVPN protodown display -
========================
root@torm-11:mgmt:~# vtysh -c "show evpn"
L2 VNIs: 10
L3 VNIs: 3
Advertise gateway mac-ip: No
Advertise svi mac-ip: No
Duplicate address detection: Disable
  Detection max-moves 5, time 180
EVPN MH:
  mac-holdtime: 60s, neigh-holdtime: 60s
  startup-delay: 180s, start-delay-timer: 00:01:14 <<<<<<<<<<<<
  uplink-cfg-cnt: 4, uplink-active-cnt: 4
  protodown: startup-delay <<<<<<<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond protodown display -
===========================
root@torm-11:mgmt:~# vtysh -c "show interface hostbond1"
Interface hostbond1 is up, line protocol is down
  Link ups:       0    last: (never)
  Link downs:     1    last: 2020/04/26 20:38:03.53
  PTM status: disabled
  vrf: default
  OS Description: Local Node/s torm-11 and Ports swp5 <==> Remote  Node/s hostd-11 and Ports swp1
  index 58 metric 0 mtu 9152 speed 4294967295
  flags: <UP,BROADCAST,MULTICAST>
  Type: Ethernet
  HWaddr: 00:02:00:00:00:35
  Interface Type bond
  Master interface: bridge
  EVPN-MH: ES id 1 ES sysmac 00:00:00:00:01:11
  protodown: off rc: startup-delay  <<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ES-bond member protodown display -
==================================
root@torm-11:mgmt:~# vtysh -c "show interface swp5"
Interface swp5 is up, line protocol is down
  Link ups:       0    last: (never)
  Link downs:     3    last: 2020/04/26 20:38:03.52
  PTM status: disabled
  vrf: default
  index 7 metric 0 mtu 9152 speed 10000
  flags: <UP,BROADCAST,MULTICAST>
  Type: Ethernet
  HWaddr: 00:02:00:00:00:35
  Interface Type Other
  Master interface: hostbond1
  protodown: on rc: startup-delay <<<<<<<<<<<<<<<<
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-27 09:34:09 -07:00
Anuradha Karuppiah
2747f6f786 zebra: cleanup inet_ntoa usage in zebra_evpn_mh.c logs
Replaced inet_ntoa with %pI4 in the zebra debugs logs.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:43:05 -07:00
Anuradha Karuppiah
acffa256ba zebra: add json output for zebra ES, ES-EVI and access vlan dumps
1. ES
root@torm-11:mgmt:~# vtysh -c "show evpn es 03:44:38:39:ff:ff:01:00:00:01 json"
|python -m json.tool
{
    "accessPort": "hostbond1",
    "dfPreference": 50000,
    "esi": "03:44:38:39:ff:ff:01:00:00:01",
    "flags": [
        "local",
        "remote",
        "readyForBgp",
        "bridgePort",
        "operUp",
        "nexthopGroupActive"
    ],
    "macCount": 10,
    "nexthopGroup": 536870913,
    "vniCount": 10,
    "vteps": [
        {
            "dfAlgorithm": "preference",
            "dfPreference": 32767,
            "nexthopId": 268435460,
            "vtep": "27.0.0.16"
        },
        {
            "dfAlgorithm": "preference",
            "dfPreference": 32767,
            "nexthopId": 268435463,
            "vtep": "27.0.0.17"
        }
    ]
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2. ES-EVI -
root@torm-11:mgmt:~# vtysh -c "show evpn es-evi vni 1001 detail json" |python -m json.tool
[
    {
        "esi": "03:44:38:39:ff:ff:01:00:00:01",
        "flags": [
            "local",
            "readyForBgp"
        ],
        "vni": 1001
    },
    {
        "esi": "03:44:38:39:ff:ff:01:00:00:02",
        "flags": [
            "local",
            "readyForBgp"
        ],
        "vni": 1001
    },
]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

3. access-vlan
root@torm-11:mgmt:~# vtysh -c "show evpn access-vlan 1001 json" |python -m json.
tool
{
    "memberIfCount": 4,
    "members": [
        {
            "ifName": "hostbond4"
        },
        {
            "ifName": "hostbond1"
        },
        {
            "ifName": "hostbond2"
        },
        {
            "ifName": "hostbond3"
        }
    ],
    "vlan": 1001,
    "vni": 1001,
    "vxlanIf": "vx-1001"
}
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:33:21 -07:00
Anuradha Karuppiah
72f2674a95 zebra: handle local-es bridge port association
A local ES can be added or removed to a bridge after it is created.
When it becomes a bridge port member the dataplane attributes need
to be programmed.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:33:21 -07:00
Anuradha Karuppiah
28e80a037f zebra: changes for programming SPH, non-DF and backup NHG br-port attrs
split horizon filter, non-DF block filter and backup nexthop group
are passed as bridge port attributes to the dataplane.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:33:19 -07:00
Anuradha Karuppiah
1103c5c6cd zebra: changes to run DF election
1. DF preference is configurable per-ES
!
interface hostbond1
 evpn mh es-df-pref 100 >>>>>>>>>>>
 evpn mh es-id 1
 evpn mh es-sys-mac 00:00:00:00:01:11
!
2. This parameter is sent to BGP and advertised via the ESR.
3. The peer-ESs' DF params are sent to zebra (by BGP) and used
for running the DF election.
4. If the local VTEP becomes non-DF on an ES a block filter is
programmed in the dataplane to drop de-capsulated BUM packets
destined to that ES.

Sample output
=============
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh evpn es
Type: L local, R remote, N non-DF
ESI                            Type ES-IF                 VTEPs
03:00:00:00:00:01:11:00:00:01  LRN  hostbond1             27.0.0.16
03:00:00:00:00:01:22:00:00:02  LR   hostbond2             27.0.0.16
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
torm-11# sh evpn es 03:00:00:00:00:01:11:00:00:01
ESI: 03:00:00:00:00:01:11:00:00:01
 Type: Local,Remote
 Interface: hostbond1
 State: up
 Ready for BGP: yes
 VNI Count: 10
 MAC Count: 2
 DF: status: non-df preference: 100 >>>>>>>>
 Nexthop group: 0x2000001
 VTEPs:
     27.0.0.16 df_alg: preference df_pref: 32767 nh: 0x100000d >>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-26 10:32:49 -07:00
Patrick Ruddy
d7bd0c043c
Merge pull request #7217 from AnuradhaKaruppiah/fix-es-del-regression
zebra: fix double clearing of zif->es_info.es
2020-10-26 10:12:54 +00: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
Anuradha Karuppiah
ab06b03315 zebra: fix double clearing of zif->es_info.es
This problem was accidentally introduced as a part of another fixup -
[
commit e378f5020d (anuradhak/mh-misc-fixes, mh-misc-fixes)
Author: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Date:   Tue Sep 15 16:50:14 2020 -0700

    zebra: fix use of freed es during zebra shutdown
]

zif->es_info.es is cleared as a part of zebra_evpn_es_local_info_clear so it
cannot be passed around as a pointer from zebra_evpn_local_es_update/del.

Because of this bug removing ES from an interface resulted in
a zebra crash.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-10-19 09:36:44 -07:00
Donald Sharp
ba49e033f5 zebra: zevpn cannot be null passed into zebra_evpn_es_evi_show_one_evpn
In zebra_evpn_es_evi_show_vni the zevpn pointer if passed into
zebra_evpn_es_evi_show_one_evi will crash if it is null and
we have code that checks that it is non null and then immediately
calls the function.  Add a return to prevent a crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-10-11 10:47:37 -04:00
Sri Mohana Singamsetty
46dd92c522
Merge pull request #7164 from AnuradhaKaruppiah/mh-misc-fixes
evpn-mh: miscellaneous cleanup/fixes
2020-09-24 08:37:45 -07:00
Anuradha Karuppiah
e378f5020d 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>
2020-09-23 11:20:13 -07:00
Anuradha Karuppiah
4d8b658c8c 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>
2020-09-23 11:15:08 -07:00
Don Slice
f9f0463fb9 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>
2020-09-23 06:46:19 -07:00
Anuradha Karuppiah
945ee7b272 zebra: re-name some mh functions to make the code more readable
As a part of the re-factoring some of the evpn_vni_es apis got re-named
as evpn_evpn_es. Changed them to evpn_es_evi to make it common to
vxlan and mpls.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-09-15 16:24:59 -07:00
Anuradha Karuppiah
4cd940502d zebra: fix misc problems with ES management
1. MAC ref of a zero ESI was accidentally creating a new ES with zero
ES id.
2. When an ES was deleted and re-added the ES was not being sent to BGP
because of a stale flag that suppressed the update as a dup.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-28 15:10:18 -07:00
Anuradha Karuppiah
1718bc783a zebra: fix SA NULL ptr access warning in evpn_mh
Warning logs -
Logic error: Dereference of null pointer in zebra_evpn_mh.c, function zebra_evpn_es_evi_show_vni, line 360
See https://ci1.netdef.org/browse/FRR-FRRPULLREQ-13544/artifact/shared/static_analysis/report-b1eb72.html#EndPath

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-12 12:39:34 +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
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
87d76d5403 zebra: rename vni to evpn where appropriate
The main zebra_vni_t hash structure has been renamed to zebra_evpn_t
to allow for other transport underlays. Rename functions and variables
to reflect this change.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:33 +01:00
Anuradha Karuppiah
9e0c2fd182 bgpd, zebra: remove strcpy, strlen and sprintf calls
Replace with safe copy functions - strlcpy, strlcat, strnlen and
snprintf.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:13 -07:00