summaryrefslogtreecommitdiff
path: root/zebra/zebra_pw.c
AgeCommit message (Collapse)Author
2023-12-11zebra: Properly unregister hook on shutdownDonald Sharp
the zebra pseudo wire code was registering a callback per vrf. These callbacks are not per vrf based. They are vrf agnostic so this was a mistake. Modify the code to on startup register once and on shutdown unregister once. Finally rename the zebra_pw_init and zebra_pw_exit functions to more properly reflect when they are called. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-12zebra: remove unnecessary check for default vrfanlan_cs
The default vrf is generally non-NULL, except when shutdown. So, most of the time it is not necessary to check if it is NULL, we should remove the useless checks for it. Searched them with exact match: ``` grep -rI "zebra_vrf_lookup_by_id(VRF_DEFAULT)" | wc -l 31 ``` Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-03-28zebra: Use zebra_vrf_lookup_by_id when we canDonald Sharp
Let's make this as consistent as is possible. 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 THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
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>
2022-08-11zebra: Fix crash in shutdown w/ pw thread still runningDonald Sharp
I am seeing the zebra_pw_install_retry timer thread crashing on shutdown The shutdown of the timer is only in an if () { ... } else if Let's just always shut it down. Signed-off-by: Donald Sharp <sharpd@nvidia.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-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-11-25zebra: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-11zebra: revise pw reachability logicMark Stapp
Modify the pseudowire reachability logic so that it returns success if there is at least one installed labelled nexthop for the route resolving the pw destination. We also check for valid backup nexthops if necessary, in case there's been a switchover event. Only OpenBSD requires that _all_ nexthops be labelled, so we have a more strict version of the logic also. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-03-17*: require semicolon after DEFINE_QOBJ & co.David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_HOOK & co.David Lamparter
See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
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-07-27Merge pull request #6765 from mjstapp/backup_nhg_netlinkRenato Westphal
lib,zebra: support multiple backup nexthops
2020-07-20zebra: include backup nexthops for pseudowiresMark Stapp
Include any installed backup nexthops when installing pseudowires; include installed backups in vty and json pw show output. Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-07-07zebra: add fib nhg for backups, revise apiMark Stapp
Add an nhg for the fib-installed backup nexthops; rename an api to access the fib-installed nexthop nhg. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-10Merge pull request #6471 from volta-networks/fix_zebra_register_rnh_pseudowireDonald Sharp
zebra: Every time zebra receives a ZEBRA_PW_SET, zebra should evaluate nh
2020-06-03zebra: Every time zebra receives a ZEBRA_PW_SET, zebra should evaluate nhKaren Schoener
Every time zebra receives a ZEBRA_PW_SET, zebra should call zebra_evaluate_rnh. This fixes a race condition where zebra sometimes fails to install a pseudowire that is 'up', and has a reachable next hop. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-06-01ldpd: Relay data plane pseudowire status in LDP notificationKaren Schoener
Provide a way for the data plane to indicate pseudowire status (such as: not forwarding, AC failure). On a data plane pseudowire install failure, data plane sets the pseudowire status. Zebra relays the pseudowire status to LDP. LDP includes the pseudowire status in the LDP notification to the LDP peer. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-05-11ldpd and Zebra: Expand existing debug commands.lynne
L2VPN PW are very hard to determine why they do not come up. The following fixes expand the existing show commands in ldp and zebra to display a reason why the PW is in the DOWN state and also display the labeled nexthop route selected to reach the PW peer. By adding this information it will provide the user some guidance on how to debug the PW issue. Also fixed an assert if labels were changed for a PW that is between directly connected peers. Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2020-04-28zebra: fix zebra pseudowire manager NHTKaren Schoener
Intermittently, there is a 30 second delay for a LDP pseudowire to become operational. One way to reproduce the issue is: Once PW is up, shutdown link to trigger a change to the pseudowire's next hop, and then restore link to cause pseudowire to return to original NH. Problem Descripton: The Zebra PW manager installs pseudowires in the data plane when the following two conditions are met: 1. Pseudowire is labeled via LDP mapping messages 2. A labeled NH route exists to reach the remote pseudowire endpoint The Zebra PW manager registers a NHT callback when a pseudowire is enabled. This allows the Zebra PW manager to install or reinstall the pseudowire. The Zebra PW manager deregisters for the NHT callback when the pseudowire is disabled. When LDP learns the remote-pseudowire status is 'not forwarding', LDP notifies Zebra that the pseudowire is disabled. This creates a race condition where a new labeled NH can be resolved after the Zebra PW manager deregistered for the NHT callback. For static pseudowires, it makes sense for Zebra PW manager to deregister for NHT callbacks for disabled pseudowires. Static pseudowires become disabled via CLI configuration commands. For LDP pseudowires, the Zebra PW manager should not deregister for NHT callbacks for disabled pseudowires. Overview of changes: 1. Zebra PW manager should not deregister for NHT callbacks when an LDP pseudowire is disabled. Zebra PW manager will register for NHT callbacks when the LDP pseudowire is first enabled. Zebra PW manager will deregister for NHT callbacks when the LDP pseudowire is deleted. 2. Remove the 30 second timer that was added in PR4122. PR4122 tried to fix this race condition with a timer. Once we eliminate the race condition (by keeping the Zebra PW manager registered for NHT callbacks), this timer can be removed. 3. Zebra PW manager handling of static pseudowires will remain as-is. Zebra PW manager will register for NHT callbacks when the static pseudowire is enabled. Zebra PW manager will deregister for NHT callbacks when the static pseudowire is disabled. Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
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-02-27zebra: Embed lib nexthop-group in zebra hash entryMark Stapp
Embed nexthop-group, which is just a pointer, in the zebra nexthop-hash-entry object, rather than mallocing one. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-04lib,zebra: use nhg_hash_entry pointer in route_entryMark Stapp
Replace the existing list of nexthops (via a nexthop_group struct) in the route_entry with a direct pointer to zebra's new shared group (from zebra_nhg.h). This allows more direct access to that shared group and the info it carries. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-10-25zebra: Replace nexthop_group with pointer in route entryDonald Sharp
In the route_entry we are keeping a non pointer based nexthop group, switch the code to use a pointer for all operations here and ensure we create and delete the memory. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-10zebra: pseudowire event recovery (DoS fix)F. Aragon
When having a route recovery, because of the route installation cycling and the next hop label check, it could happen that the PW never gets recovered. The original code shows the intention of retrying, but the code was missing. The fix includes the call to the timer programming the recovery attempt. Example for reproducing the issue: |P1| <-> |P2| <-> |P3| - Being P1, P2, P3 nodes, using IS-IS as IGP, and having a pseudowire betwen P1 and P3 (P1, P2, P3 having configured LDP daemons). - After 60 seconds, kill the IS-IS daemon in P2. - Wait 30 seconds - Launch again the IS-IS daemon in P2 - The bug/issue is that after P1 <-> P3 recovering connectivity sometimes the PW is not recovered because the reason explained in the first paragraph. Signed-off-by: F. Aragon <paco@voltanet.io>
2019-02-05Merge pull request #3684 from mjstapp/dplane_pwDonald Sharp
zebra: async dataplane for pseudowires
2019-01-31zebra: Remove `struct zebra_t`Donald Sharp
This structure is unused anymore and does not belong in zserv.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31zebra: Move the master thread handler to the zrouter structureDonald Sharp
The master thread handler is really part of the zrouter structure. So let's move it over to that. Eventually zserv.h will only be used for zapi messages. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-25zebra: convert PW updates to async dataplaneMark Stapp
Add accessors for pw attributes; init pw attributes; replace 'hook' calls for pw install/uninstall with dplane apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-09-06zebra: flog_warn conversionQuentin Young
Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-13zebra: fix "no pseudowire IFNAME" on vtyshRenato Westphal
We must hide only "pseudowire IFNAME" from vtysh, the "no" form of the command should be made available to the extract.pl script. Split the command into two to fix this problem. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-05-29zebra: refactor zserv names, consolidate eventsQuentin Young
* Add centralized thread scheduling dispatchers for client threads and the main thread * Rename everything in zserv.c to stop using a combination of: - zebra_server_* - zebra_* - zserv_* Everything in zserv.c now begins with zserv_*. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: cleanup for zapi_msg.c splitQuentin Young
* Rename client_connect and client_close hooks to zapi_client_connect and zapi_client_close * Remove some more unnecessary headers * Fix a copy-paste error in zapi_msg.[ch] header comments * Fix an inclusion comment in zserv.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: use hooks for client lifecycle callbacksQuentin Young
zserv.c was using hardcoded callbacks to clean up various components when a client disconnected. Ergo zserv.c had to know about all these unrelated components that it should not care about. We have hooks now, let's use the proper thing instead. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: clean up zapi organizationQuentin Young
zserv.c has become something of a dumping ground for everything vaguely related to ZAPI and really needs some love. This change splits out the code fo building and consuming ZAPI messages into a separate source file, leaving the actual session and client lifecycle code in zserv.c. Unfortunately since the #include situation in Zebra has not been paid much attention I was forced to fix the headers in a lot of other source files. This is a net improvement overall though. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-09lib: Isolate nexthop_group functions to nexthop_group.cDonald Sharp
Also modify `struct route_entry` to use nexthop_groups. Move ALL_NEXTHOPS loop to nexthop_group.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-23*: Make assignment from RB_ROOT in while loop work betterDonald Sharp
Fix up the assignment of the variable = RB_ROOT inside of while loop patter we were using. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-29zebra, ldpd: fix display of pseudowire statusRenato Westphal
In some circumstances zebra and ldpd would display a pseudowire as UP when in reality it's not (example: MTU mismatch between the two ends). Fix this to avoid confusion. Reported-by: ßingen <bingen@voltanet.io> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>