Commit Graph

52 Commits

Author SHA1 Message Date
Donald Sharp
8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
sharathr
00d30205ef zebra: fix for unexpected fdb entry showing up during ifdown/ifup events
Ticket: 2674793
Testing Done:  precommit, evpn-min and evpn-smoke

The problem in this case is whenever we are triggering ifdown
followed by ifup of bridge, we see that remote mac entries
are programmed with vlan-1 in the fdb from zebra and never cleaned up.
bridge has vlan_default_pvid 1 which means any port that gets added
will initially have vlan 1 which then gets deleted by ifupdown2 and
the proper vlan gets added.

The problem lies in zebra where we are not cleaning up the remote
macs during vlan change.

Fix is to uninstall the remote macs and then install them
during vlan change.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13 18:12:05 -05:00
Sharath Ramamurthy
9464e5b865 zebra: Bug fixes in fdb read for flooded traffic and remote fdb cleanup upon vni removal
This patch addresses following issues,
- When the VLAN-VNI mapping is configured via a map and not using
  individual VXLAN interfaces, upon removal of a VNI ensure that the
  remote FDB entries are uninstalled correctly.

- When VNI configuration is performed using VLAN-VNI mapping (i.e., without
  individual VXLAN interfaces) and flooded traffic is handled via multicast,
  the multicast group corresponding to the VNI needs to be explicitly read
  from the bridge FDB. This is relevant in the case of netlink interface to
  the kernel and for the scenario where a new VNI is provisioned or comes up.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy
feffe4eea6 zebra: Handle vni determination for non-vlan-aware bridges
This patch addresses following

- Remove unused VLAN Id parameter when trying to determine the VNI associated
  with a non-VLAN aware bridge. Also, add a check to ensure that in this case,
  we have a per-VNI VXLAN interface. Due to sequence of events, it is possible
  that we may have VLAN-VNI mappings, in which case the code should return
  gracefully.

- With support for a container VXLAN interface that has VLAN-VNI mappings,
  the VXLAN interface itself may be up but a particular VNI might have
  been removed. Ensure that VNI mapping exists before proceeding with
  further processing.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy
efde4f2561 zebra: Refactoring changes for zebra_evpn_map_vlan zebra_evpn_from_svi and zl3vni_from_svi
Today to find the vni for a given (vlan, bridge) we walk over all interfaces
and filter the vxlan device associated with the bridge. With multiple vlan aware
bridge changes, we can derive the vni directly by looking up the hash table i.e.
the vlan_table of the associated (vlan, bridge) which would give the vni.

During vrf_terminate() call zebra_l2_bridge_if_cleanup if the interface
that we are removing is of type bridge. In this case, we walk over all
the vlan<->access_bd association and clean them up.

zebra_evpn_t is modified to record (vlan, bridge) details and the
corresponding vty is modified to print the same.
zevpn_bridge_if_set and zl3vni_bridge_if_set is used to set/unset the
association.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy
0adeb5fdf4 zebra: vxlan interface refactoring changes
This change refactors the zebra_vxlan_if related functionality
to a new zebra_vxlan_if.c file. zebra_vxlan_if_up/down,
zebra_vxlan_if_add/update/del is moved zebra_vxlan_if.c

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy
784d88aa14 zebra: multiple vlan aware bridge datastructure changes and vxlan device iftype derivation from netlink
This change set introduces data structure changes required for multiple vlan aware bridge
functionality. A new structure zebra_l2_bridge_if encapsulates the vlan to access_bd
association of the bridge. A vlan_table hash_table is used to record each instance
of the vlan to access_bd of the bridge via zebra_l2_bridge_vlan structure.

vxlan iftype derivation: netlink attribute IFLA_VXLAN_COLLECT_METADATA is used
to derive the iftype of the vxlan device. If the attribute is present, then the
vxlan interface is treated as single vxlan device, otherwise it would default to
traditional vxlan device.

zebra_vxlan_check_readd_vtep, zebra_vxlan_dp_network_mac_add/del is modified to
be vni aware.

mac_fdb_read_for_bridge - is modified to be (vlan, bridge) aware

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
Sharath Ramamurthy
8d30ff3b5e zebra: data structure changes for single vxlan device
This changeset introduces the data structure changes needed for
single vxlan device functionality. A new struct zebra_vxlan_vni_info
encodes the iftype and vni information for vxlan device.

The change addresses related access changes of the new data structure
fields from different files

zebra_vty is modified to take care of the vni dump information according
to the new vni data structure for vxlan devices.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
2023-02-13 18:12:04 -05:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Pooja Jagadeesh Doijode
1a4a394d45 zebra: fix JSON fields for show evpn vni detail
Few of the JSON field in show evpn vni detail command is
confusing and a few fields were missing. Following is the
updated output.

primary# show evpn vni detail json
[
  {
    "vni":200,
    "type":"L2",
    "vrf":"default",
    "tenantVrf":"default",
    "vxlanInterface":"vni200",
    "ifindex":19,
    "vxlanIfindex":19,
    "sviInterface":"br200",
    "sviIfindex":18,
    "vtepIp":"2.2.2.1",
    "mcastGroup":"0.0.0.0",
    "advertiseGatewayMacip":"No",
    "advertiseSviMacip":"No",
    "numMacs":0,
    "numArpNd":0,
    "numRemoteVteps":1,
    "remoteVteps":[
      {
        "ip":"2.2.2.2",
        "flood":"HER"
      }
    ]
  },
  {
    "vni":100,
    "type":"L3",
    "vrf":"default",
    "tenantVrf":"default",
    "localVtepIp":"2.2.2.1",
    "vxlanIntf":"vni100",
    "sviIntf":"br100",
    "state":"Up",
    "sysMac":"aa:bb:cc:dd:ee:f1",
    "routerMac":"aa:bb:cc:dd:ee:f1",
    "vniFilter":"none",
    "l2Vnis":[
      20,
      30,
      200
    ]
  }
]

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-01-27 14:37:00 +00:00
Stephen Worley
0653625d3b zebra: add some neigh del not found debugs
Add some neigh deletion debugs for when the neigh isn't
found or there is a MAC mismatch on what was sent and found.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-10-11 16:18:21 -04:00
Stephen Worley
852d9f9757 bgpd,zebra,lib: bgp evpn vni macip into two tables
Re-work the bgp vni table to use separately keyed tables for type2
routes.

So, with type2 routes, we have the main table keyed off of the IP and a
new MAC table keyed off of MACs.

By separating out the two, we are able to run path selection separately
for the neigh and mac. Keeping the two separate is also more in-line
with what happens in zebra (they are managed comptletely seperate).

With this change type2 routes go into each table like so:

```
Remote MAC-IP -> IP Table & MAC Table
Remote MAC -> MAC Table

Local MAC-IP -> IP Table
Local MAC -> MAC Table
```

The difference for local is necessary because we should not ever allow
multiple paths for a local MAC.

Also cleaned up the commands for querying the vni tables:

```
show bgp vni all type ...
show bgp vni VNI type ...

```

Old commands will be deprecated in a separate commit.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-10-11 16:18:21 -04:00
rvaratharaj
4bf66f436e Zebra EVPN Debug: Fixing log flooding when disabling MLAG leaf configuration
When disabling MLAG leaf configuration with EVPN, logs are
getting flooded for each VNI, This is the result of each Type-2
packets. Ideally, this should be under log debugging, not a warning.

Testing: UT
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2022-06-21 18:18:14 -07:00
anlan_cs
81157cbd10 zebra: remove unnecessary check for "zevpn_vrf"
The global vrf in zebra is always non-NULL. In general, it is bound to
default vrf by `zebra_vrf_init()`, at other times bound to some specific
vrf. Anyway, non-NULL.

So remove all redundant checkings for the returned value of
`zebra_vrf_get_evpn()`.

Additionally, remove the unnecessary check for `zvrf` in
`zebra_vxlan_cleanup_tables()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-13 23:31:52 -04:00
Donatas Abraitis
6006b807b1 *: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
    Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:47 +03:00
anlan_cs
8e3aae66ce *: remove the checking returned value for hash_get()
Firstly, *keep no change* for `hash_get()` with NULL
`alloc_func`.

Only focus on cases with non-NULL `alloc_func` of
`hash_get()`.

Since `hash_get()` with non-NULL `alloc_func` parameter
shall not fail, just ignore the returned value of it.
The returned value must not be NULL.
So in this case, remove the unnecessary checking NULL
or not for the returned value and add `void` in front
of it.

Importantly, also *keep no change* for the two cases with
non-NULL `alloc_func` -
1) Use `assert(<returned_data> == <searching_data>)` to
   ensure it is a created node, not a found node.
   Refer to `isis_vertex_queue_insert()` of isisd, there
   are many examples of this case in isid.
2) Use `<returned_data> != <searching_data>` to judge it
   is a found node, then free <searching_data>.
   Refer to `aspath_intern()` of bgpd, there are many
   examples of this case in bgpd.

Here, <returned_data> is the returned value from `hash_get()`,
and <searching_data> is the data, which is to be put into
hash table.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-03 00:41:48 +08:00
anlan_cs
44a84850a9 zebra: use "assert" instead of unnecessary check
Like `zvni_map_to_svi_ns()` for `ns_walk_func()`, just use "assert"
instead of unnecessary check.

Since these parameters for `ns_walk_func()`, e.g. `in_param` and others,
must not be NULL. So use `assert` to ensure the these parameters, and
remove those unnecessary checks.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-30 03:19:28 -04:00
anlan_cs
5ff58d0a47 zebra: minor changes on "zebra_evpn_mac_gw_macip_add" function
Two minor changes:
    1) Change `zebra_evpn_mac_gw_macip_add()` 's return type to `void`.
    2) Since `zebra_evpn_mac_gw_macip_add()` has already `assert` the returned
    `mac`, the check of its return value makes no sense. And keep setting
    `mac->flags` inside `zebra_evpn_mac_gw_macip_add()` is more reasonable. So
    just move the setting `mac->flags` inside `zebra_evpn_mac_gw_macip_add()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-02-18 22:49:47 -05:00
anlan_cs
38eda16a24 zebra: Delay the usage of one variable until need
In the loop, local variable `ip` is always set even if the check condition
is not satisfied.

Avoid the redundant set, move this set exactly after the check condition is
satisfied. Set `ip` only if the check condition is met, otherwise needn't.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-05 06:57:35 +08:00
Igor Ryzhov
096f7609f9 *: cleanup ifp->vrf_id
Since f60a1188 we store a pointer to the VRF in the interface structure.
There's no need anymore to store a separate vrf_id field.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-22 20:47:23 +03:00
Donatas Abraitis
08edf9c6af zebra: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18 18:45:41 +02:00
Anuradha Karuppiah
38f681e1ca zebra: ignore sync updates from bgp if the dest ES is not ready
In the window immediately after an ES deletion bgpd can send MAC-IP updates
using that ES. Zebra needs to ignore these updates to prevent creation
of stale entries.

Ticket: #2668488

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-10-15 10:43:41 -07:00
Donald Sharp
72de4110dc zebra: Convert to struct zebra_neigh as per our internal standard
We do not use typedef's to talk about structures as per our standard.
Fixing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02 10:33:23 -04:00
Donald Sharp
3198b2b347 zebra: Convert to struct zebra_mac as per our internal standard
We do not use typedef's to talk about structures as per our standard.
Fixing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02 10:33:22 -04:00
Donald Sharp
c172c032ef zebra: Convert to struct zebra_vtep as per our internal standard
We do not use typedef's to talk about structures as per our standard.
Fixing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02 10:33:22 -04:00
Donald Sharp
f6371c343a zebra: Convert to struct zebra_evpn as per our internal standard
We do not use typedef's to talk about structures as per our standard.
Fixing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-02 10:33:22 -04:00
Mark Stapp
1a3bd37f7c zebra: use more const
Use const in many more evpn apis, especially for macaddr,
ipaddr arguments.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-07-19 10:36:12 -04:00
Mark Stapp
272e11bfc4 zebra: give some evpn apis better names
Use more useful names for a few evpn apis.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-07-19 08:43:48 -04:00
Ameya Dharkar
9daa5d471a bgpd, zebra: Add svi_interface to zebra VNI and bgp EVPN structures
SVI ifindex for L2VNI is required in BGP to perform EVPN type-5 to type-2
recusrsive resolution using gateway IP overlay index.

Program this svi_ifindex in struct zebra_vni_t as well as in struct bgpevpn

Changes include:
1. Add svi_if field to struct zebra_evpn_t
2. Add svi_ifindex field to struct bgpevpn
3. When SVI (bridge or VLAN) is bound to a VxLAN interface, store it in the
zebra_evpn_t structure.
4. Add this SVI ifindex to ZEBRA_VNI_ADD
5. Store svi_ifindex in struct bgpevpn

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-06-07 17:58:23 -07:00
David Lamparter
e207132594 zebra: fix style warnings in previous commits
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-05-09 19:37:12 +02:00
Donald Sharp
38078b1d5a zebra: Add some ability to know what hash is for what vni
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-05 10:08:06 -04: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
David Lamparter
ef7b8be459 zebra: use printfrr exts in EVPN/VXLAN code
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14 22:56:07 +01:00
Anuradha Karuppiah
e4c3ece6e0 zebra: fix problem with SVI MAC not being sent to BGP
For MH the SVI MAC is advertised to prevent flooding of ARP replies.
But because of a bug the SVI MAC was being added to the zebra database
but not sent to bgpd for advertising.

Ticket: CM-33329

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

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

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

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-02-19 08:11:15 -08:00
Anuradha Karuppiah
c0c7707d0d zebra: fix problem with SVI IP being advertised even if disabled
SVI IP is being advertised unconditionally i.e. even if disabled (and
that is the default config). This can be problematic when the SVI address
is re-used across racks.

Added the user config condition in all the relevant places where the
SVI advertisement is triggered.

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

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

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

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

Ticket: CM-31626

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Anuradha Karuppiah
963b0c55fd zebra: clean zevpn references in the access bd database when the VNI is deleted
When an VNI was deleted as a part of FRR/zebra shutdown the zevpn entry
was being freed without removing its reference in the access vlan
entry (i.e. without clearing the VLAN->VNI mapping) used by MH.

Ticket: CM-31197

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-12-21 08:41:17 -08:00
Donald Sharp
34c9b28ba8 zebra: Reduce warn -> debug
During times of network trauma and when we are at large network scale
the process_remote_macip_add function can issue a zlog_warn for
a common occurrence.  Modify the code to be a debug statement.
This behavior is the same now as the process_remote_macip_del function

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-30 19:37:53 -05: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
Russ White
0a6e6613d7
Merge pull request #7089 from pguibert6WIND/netns-refactor
Netns refactor
2020-09-18 11:02:30 -04: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
Philippe Guibert
a1ce03e1fd zebra: support for macvlan interfaces
mac vlan interfaces are supported in different network namespaces.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-09-11 18:26:23 +02: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
b5fde6fd5c 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-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
9609fab712 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-09-11 18:02:50 +02: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
9d277b8c52 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-08-18 09:25:06 -07:00