Commit Graph

463 Commits

Author SHA1 Message Date
David Lamparter
1d5453d607 *: remove tabs & newlines from log messages
Neither tabs nor newlines are acceptable in syslog messages.  They also
break line-based parsing of file logs.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-14 15:36:51 +01: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
Igor Ryzhov
1ac88792c0 *: fix all backets
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-02 19:11:25 +03:00
Donald Sharp
f10f8f0e98
Merge pull request #7652 from adharkar/frr-vni_switch
zebra: L3VNI to L2VNI conversion is not handled
2021-01-10 18:44:49 -05:00
Anuradha Karuppiah
7c0e4dc659 zebra: reinstall missing peer-sync flag
If a netlink/dp notification is rxed for a neigh without the peer-sync
flag FRR re-installs the entry with the right flags. This change is
needed to handle cases where the dataplane and FRR may fall out of
sync because of neigh learning on the network ports (i.e. via
the VxLAN).

Ticket: CM-30693
The problem was found during VM mobility "torture" tests where 100s
of extended VM moves were done.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Ameya Dharkar
3b0a590bf3 zebra: L3VNI to L2VNI conversion is not handled
After removal of L3VNI config, the VNI should become an L2VNI if a VxLAN
interface is present for the VNI. This case is not handled in the code.

Changes:
1. After unconfiguring L3VNI, create an L2VNI if VxLAN interface is present
for the VNI.
2. Trigger an update to BGP.
3. Read MAC and ARP entries from kernel.

This PR fixes the issue only for route type-2, 3 and 5. This PR does not address
states regarding route type-1, 4 and multicast group for VxLAN interface.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2020-12-16 18:06:37 -08:00
Patrick Ruddy
a119a429e4
Merge pull request #7637 from AnuradhaKaruppiah/evpn-pim-fixes
evpn-pim: cleanup and display fixes
2020-12-15 17:36:24 +00: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
0c16fb7262 zebra: fix crash seen on VxLAN SG table cleanup done as a part of vrf disable
There are two fixes in this commit -
1. Prevent implicit deletion of (*,G) entries during (S,G) cleanup.
This is done by creating a dummy reference on all (*,G) entries.
This is needed for a hash-walk based table cleanup.
2. Free up the SG hash table when the VRF is deleted.

Ticket: CM-30151

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-11-30 12:50:38 -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
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
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Chirag Shah
9bee02322f zebra: display rpc error msg to vtysh
Zebra's clear duplicate detect command is rpc converted.
There is condition where cli fails with human readable message.
Using northboun's errmsg buffer to display error message to
user.

Testing:

bharat# clear evpn dup-addr vni 1002 ip 2011:11::11
Error type: generic error
Error description: Requested IP's associated MAC aa:aa:aa:aa:aa:aa is still in duplicate state

bharat# clear evpn dup-addr vni 1002 ip 11.11.11.11
Error type: generic error
Error description: Requested IP's associated MAC aa:aa:aa:aa:aa:aa is still in duplicate state

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2020-10-05 13:57:54 -07:00
Chirag Shah
c7e83a4efe 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>
2020-09-28 21:44:30 -07:00
Philippe Guibert
2961d0601c 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>
2020-09-11 18:26:23 +02:00
Philippe Guibert
d6bf8f136d 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>
2020-09-11 18:26:23 +02:00
Philippe Guibert
6265fbe55c zebra: fdb and neighbor table are read for all zns
all network namespaces are read so as to collect interesting fdb and
neighbor tables for EVPN.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-18 09:25:06 -07:00
Philippe Guibert
a237058f59 zebra: zvni_map_to_svi() adaptation for other network namespaces
the function is called with all the network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-08-18 09:25:06 -07:00
Philippe Guibert
07509878e3 zebra: importation of bgp evpn rt5 from vni with other netns
With vrf-lite mechanisms, it is possible to create layer 3 vnis by
creating a bridge interface in default vr, by creating a vxlan interface
that is attached to that bridge interface, then by moving the vxlan
interface to the wished vrf.
With vrf-netns mechanism, it is slightly different since bridged
interfaces can not be separated in different network namespaces. To make
it work, the setup consists in :
- creating a vxlan interface on default vrf.
- move the vxlan interface to the wished vrf ( with an other netns)
- create a bridge interface in the wished vrf
- attach the vxlan interface to that bridged interface

from that point, if BGP is enabled to advertise vnis in default vrf,
then vxlan interfaces are discovered appropriately in other vrfs,
provided that the link interface still resides in the vrf where l2vpn is
advertised.
to import ipv4 entries from a separate vrf, into the l2vpn, the
configuration of vni in the dedicated vrf + the advertisement of ipv4
entries in bgp vrf will import the entries in the bgp l2vpn.

the modification consists in parsing the vxlan interfaces in all network
namespaces, where the link resides in the same network namespace as the
bgp core instance where bgp l2vpn is enabled.

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
6006414dc9 zebra: clone zebra_vxlan.c to zebra_evpn.c
clone zebra_vxlan.c to create a file zebra_evpn.c for core
EVPN functions whilst retaining the history of zebra_vxlan.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
33064a6289 zebra: extract neighbor processing from kernel_neigh_del
extract the neighbor uninstall part of
zebra_vxlan_handle_kernel_neigh_del into a new function
zebra_evpn_neigh_del_ip in zebra_evpn_neigh.c.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
32fe7dfd9b zebra: extract neighbor processing from process_remote_macip_del
extract the neighbor uninstall  part of process_remote_macip_add
into a new function zebra_evpn_neigh_remote_uninstall in
zebra_evpn_neigh.c.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
224315f3e4 zebra: extract neigbor processing from zevpn_gw_macip_add
extract the neighbor part of process_remote_macip_add into a new
function zebra_evpn_neigh_gw_macip_add in zebra_evpn_neigh.c.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
036daaca3e zebra: extract neigbor processing from remote_macip_add
extract the neighbor part of process_remote_macip_add into a new
function process_neigh_remote_macip_add in zebra_evpn_neigh.c.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
7cbae20ade zebra: extract neighbor functions from zebra_vxlan.c
Move neighbor processing functions to new zebra_evpn_neigh.c

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-12 12:39:34 +01:00
Pat Ruddy
6336e12b94 zebra: clone zebra_vxlan.c to zebra_evpn_neigh.c
clone zebra_vxlan.c to create a file zebra_evpn_neigh.c for neighbor
dB functions whilst retaining the history of zebra_vxlan.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
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
Mark Stapp
b7895aad82 zebra: clean up SA warning in vxlan code
Resolve an SA warning in the vxlan code.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-08-11 08:39:25 -04:00
Anuradha Karuppiah
4a7d61409d zebra: add ESI to the "show evpn mac vni <> mac <> json" output
Sample output -
=============
anuradhak-VirtualBox# anuradhak-VirtualBox# show evpn mac vni 1000 mac 00:00:00:00:00:22 json

{
  "00:00:00:00:00:22":{
    "type":"remote",
    "remoteVtep":"0.0.0.0",
    "localSequence":0,
    "remoteSequence":0,
    "detectionCount":0,
    "isDuplicate":false,
    "syncNeighCount":0,
    "esi":"03:44:38:39:ff:ff:02:00:00:02", >>>>>>>>>>>>>>>>
    "neighbors":"none"
  }
}

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:13 -07: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
Anuradha Karuppiah
b169fd6fd5 zebra: support for MAC-IP sync routes
MAC-IP routes are used for syncing local entries across redundant
switches in an EVPN-MH setup. A path from a peer that has a local
ES as destination is tagged as a SYNC path. The SYNC path results in the
addition of local MAC and/or local neigh entry in zebra and in the
dataplane.

Implementation overview
=======================
1. Three new flags "local-inactive", "peer-active" and "peer-proxy"
are maintained per-local-MAC and per-local-Neigh entry.
2. The "peer-XXX" flags are set and cleared via SYNC path updates
from BGP. Proxy sync paths result in the setting of "peer-proxy" flag
(and non-proxies result in the "peer-active").
3. A neigh entry that has a "peer-XXX" flag set is programmed as
"static" in the dataplane.
4. A MAC entry that has a "peer-XXX" flag set or is referenced by
a sync-neigh entry (that has a "peer-XXX" flags set) is programmed
as "static" in the dataplane.
5. The sync-seq number is used to normalize the MM seq number across
all the redundant switches i.e. the max MM seq number across all
switches is used by each of the switches. This commit also includes
the changes needed for extended MM seq syncing.
6. A MAC/neigh entry has to be local-active or peer-active to sent to
BGP. An entry that is NOT local-active is sent with the proxy flag (so
BGP can "proxy" advertise it).
7. The "peer-active" flag is aged out by zebra by using a hold_timer
(this is instead of being abruptly dropped on SYNC path delete). This
age-out is needed to handle peer-switch restart (procedures are specified
in draft-rbickhart-evpn-ip-mac-proxy-adv). The holdtime needs to be
sufficiently long to allow an external neighmgr daemon or the dataplane
component to independently probe and establish local reachability of a
host. The MAC and neigh hold time values are configurable.
PS: In the future this probing may happen in FRR itself.

CLI changes to display sync info
================================
MAC
===
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# net show evpn mac vni 1000
Number of MACs (local and remote) known for this VNI: 6
Flags: N=sync-neighs, I=local-inactive, P=peer-active, X=peer-proxy
MAC               Type   Flags Intf/Remote ES/VTEP            VLAN  Seq #'s
00:02:00:00:00:25 local        vlan1000                       1000  0/0
02:02:00:00:00:02 local  PI    hostbond1                      1000  0/0
02:02:00:00:00:06 remote       03:00:00:00:00:02:11:00:00:01        0/0
02:02:00:00:00:01 local  X     hostbond1                      1000  0/0
00:00:00:00:00:11 local  PI    hostbond1                      1000  0/0
02:02:00:00:00:05 remote       03:00:00:00:00:02:11:00:00:01        0/0
root@torm-11:mgmt:~#
root@torm-11:mgmt:~# net show evpn mac vni 1000 mac 00:00:00:00:00:11
MAC: 00:00:00:00:00:11
 ESI: 03:00:00:00:00:01:11:00:00:01
 Intf: hostbond1(58) VLAN: 1000
 Sync-info: neigh#: 0 local-inactive peer-active >>>>>>>>>>>>
 Local Seq: 0 Remote Seq: 0
 Neighbors:
    No Neighbors
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
neigh
=====
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@torm-11:mgmt:~# net show evpn arp vni 1003
Number of ARPs (local and remote) known for this VNI: 4
Flags: I=local-inactive, P=peer-active, X=peer-proxy
Neighbor             Type   Flags State    MAC               Remote ES/VTEP                 Seq #'s
2001:fee1:0:3::6     local        active   00:02:00:00:00:25                                0/0
45.0.3.66            local  P     active   00:02:00:00:00:66                                0/0
45.0.3.6             local        active   00:02:00:00:00:25                                0/0
fe80::202:ff:fe00:25 local        active   00:02:00:00:00:25                                0/0
root@torm-11:mgmt:~#
root@torm-11:mgmt:~# net show evpn arp vni 1003 ip 45.0.3.66
IP: 45.0.3.66
 Type: local
 State: active
 MAC: 00:02:00:00:00:66
 Sync-info: peer-active >>>>>>>>>>>>>>>>
 Local Seq: 0 Remote Seq: 0
root@torm-11:mgmt:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:13 -07:00
Anuradha Karuppiah
f188e68e5c zebra: debug flags for MAC-IP sync
Filters for zebra debug logs.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:13 -07:00
Anuradha Karuppiah
ce5160c081 zebra: Ethernet segment management and support for MAC-ECMP
1. Local ethernet segments are configured in zebra by attaching a
local-es-id and sys-mac to a access interface -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
interface hostbond1
 evpn mh es-id 1
 evpn mh es-sys-mac 00:00:00:00:01:11
!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This info is then sent to BGP and used for the generation of EAD-per-ES
routes.

2. Access VLANs associated with an (ES) access port are translated into
ES-EVI objects and sent to BGP. This is used by BGP for the
generation of EAD-EVI routes.

3. Remote ESs are imported by BGP and sent to zebra. A list of VTEPs
is maintained per-remote ES in zebra. This list is used for the creation
of the L2-NHG that is used for forwarding traffic.

4. MAC entries with a non-zero ESI destination use the L2-NHG associated
with the ESI for forwarding traffic over the VxLAN overlay.

Please see zebra_evpn_mh.h for the datastruct organization details.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05 06:46:12 -07:00
Pat Ruddy
bd23c84036 evpn-netns: Revert PR5077, has been re-worked post-refactor
Revert "zebra: support for macvlan interfaces"

This reverts commit bf69e212fd.

Revert "doc: add some documentation about bgp evpn netns support"

This reverts commit 89b97c33d7.

Revert "zebra: dynamically detect vxlan link interfaces in other netns"

This reverts commit de0ebb2540.

Revert "bgpd: sanity check when updating nexthop from bgp to zebra"

This reverts commit ee9633ed87.

Revert "lib, zebra: reuse and adapt ns_list walk functionality"

This reverts commit c4d466c830.

Revert "zebra: local mac entries populated in correct netnamespace"

This reverts commit 4042454891.

Revert "zebra: when parsing local entry against dad, retrieve config"

This reverts commit 3acc394bc5.

Revert "bgpd: evpn nexthop can be changed by default"

This reverts commit a2342a2412.

Revert "zebra: zvni_map_to_vlan() adaptation for all namespaces"

This reverts commit db81d18647.

Revert "zebra: add ns_id attribute to mac structure"

This reverts commit 388d5b438e.

Revert "zebra: bridge layer2 information records ns_id where bridge is"

This reverts commit b5b453a2d6.

Revert "zebra, lib: new API to get absolute netns val from relative netns val"

This reverts commit b6ebab34f6.

Revert "zebra, lib: store relative default ns id in each namespace"

This reverts commit 9d3555e06c.

Revert "zebra, lib: add an internal API to get relative default nsid in other ns"

This reverts commit 97c9e7533b.

Revert "zebra: map vxlan interface to bridge interface with correct ns id"

This reverts commit 7c990878f2.

Revert "zebra: fdb and neighbor table are read for all zns"

This reverts commit f8ed2c5420.

Revert "zebra: zvni_map_to_svi() adaptation for other network namespaces"

This reverts commit 2a9dccb647.

Revert "zebra: display interface slave type"

This reverts commit fc3141393a.

Revert "zebra: zvni_from_svi() adaptation for other network namespaces"

This reverts commit 6fe516bd4b.

Revert "zebra: importation of bgp evpn rt5 from vni with other netns"

This reverts commit 28254125d0.

Revert "lib, zebra: update interface name at netlink creation"

This reverts commit 1f7a68a2ff.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-08-05 06:46:12 -07:00
Russ White
996b789193
Merge pull request #6758 from chiragshah6/yang_nb6
EVPN northbound conversion for vrf l3vni mapping command
2020-07-28 07:22:24 -04:00
Chirag Shah
92475ca487 zebra: vrf disable clean up evpn rmac nxthp cache
In networking restart event, l3vni (vxlan) interface followed by
associated vrf interfaces go down/deleted.
L3vni (oper) down event (from zebra to bgp) triggers to
clean up/un-import evpn routes (one-by-one) from the vrf table,
zebra internally removes the route entry from nexthop and RMAC hash.
When all the routes references in nexthop and RMAC db removed,
both (nexthop/rmac) are suppose to be uninstalled from the
bridge fdb and neigh table.
While evpn routes removal in progress, a vrf disable event removes
l3vni to its vrf association.
Subsequent bgp to evpn routes removal does not clean up thus evpn routes
reference to nexthop and RMAC remains in zebra hash.
bridge fdb and neigh tables are flushed out since networking restart brings down
all interfaces which results in flush of fdb and neigh tables.
By product is the zebra does not install nexthop and rmac when routes are re-imported
into vrf in VNI/VRF up event.

The fix is in vrf disable event to flush all l3vni's nexthop and rmac db.

Ticket:CM-30338
Reviewed By:CCR-10489
Testing Done:

Performed multiple networking restart and checked neigh and
bridge fdb tables for respective nexthop and router mac entry
programmed.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-07-20 20:58:20 -07:00
Chirag Shah
e2bcfa3946 zebra: evpn l3vni map to vrf nb changes
The set of northbound changes for l3vni configuration
command under vrf.

vrf x
 vni 1000 prefix-routes-only

{
  "frr-vrf:lib": {
    "vrf": [
      {
        "name": "vrf1",
        "frr-zebra:zebra": {
          "l3vni-id": 4001
        }
      },
      {
        "name": "vrf2",
        "frr-zebra:zebra": {
          "l3vni-id": 4002,
          "prefix-only": true
        }
      }
    ]
  }
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-07-20 18:33:38 -07:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Philippe Guibert
bf69e212fd zebra: support for macvlan interfaces
mac vlan interfaces are supported in different network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
c4d466c830 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>
2020-05-18 14:11:03 +02:00
Philippe Guibert
4042454891 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>
2020-05-18 14:11:03 +02:00
Philippe Guibert
3acc394bc5 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>
2020-05-18 14:11:03 +02:00
Philippe Guibert
db81d18647 zebra: zvni_map_to_vlan() adaptation for all namespaces
this change is needed when a MAC/IP entry is learned by zebra, and the
entry happens to be in a different namespace. So that the entry be
active, the correct vni match has to be found.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
f8ed2c5420 zebra: fdb and neighbor table are read for all zns
all network namespaces are read so as to collect interesting fdb and
neighbor tables for EVPN.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
388d5b438e 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-05-18 14:11:03 +02:00
Philippe Guibert
2a9dccb647 zebra: zvni_map_to_svi() adaptation for other network namespaces
the function is called with all the network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
6fe516bd4b zebra: zvni_from_svi() adaptation for other network namespaces
other network namespaces are parsed because bridge interface can be
bridged with vxlan interfaces with a link in the default vrf that hosts
l2vpn.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Philippe Guibert
28254125d0 zebra: importation of bgp evpn rt5 from vni with other netns
With vrf-lite mechanisms, it is possible to create layer 3 vnis by
creating a bridge interface in default vr, by creating a vxlan interface
that is attached to that bridge interface, then by moving the vxlan
interface to the wished vrf.
With vrf-netns mechanism, it is slightly different since bridged
interfaces can not be separated in different network namespaces. To make
it work, the setup consists in :
- creating a vxlan interface on default vrf.
- move the vxlan interface to the wished vrf ( with an other netns)
- create a bridge interface in the wished vrf
- attach the vxlan interface to that bridged interface

from that point, if BGP is enabled to advertise vnis in default vrf,
then vxlan interfaces are discovered appropriately in other vrfs,
provided that the link interface still resides in the vrf where l2vpn is
advertised.
to import ipv4 entries from a separate vrf, into the l2vpn, the
configuration of vni in the dedicated vrf + the advertisement of ipv4
entries in bgp vrf will import the entries in the bgp l2vpn.

the modification consists in parsing the vxlan interfaces in all network
namespaces, where the link resides in the same network namespace as the
bgp core instance where bgp l2vpn is enabled.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-05-18 14:11:03 +02:00
Pat Ruddy
1cc5b09394 zebra: fix json for show evpn arp-cache vni vtep
The function zebra_vxlan_print_neigh_vni_vtep does not create
a json object when json has been requested from the CLI and as a
result it prints out the information in normal CLI format.
Fix is to allocate the json object when required.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-04-29 12:29:09 +01:00
Quentin Young
772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Chirag Shah
e20755b23e zebra: clear dup detect cleanup for nb conversion
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:13:15 -07:00
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03:00
Anuradha Karuppiah
5e66503173 zebra: fix NULL deref reported by coverity in evpn-pim cleanup
*** CID 1492481:  Null pointer dereferences  (NULL_RETURNS)
/zebra/zebra_vxlan.c: 10262 in zebra_evpn_pim_cfg_clean_up()
10256     }
10257
10258     static int zebra_evpn_pim_cfg_clean_up(struct zserv *client)
10259     {
10260     	struct zebra_vrf *zvrf = zebra_vrf_get_evpn();
10261
>>>     CID 1492481:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing "zvrf", which is known to be "NULL".
10262     	if (CHECK_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG)) {
10263     		if (IS_ZEBRA_DEBUG_VXLAN)
10264     			zlog_debug("VxLAN SG updates to PIM, stop");
10265     		UNSET_FLAG(zvrf->flags, ZEBRA_PIM_SEND_VXLAN_SG);
10266     	}

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-04-03 06:00:41 -07:00
Mark Stapp
e4a1ec7454 zebra,lib: use const in more apis
Use const with some args to ipaddr, zebra vxlan, mpls
lsp, and nexthop apis; add some extra checks to some
nexthop-related apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 09:37:02 -04:00
David Lamparter
d6951e5ef9 *: remove tabs from log messages
Some logging systems are, er, "allergic" to tabs in log messages.
(RFC5424: "The syslog application SHOULD avoid octet values below 32")

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 18:47:12 +01:00
vivek
4b3f26f4c9 zebra: Readd special flood MAC upon del notification
Readd the special MAC that represents the flood (head-end replication) entry
for EVPN-VxLAN upon getting a delete notification for it.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Chirag Shah <chirag@cumulusnetworks.com>

Ticket:  CM-25797
Ticket: CM-26238
Testing Done:
1. evpn-min, evpn-smoke - results summarized in CM-25798
2020-03-10 10:02:43 -04:00
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Sri Mohana Singamsetty
331f2f8531
Merge pull request #5780 from chiragshah6/evpn_dev1
zebra:remote vtep delete handling
2020-03-02 09:39:37 -08:00
Donald Sharp
7f5818fbd6 *: change hash_backet to hash_bucket
It's been a year search and destroy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-28 13:59:13 -05:00
Jafar Al-Gharaibeh
4d67e75282 Revert "*: change hash_backet to hash_bucket"
This reverts commit 3895c42a2e.

LabN CI update needs to be coordinated before merging this

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-02-27 09:52:02 -06:00
Donald Sharp
3895c42a2e *: change hash_backet to hash_bucket
It's been a year search and destroy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-26 20:03:34 -05:00
Chirag Shah
256f86b655 zebra:remote vtep delete handling
The existing behavior is when a remote VTEP is deleted,
its associatedneighbor (arp) and MAC entries are removed from
zebra database and do not wait for explicit type-2 route
withdraw from originating VTEP.
Remote type-2 route delete checks if VTEP is present before
removing the entry.
The behavior works fine when all evpn routes points to the
same nexthop as the VTEP IP.

In MLAG topology with advertise-pip, self type-2 and type-5 routes
are advertised with individual VTEP IP as nexthop ip for the route.

When a new VNI is created, it is assigned individual IP as tunnel-ip
then it transition to anycast IP (of the MLAG). During the transition,
type-3 route (VTEP delete) withdraw is sent for the individual IP.
The remote VTEP delete should not trigger to remove evpn routes pointing
to VTEP IP. Instead the route will be removed via explicit withdraw.

Ticket:CM-27752
Reviewed By:CCR-9722
Testing Done:

In evpn with MLAG deployment with advertise-pip and advertise-svi-ip
enabled, validated remote vtep delete does not remove self type-2 routes
from zebra DB. Upon explicit type-2 withdraw routes are removed.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-02-07 17:02:39 -08:00
Donatas Abraitis
975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
Quentin Young
7fb29f49ab zebra: fix assert crash on corrupt vxlan msg
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-15 14:20:22 -05:00
Chirag Shah
c1c292e777 zebra: fix debug in macvlan down event
fix a debug where display parent interface name
only if it exists.

Ticket:CM-27733

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-01-10 11:15:36 -08:00
Donald Sharp
0bd371c61e zebra: Refactor _add and _del to use a common function
The decoding of _add and _del functions is practically identical
do a bit of work and make them so.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-06 20:25:51 -05:00
Donald Sharp
4824d144b6 zebra: Prevent zebra vxlan remote macip del buffer overflow
=================================================================
==13611==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe9e5c8694 at pc 0x0000004d18ac bp 0x7ffe9e5c8330 sp 0x7ffe9e5c7ae0
WRITE of size 17 at 0x7ffe9e5c8694 thread T0
    #0 0x4d18ab in __asan_memcpy (/usr/lib/frr/zebra+0x4d18ab)
    #1 0x7f16f04bd97f in stream_get2 /home/qlyoung/frr/lib/stream.c:277:2
    #2 0x6410ec in zebra_vxlan_remote_macip_del /home/qlyoung/frr/zebra/zebra_vxlan.c:7718:4
    #3 0x68fa98 in zserv_handle_commands /home/qlyoung/frr/zebra/zapi_msg.c:2611:3
    #4 0x556add in main /home/qlyoung/frr/zebra/main.c:309:2
    #5 0x7f16eea3bb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #6 0x431249 in _start (/usr/lib/frr/zebra+0x431249)

This decode is the result of a buffer overflow because we are
not checking ipa_len.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-06 20:22:56 -05:00
Philippe Guibert
dd90b4c86a
Merge pull request #4977 from chiragshah6/evpn_dev1
* evpn primary address advertisement
2019-11-26 17:56:59 +01:00
Chirag Shah
65e76a9bcf zebra: display proper field in debug statement
Ticket:CM-26622

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:39 -08:00
Chirag Shah
59260d4a07 zebra: handle macvlan down event
Macvlan down event have sentinel check of its parent
link presence.

Ticket:CM-26622
Reviewed By:CCR-9326
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:38 -08:00
Chirag Shah
28ad0501b9 zebra: print rmac and sys mac values
"show vrf vni" and "show evpn vni <l3vni>" commands
need to display correct router mac value.

"show evpn vni <l3vni>" detail l3vni needs to display
system mac as in PIP scenario value can be different.
Syste MAC would be derived from SVI interface MAC wherelse
Router MAC would be derived from macvlan interface MAC value.

Ticket:CM-26710
Reviewed By:CCR-9334
Testing Done:

TORC11# show evpn vni 4001
VNI: 4001
  Type: L3
  Tenant VRF: vrf1
  Local Vtep Ip: 36.0.0.11
  Vxlan-Intf: vx-4001
  SVI-If: vlan4001
  State: Up
  VNI Filter: none
  System MAC: 00:02:00:00:00:2e
  Router MAC: 44:38:39:ff:ff:01
  L2 VNIs: 1000
TORC11# show vrf vni
VRF     VNI    VxLAN IF   L3-SVI    State Rmac
vrf1    4001   vx-4001    vlan4001  Up    44:38:39:ff:ff:01

TORC11# show evpn vni 4001 json
{
  "vni":4001,
  "type":"L3",
  "localVtepIp":"36.0.0.11",
  "vxlanIntf":"vx-4001",
  "sviIntf":"vlan4001",
  "state":"Up",
  "vrf":"vrf1",
  "sysMac":"00:02:00:00:00:2e",
  "routerMac":"44:38:39:ff:ff:01",
  "vniFilter":"none",
  "l2Vnis":[
    1000,
  ]
}

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:35 -08:00
Chirag Shah
0056f687d7 zebra: evpn pip mac vlan up-down event
macvlan interface up/down event triggers
bgp to send updates for evpn routes
with changed RMAC and nexthop IP values.

Ticket:CM-26190
Reviewed By:
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:33 -08:00
Chirag Shah
0ca1058096 bgpd: evpn pip handle svi ip route
By default announct Self Type-2 routes with
system IP as nexthop and system MAC as
nexthop.

An API to check type-2 is self route via
checking ipv4/ipv6 address from connected interfaces list.

An API to extract RMAC and nexthop for type-2
routes based on advertise-svi-ip knob is enabled.

When advertise-pip is enabled/disabled, trigger type-2
route update. For self type-2 routes to use
anycast or individual (rmac, nexthop) addresses.

Ticket:CM-26190
Reviewed By:
Testing Done:

Enable 'advertise-svi-ip' knob in bgp default instance.
the vrf instance svi ip is advertised with nexthop
as default instance router-id and RMAC as system MAC.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:32 -08:00
Chirag Shah
06d9cde5c7 zebra: evpn pip extract vrr mac
Extract mac-vlan interface mac when a l3vni add is sent to bgp

Per L3VNI maintain vrr interface.
An api to extract vrr mac address from a vlan id, associated
master svi device.

When a l3vni operational up event is sent to bgpd,
extract vrr rmac along with svi rmac.

Ticket:CM-26190
Reviewed By:
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-22 07:53:29 -08:00
Lakshman Krishnamoorthy
06931fdb12 zebra: "show evpn vni details json" prints incorrect JSON format
edge-2> show evpn vni detail json
{
  "vni":79031,
  "type":"L3",
  ...,
  ...
}                                       <<<<<< no comma

{
  "vni":79021,
  "type":"L3",
  ...,
  ...
}                                       <<<<<< no comma

{
}                                       <<<<<< blank
edge-2>

The fix is to pack json info into json_array before printing it.

Signed-off-by: Lakshman Krishnamoorthy <lkrishnamoor@vmware.com>
2019-11-21 16:18:04 -08:00
Chirag Shah
651fa9053d zebra: evpn update remote rmac and nexhop
In symmetric routing case for evpn (type-2/type-5)
routes, nexthop and Router mac fields can change from
the originating VTEP.

At the receiving VTEP, bgp path info may points to different
nexthop IP (nh1->nh2) and Remote MAC remain the same.
When the bgp sync the route with nexthop and RMAC fields.
For the exisitng rmac entry update/replace with the new
nexthop (VTEP) IP in remote rmac db in Zebra.

Similarly, bgp path info may points different Router-mac
(RMAC1->RMAC2) and the nexthop value remains the same.
In this case, update to the new RMAC value for the
existing remote nexthop in the Zebra' nexthop cache db.

Ticket:CM-26917
Reviewed By:CCR-9435
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-11-07 10:49:18 -08:00
Donald Sharp
d1accb2e19 zebra: zvni_map_to_svi may return NULL act accordingly
The zvni_map_to_svi function may return NULL as such prevent
a deref and crash.  Found via coverity

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-28 20:52:40 -04:00
Chirag Shah
3dacbb9d24 bgpd: fix advertise-svi-ip upon vni-svi up-down
When a VxLAN interface comes up new vni up event is sent
to bgpd, which triggers bgpd to sync advertise-svi-macip
to zebra. At this point, vni is present but the associated
SVI may not be present.
When SVI comes up, vni add event sent to bgpd (with associated
vrf update). Bgpd already has vni present so
advertise-svi-macip is not synced to Zebra.

To fix,
When advertise-svi-macip flag is synced first time, cache it in
zebra context even though vni associated SVI is not present.
when SVI comes up, interface address add event triggers
new MAC-IP route add to bgpd.

Ticket:CM-26038
Reviewed By:CCR-9254
Testing Done:

Validated via running a sequence of steps in symmetric
routing topology.
- Enable advertise-svi-macip at l2vni level under bgp default
instance (afi/safi, l2vpn/evpn)
- Flap l2vni associated SVI interface.
- Check the output of 'show bgp l2vpn evpn route' command for
MAC-IP route of the SVI's (MAC and IP address).

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-09-23 21:14:04 -07:00
Mark Stapp
478566d68b zebra: avoid using zebra datastructs in evpn dataplane path
Some netlink-facing code used for evpn/vxlan programming was
being run in the dataplane pthread, but accessing zebra core
datastructs. Move some additional data into the dataplane
context, and use it in the netlink path instead.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-05 12:58:58 -04:00
Mark Stapp
e0e140a745 zebra: protect some vxlan debugs
Some VXLAN debugs weren't covered by 'if debug...' tests.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-05 11:12:00 -04:00
Mark Stapp
0bbd4ff442 zebra: move EVPN VTEP programming to dataplane
Move VTEP install/uninstall to the zebra dataplane. Remove
synch kernel-facing apis and helper functions.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-04 10:30:17 -04:00
Mark Stapp
931fa60c09 zebra: Use dataplane for evpn neighbor changes
Move neighbor programming to the dataplane; remove
old apis; remove some ifdef'd use of direct netlink
code points, using neutral values outside of the netlink-
specific files.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-23 14:10:41 -04:00
Donald Sharp
ad4c7e8d4e
Merge pull request #4778 from mjstapp/dplane_macs
zebra: use dataplane for evpn macs
2019-08-21 20:26:29 -04:00
Donald Sharp
f79f7a7bb2 *: Fix spelling errors pointed out by debian packaging
Debian packaging when run finds a bunch of spelling errors:

I: frr: spelling-error-in-binary usr/bin/vtysh occurences occurrences
I: frr: spelling-error-in-binary usr/lib/frr/bfdd Amount of times Number of times
I: frr: spelling-error-in-binary usr/lib/frr/bgpd occurences occurrences
I: frr: spelling-error-in-binary usr/lib/frr/bgpd recieved received
I: frr: spelling-error-in-binary usr/lib/frr/isisd betweeen between
I: frr: spelling-error-in-binary usr/lib/frr/ospf6d Infomation Information
I: frr: spelling-error-in-binary usr/lib/frr/ospfd missmatch mismatch
I: frr: spelling-error-in-binary usr/lib/frr/pimd bootsrap bootstrap
I: frr: spelling-error-in-binary usr/lib/frr/pimd Unknwon Unknown
I: frr: spelling-error-in-binary usr/lib/frr/zebra Requsted Requested
I: frr: spelling-error-in-binary usr/lib/frr/zebra uknown unknown
I: frr: spelling-error-in-binary usr/lib/x86_64-linux-gnu/frr/libfrr.so.0.0.0 overriden overridden

This commit fixes all of them except the bgp `recieved` issue due to
it being part of json output.  That one will need to go through
a deprecation cycle.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-19 10:36:53 -04:00
Chirag Shah
838cef6d7e zebra: fix advertise svi ip as macip route
PR #3745 added EVPN feature to advertise individual
SVI-IPs as MAC-IP routes.
Fix a condition in zebra to send MAC and IP pair
to bgpd when the feature is enabled.

Testing Done:

Originator VTEP:
TORC11:~# ip -br addr show VxU-1002
VxU-1002         UP             45.0.2.2/24 2001:fee1:0:2::2/64

show bgp l2vpn evpn vni 1004
VNI: 1004 (known to the kernel)
  Type: L2
  Tenant-Vrf: default
  RD: 27.0.0.11:3
  Advertise-svi-macip : Yes
  Import Route Target:
    10:1004
  Export Route Target:
    10:1004

Remote vtep evpn route output for 45.0.4.2:

BGP routing table entry for 27.0.0.11:3:[2]:[0]:[48]:[00:02:00:00:00:2f]:[32]:[45.0.4.2]
Paths: (2 available, best #1)
  Advertised to non peer-group peers:
  MSP1(uplink-1) MSP2(uplink-2)
  Route [2]:[0]:[48]:[00:02:00:00:00:2f]:[32]:[45.0.4.2] VNI 1004
  64435 65546
    36.0.0.11 from MSP1(uplink-1) (27.0.0.9)
      Origin IGP, valid, external, bestpath-from-AS 64435, best (First path received)
      Extended Community: RT:10:1004 ET:8
      Last update: Thu Aug  8 18:09:13 2019

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-08-08 12:01:19 -07:00
Mark Stapp
036d93c047 zebra: use dataplane for vxlan remote mac programming
Move vxlan remote MAC install and uninstall to the async
dataplane.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-08-02 14:54:16 -04:00
Chirag Shah
6041b6864d zebra: del auto mac when vni is down
Delete an auto MAC with no neighbor associated,
when its VNI is down.

In Following sequence stale MAC entry retained in
FRR (zebra).
- Local MAC-IP pair
- MAC is deleted in bridge fdb table
- VNI is down, triggers IP (neigh) entries removed
from FRR DB.
- MAC retained as AUTO MAC with neigh list count 0.
- When VNI is UP again, stale MAC entry retained in FRR
DB.
When the MAC-IP pair moves behind remote VTEP, local VTEP
fails to add remote entry as its MAC is in auto state.

Ticket:CM-25504
Reviewed By:
Testing Done:

Validated the sequence with fix and auto MAC is deleted
when VNI is down.
When VNI comes up, the remote MAC-IP is added to FRR (Zebra)
and kernel.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-08-01 13:21:01 -07:00
Chirag Shah
27547880d4 zebra: add info evpn to debugs
Add info info in local mac del debug,
the local sequence and assoicated neigh count.

remote_mac_ip_add modify debug to display
flags value to cover local, remote and auto flags
for the MAC.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-08-01 13:21:00 -07:00
Donald Sharp
8f86bb067e zebra: Guard debug messages
A bunch of debug code has snuck in that is unguarded.
Fix this.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-16 20:30:55 -04:00
Jafar Al-Gharaibeh
5f7faeb041
Merge pull request #4635 from AnuradhaKaruppiah/evpn-pim-replay
pimd, zebra: request for replay of VxLAN SG entries on pimd startup
2019-07-15 15:40:12 -05:00
Mark Stapp
c9049b920f lib,zebra: avoid use of ctime in monotime api
Replace a call to ctime with ctime_r in the monotime module;
update the callers of the monotime api.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-07-10 10:16:59 -04:00
Anuradha Karuppiah
ecbbc3a750 pimd, zebra: request for replay of SG entries on startup
zvni setup in zebra is controlled via bgpd i.e. advertise_all_vni
from bgpd triggers this setup. As a part of zvni creation we may need
to setup BUM mcast SG entries which are propagated to pimd for MDT setup.

Now pimd may not be present at the time of zvni creation or may restart
post zvni creation so we need a mechanism to replay (on pimd startup) and
to cleanup (on pimd stop). This is addressed via zebra_vxlan_sg_replay and
zebra_evpn_pim_cfg_clean_up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-07-03 10:11:53 -07:00
Chirag Shah
b6587fc2af zebra: evpn entries are not cleaned upon frr stop
As part of PR 4458, when a client (bgpd) goes down,
zebra cleans up any evpn state including remotely learned
neighs, macs and vteps are suppose to be cleaned up,
uninstall from kernel tables.

Neighs (arps), macs and vteps (HREP entries) were not
removed from kernel tables as the uninstall flag as not set.

Clean up l3vni associated remote neighs, macs and vteps.

Ticket:CM-25468
Reviewed By:CCR-8889
Testing Done:

Validated in evpn symmetric routing topology where
remotely learned l2/l3 vnis neigh, macs and remote
vtep (hrep) entries are installed in kernel table,
perform systemctl stop frr.service and validated
all remotely learned entries cleaned up from kernel
tables.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-07-02 07:55:05 -07:00
Sri Mohana Singamsetty
f3afd0a4e1
Merge pull request #4575 from nitinsoniism/show_mac_arp_cache_vni_json_fix
zebra: show evpn mac vni xx json output is broken
2019-06-25 17:03:14 -07:00
Donald Sharp
5bc97e1b54
Merge pull request #4458 from karamalla0406/frr4123
zebra: Clean up BGP EVPN configuration when the client, BGPD, goes down
2019-06-25 11:30:14 -04:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
Donald Sharp
efe42c51c4
Merge pull request #4294 from adharkar/frr-master-fpm_rmac
Zebra: EVPN remote RMAC download via FPM channel using netlink msg format
2019-06-22 13:28:49 -04:00
Nitin Soni
40e0224a9e zebra: show evpn mac vni xx json output is broken
Also fixes some issues related to -
show evpn arp-cache vni xx vtep yy

Ticket: CM-25380
Signed-off-by: Nitin Soni<nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8858
Testing-Done: Evpn scale test with 30K neighs
2019-06-21 06:30:46 -07:00
Kishore Aramalla
27627f9a11 zebra: Clean up BGP EVPN configuration when the client, BGPD, goes down
When BGP daemon is down, Clean up its configuration state from zebra.
When the BGP daemon is up again, it will push its configuration to zebra

Delete the MAC and neighbor information received on the BGP session,
while retaining the local MAC and local ARP entries.

Signed-off-by: Kishore Aramalla karamalla@vmware.com
2019-06-19 14:45:21 -07:00
Nitin Soni
503cf3feb3 zebra: When displaying show evpn mac vni XX add local and remote seq
Add the local and remote sequence number to the `show evpn mac vni XX`
command.

VNI 1000213 #MACs (local and remote) 2

MAC               Type   Intf/Remote VTEP      VLAN  Seq #'s
00:02:00:00:00:21 local  swp5                  213   0/0
00:02:00:00:00:43 local  vlan213               213   0/0

VNI 1000214 #MACs (local and remote) 2

MAC               Type   Intf/Remote VTEP      VLAN  Seq #'s
00:02:00:00:00:22 local  swp6                  214   0/0
00:02:00:00:00:43 local  vlan214               214   0/0

VNI 1000112 #MACs (local and remote) 5

MAC               Type   Intf/Remote VTEP      VLAN  Seq #'s
00:02:00:00:00:1b remote 6.0.0.2                     0/0
00:02:00:00:00:24 remote 6.0.0.31                    0/0
00:02:00:00:00:17 remote 6.0.0.1                     0/0
00:02:00:00:00:20 local  swp4                  112   0/0
00:02:00:00:00:43 local  vlan112               112   0/0

VNI 1000111 #MACs (local and remote) 5

MAC               Type   Intf/Remote VTEP      VLAN  Seq #'s
00:02:00:00:00:1f local  swp3                  111   0/0
00:02:00:00:00:23 remote 6.0.0.31                    0/0
00:02:00:00:00:16 remote 6.0.0.1                     0/0
00:02:00:00:00:1a remote 6.0.0.2                     0/0
00:02:00:00:00:43 local  vlan111               111   0/0

Ticket: CM-25120
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8836
Testing-Done:
2019-06-18 02:11:40 -07:00
Ameya Dharkar
a780a73896 Zebra: Handle RMAC add/delete operation and add fpm_mac_info_t
- Define a hook "zebra_mac_update" which can be registered by multiple
  data plane components (e.g. FPM, dplane).

DEFINE_HOOK(zebra_rmac_update, (zebra_mac_t *rmac, zebra_l3vni_t *zl3vni, bool
	    delete, const char *reason), (rmac, zl3vni, delete, reason))

- While performing RMAC add/delete for an L3VNI, call "zebra_mac_update" hook.

- This hook call triggers "zfpm_trigger_rmac_update". In this function, we do a
  lookup for the RMAC in fpm_mac_info_table. If already present, this node is
  updated with the latest RMAC info. Else, a new fpm_mac_info_t node is created
  and inserted in the queue and hash data structures.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-06-17 12:05:38 -07:00
Philippe Guibert
a41c4e1b1f *: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *.
For that all other code referencing to (interface)->vrf_id is replaced.
This work should not change the behaviour.
It is just a continuation work toward having an interface API handling
vrf pointer only.

some new generic functions are created in vrf:
vrf_to_id, vrf_to_name,

a zebra function is also created:
zvrf_info_lookup

an ospf function is also created:
ospf_lookup_by_vrf

it is to be noted that now that interface has a vrf pointer, some more
optimisations could be thought through all the rest of the code. as
example, many structure store the vrf_id. those structures could get
the exact vrf structure if inherited from an interface vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 14:10:28 +02:00
Donald Sharp
93b35b87fe zebra: When displaying show evpn arp-cache vni XX add local and remote seq
Add the local and remote sequence number to the `show evpn arp-cache vni XX` command.

VNI 1000111 #ARP (IPv4 and IPv6, local and remote) 15

IP                       Type   State    MAC               Remote VTEP           Seq #'s
fe80::202:ff:fe00:15     remote active   00:02:00:00:00:15 6.0.0.31              0/0
fe80::202:ff:fe00:8      local  active   00:02:00:00:00:08                       0/0
60.1.1.111               local  active   00:02:00:00:00:08                       0/0
2060:1:1:1::11           local  active   00:e0:ec:38:49:a1                       0/0
fe80::202:ff:fe00:11     remote active   00:02:00:00:00:11 6.0.0.30              0/0
2060:1:1:1::211          remote active   00:02:00:00:00:11 6.0.0.30              0/0
2060:1:1:1::121          remote active   00:02:00:00:00:0c 6.0.0.29              0/0
60.1.1.211               remote active   00:02:00:00:00:11 6.0.0.30              0/0
fe80::202:ff:fe00:c      remote active   00:02:00:00:00:0c 6.0.0.29              0/0
60.1.1.11                local  active   00:e0:ec:38:49:a1                       0/0
fe80::2e0:ecff:fe38:49a1 local  active   00:e0:ec:38:49:a1                       0/0
60.1.1.221               remote active   00:02:00:00:00:15 6.0.0.31              0/0
2060:1:1:1::111          local  active   00:02:00:00:00:08                       0/0
2060:1:1:1::221          remote active   00:02:00:00:00:15 6.0.0.31              0/0
60.1.1.121               remote active   00:02:00:00:00:0c 6.0.0.29              0/0

The seq numbers are at 0/0 because we have had no mobility events.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-03 15:11:17 -04:00
Ameya Dharkar
9d21b7c6f0 Zebra: Handle VxLAN encap in netlink rtmsg for FPM
- For data plane processing of VxLAN routes, add encap type and L3VNI info to
  rtmsg message for FPM.
- Add "RTA_ENCAP_TYPE" attribute for VxLAN encap with value 100.
  This value is not currently used for RTA_ENCAP_TYPE for any encap.
- If "RTA_ENCAP_TYPE" is 100, add "RTA_ENCAP" attribute with "RTA_VNI" as a
  nested attribute of RTA_ENCAP

Format of RTA_VNI attribute:
Len(2 bytes)       type (2 bytes)      Value(4 bytes)(VNI)
   00    08     :     00    00     :      1000

RTA_VNI attribute is a custom attribute.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-05-17 10:50:21 -07:00
Quentin Young
d8b87afe7c lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument,
so const the hash input.

BGP does it in a couple places, those cast away the const. Not great but
not any worse than it was.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-14 21:23:08 +00:00
Chirag Shah
5756dd1d07 zebra: unset sticky mac upon local deletion
if the local sticky mac delete request is received,
if there are associated neighbor entries present, mac's
only local flag is removed and marked as auto mac.

this results in next local mac learning automatically assumes
mac is sticky.

There is a case when bridge learning off is configured, user
configures sticky mac via bridge fdb add.
This MAC learns associated neighbor entry.
Later user deletes stick mac via bridge fdb del, this triggers
frr to delete mac but if there are neighbors present, frr marks
MAC as AUTO but does not remove sticky flag.
User enables bridge learning on which triggers
The mac to learn as dynamic entry and in absence of this
fix, the mac is marked as sticky.

Ticket:CM-24968
Reviewed By:CCR-8683
Testing Done:

Validated broken condition with internally reproduction
with fix and without.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-05-10 11:10:42 -07:00
Quentin Young
694bd4ce20 zebra: suppress unused variable warning
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-01 19:30:31 +00:00
Donald Sharp
8a64de72ff zebra: Fix incorrect reading of REMOTE_VTEP_[ADD|DEL]
With flooding control added recently we were not properly handling
the new flood control parameter in zebra_vxlan.c handler functions.
The error message that was being repeatedly seen:

2019/05/01 00:47:32 ZEBRA: [EC 100663311] stream_get2: Attempt to get out of bounds
2019/05/01 00:47:32 ZEBRA: [EC 100663311] &(struct stream): 0x7f0f04001740, size: 22, getp: 22, endp: 22

The fix was to ensure that both the _add and _del functions kept proper
sizing of amount of data read *and* the _del function was not
reading the flood_control data from the stream.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-30 21:29:03 -04:00
Lou Berger
31e944a8a7
Merge pull request #3045 from opensourcerouting/atoms
READY: lists/skiplists/rb-trees new API & sequence lock & atomic lists
2019-04-30 10:26:35 -04:00
Russ White
50dd75dd1f
Merge pull request #4126 from karamalla0406/4113
zebra: L3VNI's are allowed to unconfigure from any VRF
2019-04-25 18:40:52 -04:00
Anuradha Karuppiah
aa0677b4b6 zebra: use "mcast group" instead of just mcast in show and logs
Fixup done in response to Jafar's review comments.

root@act-7726-03:~# vtysh -c  "show interface vxlan1000111"
Interface vxlan1000111 is up, line protocol is up
  Link ups:       0    last: (never)
  Link downs:     0    last: (never)
  PTM status: disabled
  vrf: default
  index 95 metric 0 mtu 1500 speed 0
  flags: <UP,BROADCAST,RUNNING,MULTICAST>
  Type: Ethernet
  HWaddr: 7e:1d:c1:d5:d1:cc
  Interface Type Vxlan
  VxLAN Id 1000111 VTEP IP: 6.0.0.28 Access VLAN Id 111
  Mcast Group 239.1.1.111 >>>>>>>>>>
  Master (bridge) ifindex 99
root@act-7726-03:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-21 07:24:20 -07:00
Anuradha Karuppiah
4ab3321f29 lib, zebra: changes to propagate vxlan mcast SG entries to pimd
These updates act as triggers to pimd to -
1. join the MDT for rxing VxLAN encapsulated BUM traffic
2. register the local-vtep-ip as a source for the MDT

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Anuradha Karuppiah
abfa0a9651 zebra: trigger SG update on l2-vni<=>mcast-grp changes
An SG entry is added (if one doesn't already exist) when a l2-VNI is
associated with a mcast-grp and local-vtep-ip.

And viceversa; when the last l2-vni using a MDT is removed the SG
entry is deleted.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Anuradha Karuppiah
015d264c85 zebra: vxlan (S, G) cache management
Based code for adding (S, G) entries. These entries are created when
a mcast-group and local-VTEP-IP is associated with and L2 VNI.

The parent (*, G) entries are created implicitly on the (S, G) addition
and play the role of termination entries.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Anuradha Karuppiah
8a93734c48 zebra: maintain mcast tunnel origination and termination SG entries
Each multicast tunnel is associated with a -
1. Tunnel origination mroute that is used for forwarding the
VxLAN encapsulated flow -
S - local VTEP-IP
G - BUM mcast-group
2. And a tunnel termination entry -
S - * (any remote VTEP)
G - BUM mcast-group

Multiple L2 VNIs can share the same BUM mcast group (and local-VTEP-IP).
Zebra maintains an mcast (SG) hash table to pass this info to pimd for
subsequent MDT setup.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Anuradha Karuppiah
9718c54ef4 zebra: install flood FDB entry only if the remote VTEP asked for HER
Remote VTEPs advertise the flood mode via IMET and the ingress VTEP
needs to perform head-end-replication of BUM packets to it only if the
PMSI tunnel type is set to ingress-replication. If a type-3 route is not
rxed or rxed with a mode other than ingress-replication we can skip
installation of the flood fdb entry for that L2-VNI. In that case the
remote VTEP is either not interested in BUM traffic or is using a
"static-config" based replication mode like PIM.

Sample output with HER -
=======================
root@TORS1:~# vtysh -c "show evpn vni 1000" |grep "Remote\|flood"
 Remote VTEPs for this VNI:
  27.0.0.8 flood: HER
root@TORS1:~#

Sample output with PIM-SM -
=========================
root@TORS2:~# vtysh -c "show evpn vni 1000" |grep "Remote\|flood"
 Remote VTEPs for this VNI:
  27.0.0.7 flood: -
root@TORS2:~#

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:20 -07:00
Anuradha Karuppiah
39c46ff136 zebra: maintain the mcast-grp per-l2vni
This info is propagated to bgpd for appropriate IMET route generation.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:19 -07:00
David Lamparter
7e3a1ec742 lib: ZEBRA_NUM_OF -> array_size
The latter is widely used, e.g. in the Linux kernel.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-18 12:44:29 +02:00
Kishore Aramalla
7a6ca8a6ae zebra: L3VNI's are allowed to unconfigure from any VRF
L3VNI configured in a specific VRF is allowed to unconfigure from any
VRF, including default (global) VRF. This results L3VNI delete notification
to BGP and subsequent type-5 route uninstall from the VRF the L3VNI belong to.
This also resulted in the inconsistent running configuration.

The deleted L3VNI still shows up in its original VRF. The VRF in which the
"no vni <x>" was executed doesn't display its own L3VNI.

Added a VRF check in zebra to prevent this.

Signed-off-by: Kishore Aramalla <karamalla@vmware.com>
2019-04-11 12:04:34 -07:00
Donald Sharp
06566f41f7
Merge pull request #3923 from Tuetuopay/evpn-session-vrf
Add support for EVPN session in the non-default VRF
2019-04-03 08:00:14 -04:00
Sri Mohana Singamsetty
2b4e2584b5
Merge pull request #4018 from chiragshah6/evpn_dev
zebra: evpn dup detect handle ip state change
2019-04-02 20:28:33 -07:00
Tuetuopay
d074383c62
Merge branch 'master' into evpn-session-vrf 2019-03-28 18:41:38 +01:00
Tuetuopay
0fb2ad05d9 zebra: Move the EVPN VRF pointer to zebra_router
It had no logical reason to be in the default VRF. This moves it to the
zebra_router, which is better suited to store global references.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-27 02:16:27 +01:00
Tuetuopay
986512a320 zebra: Change checks for EVPN VRF to a macro
A lot of checks relied on the VRF ID and the EVPN VRF ID to be the same.
This patch changes those checks to the EVPN_ENABLED macro, which checks
if the VRF is the EVPN one.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-27 02:13:16 +01:00
Chirag Shah
c34e362b7e zebra: evpn dup detect handle ip state change
For a MAC-IP pair generally local/netlink msg for
MAC is received followed by Neigh. The MAC can be detected as duplicate
during this event.
When a neigh update is received, the neigh inherits DUP flag from its
MAC and along with that mark the neigh as INACTIVE.
Also, In the case of DUP detected neigh, do not update its state
to ACTIVE before determining to send notification to bgpd.

There is a time when Neigh update received prior to MAC update.
In that case neigh is marked as inactive since its MAC is
still in REMOTE state. Once the MAC update is received and
it is detected as DUPLICATE, the neigh would inherit DUP flag
but remained in inactive state.

By fixing the first case, the neigh remains in inactive once
detected as DUPLICATE in both scenarios.

The unfreeze action would mark all inherited neighs to ACTIVE,
and clears DUP flag then sends notification to bgpd (to send type-2).

Ticket:CM-24339
Reviewed By:CCR-8451
Testing Done:
Validated dup detection on both environment where neigh and mac
notification can come as either one first.
With the fix, the neigh was remained in "inactive" state
once detected as duplicate.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-03-25 15:48:53 -07:00
Chirag Shah
55328d8aca zebra: add mac ip dad timers cleanup
When MAC or IP deleted ensure to cleanup DAD timers.

Signed-off-by: Chirag Shah <chirag@cumulusnetwork.com>
2019-03-22 17:12:16 -07:00
Tuetuopay
f920dd6dc9 bgpd, zebra: Redo checks to advertise_all_vni
This replaces manual checks of the flag with a wrapper macro to convey
the meaning "is evpn enabled on this vrf?"

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-22 13:37:06 +01:00
Tuetuopay
77b998fbf0 zebra: Fixes following srimohans' advice
Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-22 11:18:31 +01:00
Tuetuopay
cff8f33b61 zebra: Lookup dad and replication settings from EVPN VRF
Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-22 11:08:01 +01:00
Tuetuopay
5e53dce31e bgpd, zebra: Rename variables of EVPN instance
Rename {bgp,zvrf}_def{ault} to {bgp,zvrf}_evpn where it makes sense,
i.e. when they contain the EVPN instance.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
a0b0b5c866 zebra/vxlan: Filter zapi messages with EVPN VRF
Since the EVPN VRF may not be the default one, compare received
messages' VRF agains the EVPN VRF and not the Default.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
2118e6a9b4 zebra/vxlan: Associate L3VNIs to EVPN VRF
This uses the EPVN VRF to store L3VNIs hashes, and looks up L2VNIs in
this VRF as they are stored there.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
43779a1127 zebra/vxlan: Send type-2/3 to EVPN BGP instance
This sends local VNIs and local MAC addresses to the BGP instance
responsible for EVPN rather than the default one.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
530db8dc03 bgpd, zebra: Scope EVPN commands to EVPN VRF
If the EVPN VRF is not the default one (i.e. with advertise-all-vni),
this allows showing its information with `show bgp l2evpn evpn ...`
commands. They do not require adding `vrf VRFNAME` since we only
support a single EVPN VRF. The same is true for zebra-specific commands
(e.g. `show evpn ...`).

Configuration commands are not restricted to the default VRF but to
the EVPN one, that is to the one bearing `advertise-all-vni`.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Tuetuopay
150971b5ec zebra: Store the EVPN VRF in the default VRF
The EVPN VRF is defined by bgpd, and is the one vrf where
`advertise-all-vni` is present.

Signed-off-by: Tuetuopay <tuetuopay@me.com>
Sponsored-by: Scaleway
2019-03-19 11:56:25 +01:00
Anuradha Karuppiah
d346c2e955 zebra: EVPN DAD trigger was causing zebra to crash
Duplicate address detection and recovery was relying on the l2-vni backptr
in the neighbor entry which was simply not initialized resulting in
a NULL pointer access in a setup with dup-addressed VMs -
VM1:{IP1,M1} and VM2:{IP1,M2}

Call stack:
(gdb) bt 6
    at lib/sigevent.c:249
    nbr=nbr@entry=0x559347f901d0, vtep_ip=..., vtep_ip@entry=..., do_dad=do_dad@entry=true,
    is_dup_detect=is_dup_detect@entry=0x7ffc7f6be59f, is_local=is_local@entry=true)
    at ./lib/ipaddr.h:86
    ip=0x7ffc7f6be6f0, ifp=0x559347f901d0, zvni=0x559347f86800) at zebra/zebra_vxlan.c:3152
(More stack frames follow...)
(gdb) p nbr->zvni
$8 = (zebra_vni_t *) 0x0 <<<<<<<<<<<<<<<<<<<<
(gdb)

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-03-15 09:29:25 -07:00
Donald Sharp
28bd0652ac zebra: Add some debugs to neighbor entry processing
When we get a neighbor entry in zebra we start processing it.
Let's add some additional debugs to the processing so that when
it bails out and we don't use the data, we know the reason.
This should help in debugging the problems from why bgp does
not appear to have data associated with a neighbor entry
in the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-08 10:46:55 -05:00
David Lamparter
86a1266c9c
Merge pull request #3853 from donaldsharp/partial_revert
zebra: Prevent crash in dad auto recovery
2019-03-06 16:00:40 +01:00
David Lamparter
d3b05897ed
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
2019-03-06 15:54:44 +01:00