summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm.c
AgeCommit message (Collapse)Author
2023-11-07*: Remove netlink headers from lib/zebra.hDonald Sharp
The headers associated with netlink code really only belong in those that need it. Move these headers out of lib/zebra.h and into more appropriate places. bgp's usage of the RT_TABLE_XXX defines are probably not appropriate and will be cleaned up in future commits. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-19zebra: On shutdown stop hook calls for fpm rmac updatesDonald Sharp
When shutting down zebra, the hook for the rmac update was not being unregistered. As such it would be possible to get into a condition where more rmacs are being added to the queue for handling in the future after we are told to shutdown. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-19zebra: Properly handle zfpm_g->t_conn_down in zebra_fpm.cDonald Sharp
The t_conn_down pointer was being set to NULL when it already was. The t_conn_down pointer was being dropped( and leaving a thread possibly running in the background ) which could cause problems on shutdown. And finally when shutting down the t_conn_down event was not being stopped at all. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_should_yield and thread_set_yield_timeDonald Sharp
Convert thread_should_yield and thread_set_yield_time to event_should_yield and event_set_yield_time Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31zebra: Add missing enums to switch statementsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-29zebra: Remove duplicate updation of msg_typeSpoorthi K
Signed-off-by: Spoorthi K <spk@redhat.com>
2022-10-06*: fix some malformed CLI docstringsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-09-24zebra: fix fpm crashanlan_cs
Fix issue#11996. When removing VRF ( all routes of this VRF), zebra mistakenly forgot to check whether its routes are in update queue of FPM. So FPM module will crash during its dealing with these routes, which are already freed. Add a new HOOK `rib_shutdown()`, `zebra_rtable_node_cleanup()` will use it to remove these routes from update queue of FPM module before freeing them. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-07-21zebra: Convert thread_cancel to THREAD_OFFDonald Sharp
Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.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-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-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-20zebra: Fix ignored return value from inet_ptonDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-13zebra: Fix IPv4 routes with IPv6 link local next hops install in FPMNikhil Kelapure
Description: Currently IPv4 routes with IPv6 link local next hops are not properly installed in FPM. Reason is the netlink decoding truncates the ipv6 LL address to 4 byte ipv4 address. Ex : fe80:: is directly converted to ipv4 and it results in 254.128.0.0 as next hop for below routes show ip route Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, > - selected route, * - FIB route, q - queued, r - rejected, b - backup B>* 2.1.0.0/16 [200/0] via fe80::268a:7ff:fed0:d40, Ethernet0, weight 1, 02:22:26 B>* 5.1.0.0/16 [200/0] via fe80::268a:7ff:fed0:d40, Ethernet0, weight 1, 02:22:26 B>* 10.1.0.2/32 [200/0] via fe80::268a:7ff:fed0:d40, Ethernet0, weight 1, 02:22:26 Hence this fix converts the ipv6-LL address to ipv4-LL (169.254.0.1) address before sending it to FPM. This is inline with how these types of routes are currently programmed into kernel. Signed-off-by: Nikhil Kelapure <nikhil.kelapure@broadcom.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_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-07-28zebra: bugfix of error quit of zebra, due to no nexthop ACTIVEbatmancn
There exists some rare situations where fpm will attempt to send a route update with no valid nexthops. In that case an assert would be hit. This is not good for trying to keep your routing daemons up and running when we can safely just recover the situation. Fixes #7588 Signed-off-by: batmancn <batmanustc@gmail.com> <fixed commit message, and used zlog_err> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-04-21build: make builddir include path consistentDavid Lamparter
... by referencing all autogenerated headers relative to the root directory. (90% of the changes here is `version.h`.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-03-22zebra: kill zebra_memory.h, use MTYPE_STATICDavid Lamparter
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-17*: require semicolon after FRR_DAEMON_INFO & co.David Lamparter
... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-14fpm: use printfrr extsDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-02*: fix all backetsIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-01-15Merge pull request #7868 from mjstapp/fix_fpm_conn_upDonald Sharp
zebra: don't set connection-up event pointer directly
2021-01-14zebra: don't set connection-up event pointer directlyMark Stapp
Use thread_cancel to reset the connection-up processing timer. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-01-14zebra: Scale setup RMAC is send multiple time to fpmKishore Kunal
Thread zfpm_conn_up_thread_cb can Yield and send RMAC multiple times to FPM. Signed-off-by: Kishore Kunal <kishorekunal01@broadcom.com>
2020-10-23*: unify thread/event cancel macrosMark Stapp
Replace all lib/thread cancel macros, use thread_cancel() everywhere. Only the THREAD_OFF macro and thread_cancel() api are supported. Also adjust thread_cancel_async() to NULL caller's pointer (if present). Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22zebra: replace inet_ntoaMark Stapp
Stop using inet_ntoa - use %pI4 or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-14*: un-split strings across linesDavid Lamparter
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-05-08zebra: Remvoe typedef for zfpm_glob_tDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef zfpm_msg_format_eDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove the typedef for zfrpm_state_tDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef of zfpm_stats_tDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef around zfpm_rnodes_iterDonald Sharp
Typedef's are not used in our system remove. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-20*: sprintf -> snprintfQuentin Young
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-16*: move CLI node names to cmd_node->nameDavid Lamparter
And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: move CLI parent data to cmd_node->parent_nodeDavid Lamparter
Same as before, instead of shoving this into a big central list we can just put the parent node in cmd_node. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove second parameter on install_node()David Lamparter
There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove cmd_node->vtyshDavid Lamparter
The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: clean up cmd_node initializersDavid Lamparter
... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-10zebra: Address sequencing issue while sending RMAC via FPMAmeya Dharkar
Issue: For consecutive messages such as MAC1 -> VTEP1 add MAC1 -> VTEP2 add MAC1 -> VTEP1 add Final state, i.e. (MAC1 -> VTEP1 add) should be sent via FPM. But, with current code, FPM will send (MAC1 -> VTEP2 add) RCA: When FPM receives (MAC1, VTEP1), it stores it in the FPM processing queue and hash table. When FPM receives (MAC1, VTEP2), this entry is stored as another node as hash table key is (mac, vtep and vni) IF FPM again receives (MAC1, VTEP1), we fetch this node in the hash table which is already enqueued. When the FPM queue is processed, we will send FPM message for (MAC1, VTEP1) first and then for (MAC1, VTEP2) This sequencing issue happened because the key of the table is (MAC, VTEP, VNI) Fix: Change the key of the hash table to (MAC, VNI) So, every time we receive a new update for (MAC1, VNI1), we will find a node in the processing queue corresponding to MAC1 if present. We will update this same node for every operation related to (MAC1, VNI1) Thus, at the time when FPM processes this node, it will have latest MAC1 info. Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2020-02-28*: change hash_backet to hash_bucketDonald Sharp
It's been a year search and destroy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>