summaryrefslogtreecommitdiff
path: root/zebra/zebra_vxlan.c
AgeCommit message (Collapse)Author
2022-09-01zebra: fix missing tenant vrf change notificationanlan_cs
zebra can change l2vni's tenant vrf with new `vid`, and then notify bgpd to change also. But this notification is wrongly missed, so bgpd knows nothing about it. It affects evpn routes, which are related to tenant vrf. Need to notify bgpd of the `vid` change. Changes l2vni 100 of vxlan's `vid` so as to change its svi interface from default to vrf1, then check bgp's vni status. Before: (Ignored irrelevent columns) ``` host#show bgp l2vpn evpn vni VNI Type RD Tenant VRF * 100 L2 66.66.66.66:2 default <- No change ``` After:(Ignored irrelevent columns) ``` host#show bgp l2vpn evpn vni VNI Type RD Tenant VRF * 100 L2 66.66.66.66:2 vrf1 <- Updated ``` Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-08-26zebra: fix missing vni transitionanlan_cs
`show evpn vni detail` doesn't reflect any change in vni transition. Need to add processing in command of `[no] vni (1-16777215)`. With the config: ``` ! vni 66 ! vrf vrf1 vni 88 exit-vrf ! ``` Before: ``` (config-vrf)# no vni 88 (config-vrf)# do show evpn vni detail VNI: 66 Type: L3 Tenant VRF: default L2 VNIs: <- Empty ``` After: ``` (config-vrf)# no vni 88 (config-vrf)# do show evpn vni detail VNI: 66 Type: L3 Tenant VRF: default L2 VNIs: 88 <- ``` Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-08-09zebra: correct one comment for evpn-mhanlan_cs
These moved mac addresses are actually in active status during moving phase, just correct comment. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-08-03zebra: fix bond down for evpn-mhanlan_cs
The test case is with `redirect-off` in evpn multi-homing environment: ``` evpn mh redirect-off ``` After the environment is setup, do the following steps: 1) Let one member of ES learn one mac: ``` 2e:52:bb:bb:2f:46 dev ae1 vlan 100 master bridge0 static ``` Now everything is ok and the mac can be synced to other ES peers. 2) Shutdown bond1. At this time, zebra will get three netlink messages, not one as current code expected. Like: ``` e4:f0:04:89:b6:46 dev vxlan10030 vlan 30 master bridge0 static <-A e4:f0:04:89:b6:46 dev vxlan10030 nhid 536870913 self extern_learn <-B e4:f0:04:89:b6:46 dev vxlan10030 vlan 30 self <-C ``` With A), zebra will wrongly remove this mac again: ``` ZEBRA: dpAdd remote MAC e4:f0:04:89:b6:46 VID 30 ZEBRA: Add/update remote MAC e4:f0:04:89:b6:46 intf vxlan10030(26) VNI 10030 flags 0xa01 - del local ZEBRA: Send MACIP Del f None MAC e4:f0:04:89:b6:46 IP (null) seq 0 L2-VNI 10030 ESI - to bgp ``` With C), zebra will wrongly add this mac again: ``` ZEBRA: Rx RTM_NEWNEIGH AF_BRIDGE IF 26 VLAN 30 st 0x2 fl 0x2 MAC e4:f0:04:89:b6:46 nhg 0 ZEBRA: dpAdd remote MAC e4:f0:04:89:b6:46 VID 30 ``` zebra should skip the two messages with `vid`. Otherwise, it will send many *wrong* messages to bgpd, and the logic is wrong. `nhg/dst` is in 2nd message without `vid`, it is useful to call `zebra_evpn_add_update_local_mac()`. But it will fail with "could not find EVPN" warning for no `vid`, can't call `zebra_evpn_add_update_local_mac()`: With B): ``` ZEBRA: Rx RTM_NEWNEIGH AF_BRIDGE IF 26 st 0x2 fl 0x12 MAC e4:f0:04:89:b6:46 nhg 536870913 ZEBRA: dpAdd local-nw-MAC e4:f0:04:89:b6:46 VID 0 ZEBRA: Add/Update MAC e4:f0:04:89:b6:46 intf ae1(18) VID 0, could not find EVPN ``` Here, we can get `vid` from vxlan interface instead of from netlink message. In summary, `zebra_vxlan_dp_network_mac_add()` will process the three messages wrongly expecting only one messsage, so its logic is wrong. Just skip the two unuseful messages with `vid`. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-06-29zebra: make rib_process_dplane_results own ctx freeingDonald Sharp
The rib_process_dplane_results function was having each sub function handler process the results and then free the ctx. Lot's of functionality that needs to remember to free the context. Let's just free it in the main loop. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-23zebra: move the check for l3vnianlan_cs
The two checks for l3vni have been already done in `lib_vrf_zebra_l3vni_id_modify()` as it should be. And it is improper that the two checks are put after `zebra_vxlan_handle_vni_transition()`, which will do real things. My original fix is to remove them. But NB module can't guarantee many changes, so we'd better keep them in `zebra_vxlan_process_vrf_vni_cmd()` in APPLY stage for safe. Just move them in front of `zebra_vxlan_handle_vni_transition()`. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-28zebra: Update advertise-svi-ip MACIPs w/ new MACTrey Aspelund
When the kernel was sending an RTM_NEWLINK updating the MAC of a known SVI, Type-2 routes created by advertise-svi-ip were not getting updated with the new address. This adds removal of any old Type-2 routes (with old MAC) and creation of new Type-2 routes (with new MAC) into RTM_NEWLINK processing. Fixes: #11174 Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2022-05-19Merge pull request #11210 from anlancs/fix/zebra-leak-vtpSri Mohana Singamsetty
zebra: fix missing delete vtep during vni transition
2022-05-16zebra: fix missing delete vtep during vni transitionanlan_cs
All `vtep`s in dplane should be deleted/uninstalled during vni transition. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-16zebra: remove unncecessary check for l3vnianlan_cs
Since `l3vni` created by `zl3vni_add()` is always valid, remove the check for it. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-05-13zebra: remove unnecessary check for "zevpn_vrf"anlan_cs
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-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-08*: Avoid casting to the same type as on the leftDonatas Abraitis
Just not necessary. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-03*: remove the checking returned value for hash_get()anlan_cs
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-04-05Merge pull request #10928 from anlancs/zebra-cleanup-1Donald Sharp
zebra: use "assert" instead of unnecessary check
2022-03-31zebra: fix missing vrf change of l2vni on vxlan interfaceanlan_cs
The bounded vrf of `l2vni/zevpn` have wrong relation with the order in which vxlan interface and svi interface are set. If set vxlan interface with vlanid first, then set svi interface with vrf, it is ok that vxlan interface will get correct `vrf` inherited from svi. But reverse the set sequence (i.e. set svi first, then vxlan), vxlan interface can't get correct `vrf`, becasue the handling of `ZEBRA_VXLIF_VLAN_CHANGE` missed inheritting `vrf` by mistake. ``` host# do show evpn vni 101 VNI: 101 Type: L2 Tenant VRF: vrf1 ``` So update `vrf` ("Tenant VRF") of l2vni in `zebra_vxlan_if_update()`. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-30zebra: use "assert" instead of unnecessary checkanlan_cs
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-22Merge pull request #10726 from chiragshah6/fdev2Sri Mohana Singamsetty
zebra: evpn revamp l3vni routermac db
2022-03-15Merge pull request #10770 from chiragshah6/evpn_dev3Sri Mohana Singamsetty
zebra: evpn disable remove l2vni from l3vni list
2022-03-15Merge pull request #10693 from anlancs/bgpd-add-check-nsDonald Sharp
zebra: use "assert" instead of unnecessary check
2022-03-12zebra: use "assert" instead of unnecessary checkanlan_cs
Since `zvni_map_to_svi_ns()` is used to find and return one specific interface based on passed attributes of SVI, so the two parameters `in_param` and `p_ifp` must not be NULL. Passing NULL `p_ifp` makes no sense, so the check `if (p_ifp)` is unnecessary. So use `assert` to ensure the two parameters, and remove that unnecessary check. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-10zebra: evpn disable remove l2vni from l3vni listChirag Shah
Upon 'no advertise-all-vni', cleanup l2vni from its tenant-vrf's l3vni list, instead of passed zvrf->l3vni which will not be present in case of default instance. Reviewed By: Testing Done: Before Fix: ---------- TORC12(config-router-af)# advertise-all-vni TORC12(config-router-af)# end TORC12# show evpn vni 4001 VNI: 4001 Type: L3 Tenant VRF: vrf1 Vxlan-Intf: vni4001 State: Up Router MAC: 44:38:39:ff:ff:01 L2 VNIs: 134217728 0 1000 1002 <----- After Fix: ---------- TORC12# show evpn vni 4001 VNI: 4001 Type: L3 Tenant VRF: vrf1 Vxlan-Intf: vni4001 State: Up Router MAC: 44:38:39:ff:ff:01 L2 VNIs: 1000 1002 Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-03-10zebra: cleanup host prefix from rmacChirag Shah
Ticket:#2798406 Testing Done: Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-03-10zebra: print rmac nexthop listChirag Shah
Ticket:#2798406 Reviewed By: Testing Done: Before change: -------------- TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 1 Prefixes: [1]:[00:00:00:00:00:00:00:00:00:00]:[::]/352 TORS1# TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 json { "routerMac":"44:38:39:ff:ff:01", "vtepIp":"36.0.0.11", "refCount":1, "localSequence":0, "remoteSequence":0, "prefixList":[ "[1]:[00:00:00:00:00:00:00:00:00:00]:[::]\/352" ] } After change: ------------- TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 0 Prefixes: TORS1# TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 json { "routerMac":"44:38:39:ff:ff:01", "vtepIp":"36.0.0.11", "nexthops":[ "36.0.0.11" ] } Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-03-10zebra: remove host prefix mapping in rmacChirag Shah
RMAC keeping list of nexthops to keep track of its existiance, remove the (old way) host prefix mapping. Ticket: #2798406 Reviewed By: Testing Done: TORS1# show evpn rmac vni 4001 mac 44:38:39:ff:ff:01 MAC: 44:38:39:ff:ff:01 Remote VTEP: 36.0.0.11 Refcount: 0 Prefixes: Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-03-10zebra: maintain list of nhs in rmac dbChirag Shah
Keep the list of remote-vteps/nexthops in rmac db. Problem: In CLAG deployment there might be a situation where CLAG secondary sends individual ip as nexthop along with anycast mac as RMAC. This combination is updated in zebra's rmac cache. Upon recovery at clag secondary sends withdrawal of the incorrect rmac and nexthop mapping. The RMAC entry mapping to nh is not cleaned up properly in the zebra rmac cache. Fix: Zebra rmac db needs to maintain a list of nexthops. When a bgp withdrawal for rmac to nexthop mapping is received, remove the old nexthop from the rmac's nh list and if the host reference still remains for the RMAC,fall back to the nexthop one remaining in the list. At most you expect two nexthops mapped to RMAC (in clag deployment). Ticket: 2798406 Reviewed By: Testing Done: CLAG primary and secondary have advertise-pip enabled advertise type-5 route (default route) with individual IP as nh and individual svi mac as rmac. - disable advertise pip on both clag devices, this results in advertisement of routes with anycast ip as nh and anycast mac as rmac. - disable peerlink on clag primary, this triggers clag secondary to (transitory) send bgp update with individual ip as nh and anycast mac as rmac. - At the remote vtep: Check the zebra's rmac cache/nh mapping correctly and points to anycast rmac and anycast ip as nh of the clag system. Signed-off-by: Chirag Shah <chirag@nvidia.com>
2022-02-06zebra: Remove unnecessary checkanlan_cs
Since `assert` is already done, just remove these unnecessary check. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2021-12-19zebra: correct one spell erroranlan_cs
Signed-off-by: anlan_cs <anlan_cs@tom.com>
2021-11-27*: Remove redundand braces for single statement blocksDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25zebra: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-22*: cleanup ifp->vrf_idIgor Ryzhov
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-18zebra: Replace inet_ntop to %pI4/6 for JSON outputsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-12zebra: use tabs instead of spaces zebra_vxlan.cQuentin Young
Bad style introduced in https://github.com/FRRouting/frr/pull/10006 Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-11-08zebra: svi down remove l2vni from l3vni listChirag Shah
Problem: L2-VNI SVI down followed by L2-VNI's vxlan device deletion leads to stale entry into L3VNI's L2-VNI list. Solution: When L2-VNI associated SVI is down, default vrf is the new tenant vrf. Remove L2-VNI from L3VNI's l2vni list as L3VNI/VRF is no longer valid in absence of associated SVI. When SVI is up re-add L2-VNI into associated VRF's L3VNI. The above remove/add from the L3VNI's L2VNI list is already done when vxlan or L2-VNI is flaped, just need to handle when SVI is flapped. Ticket:#2817127 Reviewed By: Testing Done: After deleting SVI following by L2-VNI deletion, L3VNI's L2-VNI list delets the L2-VNI. (no stale entry). After adding back SVI/L2-VNI, L3VNI list adds back the L2-VNI and it is associated right tenant VRF. Signed-off-by: Chirag Shah <chirag@nvidia.com>
2021-10-28zebra: don't use if_lookup_by_index_all_vrfIgor Ryzhov
if_lookup_by_index_all_vrf doesn't work correctly with netns VRF backend as the same index may be used in multiple netns simultaneously. In both case where it's used, we know the VRF in which we need to lookup for the interface. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-17zebra: handle bridge mac address update in evpn contextsPhilippe Guibert
when running bgp evpn rt5 setup, the Rmac sent in BGP updates stands for the MAC address of the bridge interface. After having loaded frr configuration, the Rmac address is not refreshed. This issue can be easily reproduced by executing some commands: ip netns exec cust1 ip link set dev br1000 address 2e:ab:45:aa:bb:cc Actually, the BGP EVPN contexts are kept unchanged. That commit proposes to fix this by intercepting the mac address change, and refreshing the vxlan interfaces attached to te bridge interface that changed its MAC address. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-07zebra: update zl3vni when bridge link refreshed in other namespacesPhilippe Guibert
When running bgp evpn rt5 setup with vrf namespace backend, once the BGP configuration loaded, some refresh like the config change of a vxlan interface is not taken into account. As consequence, the BGP l2vpn evpn entries are empty. This can happen by recreating vxlan interface like follows: ip netns exec cust1 ip li del vxlan1000 ip link add vxlan1000 type vxlan id 1000 dev loopback0 local 10.209.36.1 learning ip link set dev vxlan1000 mtu 9000 ip link set dev vxlan1000 netns cust1 ip netns exec cust1 bash ip link set dev vxlan1000 up ip link set dev vxlan1000 master br1000 Actually, changing learning attribute requires recreation, and this change needs to manually reload the frr configuration. The update mechanism in zebra about vxlan interface updates is already put in place, but it does not work well with namespace based vrf backend. The function zl3vni_from_svi() is then modified to parse all the interfaces of each namespace. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-02zebra: Convert to `struct zebra_neigh` as per our internal standardDonald Sharp
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-02zebra: Convert to `struct zebra_l3nvi` as per our internal standardDonald Sharp
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-02zebra: Convert to `struct zebra_vxlan_sg` as per our internal standardDonald Sharp
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-02zebra: Convert to `struct zebra_mac` as per our internal standardDonald Sharp
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-02zebra: Convert to `struct zebra_vtep` as per our internal standardDonald Sharp
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-02zebra: Convert to `struct zebra_evpn` as per our internal standardDonald Sharp
We do not use typedef's to talk about structures as per our standard. Fixing. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-07-29zebra: use a separate dummy prefix for referencing v6 nexthopsAnuradha Karuppiah
v4 and v6 host/refernce prefixes need to be setup separately for [RMAC, VTEP] entries as the VTEP is always normalized to a v4 addr. Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2021-07-22zebra: Remove MM seq from evpn rmac json outputTrey Aspelund
Currently 'show evpn rmac vni .. mac .. json' includes fields for localSequence and remoteSequence, which are misleading since they aren't applicable to a macs in the IP-VRF mac table (RMAC). This removes the localSequence + remoteSequence fields from the output. Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2021-07-19zebra: process EVPN remote VTEP updates from the workqueueMark Stapp
Move remote VTEP updates from immediate, inline processing in their ZAPI message handlers to the main workqueue. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-07-19zebra: use workqueue for vxlan remote macip updatesMark Stapp
Enqueue incoming vxlan remote macip updates on the main workqueue, instead of performing the updates immediately, in-line. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-07-19zebra: give some evpn apis better namesMark Stapp
Use more useful names for a few evpn apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-07Zebra: FPM support for gateway IP overlay IndexAmeya Dharkar
FPM sends VNI to the data plane with the EVPN prefix. For pure type-5 EVPN route, nexthop interface of EVPN prefix is L3VNI SVI. Thus, we encode L3VNI corresponding to the nexthop vrf with rtmsg for this prefix. For EVPN type-5 route with gateway IP overlay index, we supporting asymmetric IRB. Thus, nexthop interface is L2VNI SVI. So, instead of fetching vrf VNI, fetch VNI corresponding to the nexthop SVI and encode it in the rtmsg for EVPN prefix. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-06-07bgpd, zebra: Add svi_interface to zebra VNI and bgp EVPN structuresAmeya Dharkar
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>