summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm.c
AgeCommit message (Collapse)Author
2020-02-27Revert "*: change hash_backet to hash_bucket"Jafar Al-Gharaibeh
This reverts commit 3895c42a2eb534a70ef25412547e798c1c1ef5a1. LabN CI update needs to be coordinated before merging this Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-02-26*: change hash_backet to hash_bucketDonald Sharp
It's been a year search and destroy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-18zebra: FPM should have a way of shutting downDonald Sharp
When we shut down zebra, we were not doing anything to shut down the FPM. Perform the necessary occult rituals and stop the threads from running during early shutdown. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19Zebra: Rectifying the log messages.vdhingra
This change addresses the following : 1. Ensures zlog_debug should be under DEBUG macro check 2. Ensures zlog_err and zlog_warn wherever applicable. 3. Removed few posivite logs from fpm handling, whose frequency is high. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2019-09-02zebra/fpm: deprecation warning for protobufDavid Lamparter
We agreed on this several weeks ago on the weekly call, I just forgot to actually put it in a PR... A call for any Protobuf FPM users to raise their hand came up empty on both the mailing list as well as Slack. Let's see if this gets any response. If not, it'll be time to remove Protobuf FPM. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-07-01*: s/TRUE/true/, s/FALSE/false/Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-06-17Zebra: Address review comments for RMAC FPM feature 1Ameya Dharkar
Address minor review comments. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-06-17Zebra: Build nelink message for RMAC updatesAmeya Dharkar
- Function "zfpm_netlink_encode_mac()" builds a netlink message for RMAC updates. - To build a netlink message for RMAC updates, we use "ndmsg" in rtlink. - FPM Message structure is: FPM header -> nlmsg header -> ndmsg fields -> ndmsg attributes - Netlink message will look like: {'ndm_type': 0, 'family': 7, '__pad': (), 'header': {'flags': 1281, 'length':64, 'type': 28, 'pid': 0, 'sequence_number': 0}, 'state': 2, 'flags': 22, 'attrs': [('NDA_LLADDR', 'b2:66:eb:b9:5b:d3'), ('NDA_DST', '10.100.0.2'), ('NDA_MASTER', 11), ('NDA_VNI', 1000)], 'ifindex': 18} - Message details: nlmsghdr.nlmsg_type = RTM_NEWNEIGH(28) or RTM_DELNEIGH(29) nlmsghdr.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE for "add" , "NLM_F_REQUEST" for delete. ndmsg.ndm_family = AF_BRIDGE ndmsg.ndm_ifindex = vxlan_if (ifindex) ndmsg.ndm_state = NUD_REACHABLE ndmsg.ndm_flags |= NTF_SELF | NTF_MASTER | NTF_EXT_LEARNED Attribute "NDA_LLADDR" for MAC address Attribute "NDA_DST" for remote vtep ip Attribute "NDA_MASTER" for bridge interface ifindex. Attribute "NDA_VNI" for VNI id. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-06-17Zebra: Handle FPM connection up/down eventsAmeya Dharkar
- When the connection with the FPM socket is established, iterate through all the L3VNIs and send all the RMACs for FPM processing zfpm_conn_up_thread_cb" - We have already handled connection down even in previous commits. When the FPM connection goes down, empty mac_q and FPM mac info hash table "zfpm_conn_down_thread_cb" Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-06-17Zebra: FPM processing of mac_q and dest_qAmeya Dharkar
- FPM write thread calls "zfpm_build_updates()" to process mac_q and dest_q and to write update buffer over the FPM socket. - "zfpm_build_updates()" processes all the update queues one by one in a while loop. It will break the while loop and return if Queue processing function returns "FPM_WRITE_STOP" OR FPM write buffer is full OR all the queues are empty (no more update to process). - "zfpm_build_route_updates()" dequeues and processes route nodes from "dest_q". - "zfpm_build_mac_updates()" dequeues and processes MAC nodes from "mac_q" - These queue processing functions return with "FPM_WRITE_STOP" if the write buffer is full. Return value is "FPM_GOTO_NEXT_Q" if enough updates are processed from this queue and we want to move on to the next queue. - In each call, a queue processing function will process max "FPM_QUEUE_PROCESS_LIMIT (10000)" updates to avoid starvation of other queues. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2019-06-17Zebra: Handle RMAC add/delete operation and add fpm_mac_info_tAmeya Dharkar
- 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-17Zebra: Data structures for RMAC processing in FPMAmeya Dharkar
- FPM MAC structure: This data structure will contain all the information required for FPM message generation for an RMAC. struct fpm_mac_info_t { struct ethaddr macaddr; uint32_t zebra_flags; /* Could be used to build FPM messages */ vni_t vni; ifindex_t vxlan_if; ifindex_t svi_if; /* L2 or L3 Bridge interface */ struct in_addr r_vtep_ip; /* Remote VTEP IP */ /* Linkage to put MAC on the FPM processing queue. */ TAILQ_ENTRY(fpm_mac_info_t) fpm_mac_q_entries; uint8_t fpm_flags; }; - Queue structure for FPM processing: For FPM processing, we build a queue of "fpm_mac_info_t". When RMAC is added or deleted from zebra, fpm_mac_info_t node is enqueued in this queue for the corresponding operation. FPM thread will dequeue these nodes one by one to generate a netlink message. TAILQ_HEAD(zfpm_mac_q, fpm_mac_info_t) mac_q; - Hash table for "fpm_mac_info_t" When zebra tries to enqueue fpm_mac_info_t for a new RMAC add/delete operation, it is possible that this RMAC is already present in the queue. So, to avoid multiple messages for duplicate RMAC nodes, insert fpm_mac_info_t into a hash table. struct hash *fpm_mac_info_table; - Before enqueueing any MAC, try to fetch the fpm_mac_info_t from the hash table first. - Entry is deleted from the hash table when the node is dequeued. - For hash table key generation, parameters used are "mac adress" and "vni" This will provide a fairly unique key for a MAC(fpm_mac_info_hash_keymake). - Compare function uses "mac address", "RVTEP address" and "VNI" as the key which is sufficient to distinguish any two RMACs. This compare function is used for fpm_mac_info_t lookup (zfpm_mac_info_cmp). Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2018-09-13*: style for EC replacementsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06zebra: flog_warn conversionQuentin Young
Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14zebra: Cleanup compile issues discovered by ciDonald Sharp
Include a couple of missed headers. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14zebra, lib: error references for zebraQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-01-18zebra: Add some more debug information on read issues in FPMDonald Sharp
When we receive a read failure in handling a FPM read let's add a bit more information to what we think has gone wrong, in a hope that debugging will be a bit easier. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-05zebra: Replace SELECTED_FIB flag with a rib_dest_t pointerDonald Sharp
The SELECTED_FIB flag was placed upon the entry that we have inserted into the kernel. Remove this flag and replace with a `rib_dest_t` *selected_fib. Just keep track of the selected_fib as we modify it. This removes allot of FOREACH_RE loops as that we do not need to find the entry anymore. At this point in time I think this is a very minor performance boost. Most `rib_dest_t` structures do not typically carry more than 1 route_entry, but the minute you start having more than one entry you can and will start having significant processing time spent finding the selected_fib. A future commit may re-order the route entries and possibly keep more pointers on `rib_dest_t` to avoid lookup. This is a bit tricky because of the FIB_OVERRIDE code. Signed-off-by Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-01*: don't use deprecated stream.h macrosQuentin Young
Some of the deprecated stream.h macros see such little use that we may as well just remove them and use the non-deprecated macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-10-25lib, ospf6d, ospfd, zebra: Add ZEBRA_STRDonald Sharp
Allow us to use a ZEBRA_STR for commands Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-19Send all routes to FPM, including VRF and multicastThorvald Natvig
Signed-off-by: Thorvald Natvig <thorvald@medallia.com>
2017-09-15*: use clang's 'ForEachMacros' format style optionRenato Westphal
This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23zebra: don't print 0.0.0.0:0 for FPM configDavid Lamparter
Fixes: #319 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 4 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14*: remove VTYNL, part 3 of 6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13*: ditch vty_outln(), part 1 of 2David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29*: s/VTY_NEWLINE/VTYNL/gQuentin Young
Should be able to fit more vty_out onto one line now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29*: use vty_outlnQuentin Young
Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-08*: remove THREAD_BACKGROUNDQuentin Young
it's just an alias for a millisecond timer used in exactly nine places and serves only to complicate Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-01zebra: Refactor 'struct rib' to be 'struct route_entry'Donald Sharp
The 'struct rib' data structure is missnamed. It really is a 'struct route_entry' as part of the 'struct route_node'. We have 1 'struct route_entry' per route src. As such 1 route node can have multiple route entries if multiple protocols attempt to install the same route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-09ospf6d, zebra: remove unnecessary assertsQuentin Young
These pointers are now guaranteed to be null, so asserting the opposite will crash. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09*: update thread_add_* callsQuentin Young
Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09*: remove THREAD_ON macros, add nullity checkQuentin Young
The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-25zebra: fpm: convert into moduleDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-24Merge pull request #104 from opensourcerouting/time-cleanupDonald Sharp
Time cleanup
2017-01-23*: use monotime()David Lamparter
This is largely a bulk-replace made with coccinelle. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23*: remove quagga_gettime() return value checksDavid Lamparter
The next patch will bulk-replace these, and monotime() has time_t as return value, not an error indicator. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-18zebra: Fix compile warnings under freebsdDonald Sharp
Compiling under clang we see compiler warnings Fix them. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-17zebra: Cleanup zebra_static CLANG/SA issues.Donald Sharp
When compiling using CLANG's SA, cleanup the SA issues found. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-05Merge branch 'stable/2.0'David Lamparter
Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
2016-11-28zebra/lib: remove redundant fields from zebra_vrfRenato Westphal
There's no need to duplicate the 'vrf_id' and 'name' fields from the 'vrf' structure into the 'zebra_vrf' structure. Instead of that, add a back pointer in 'zebra_vrf' that should point to the associated 'vrf' structure. Additionally, modify the vrf callbacks to pass the whole vrf structure as a parameter. This allow us to make further simplifications in the code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-10-25Merge branch 'cmaster-next' into vtysh-grammarQuentin Young
Conflicts: vtysh/vtysh.c zebra/zebra_vty.c
2016-10-25zebra: If fpm is not turned on hide the cli for itDonald Sharp
If the FPM is not enabled properly, hide the cli for it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-17Merge branch 'cmaster-next' into vtysh-grammarQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
2016-09-30zebra: support FIB override routesTimo Teräs
FIB override routes are for routing protocols that establish shortcut routes, or establish point-to-point routes that should not be redistributed. Namely this is useful NHRP daemon to come. Zebra is extended to select two entries from RIB the "best" entry from routing protocols, and the FIB entry to install to kernel. FIB override routes are never selected as best entry, and thus are never adverticed to other routing daemons. The best FIB override, or if it does not exist the otherwise best RIB is selected as FIB entry to be installed. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: Massage to fit cumulus tree] Signed-off-by: Christian Franke <chris@opensourcerouting.org>