summaryrefslogtreecommitdiffstats
path: root/watchfrr (follow)
Commit message (Collapse)AuthorAgeFilesLines
* watchfrr: increase restart timer 20s -> 90sQuentin Young2024-12-091-1/+1
| | | | | | | | | | | | | | | | This commit: "tools: run `vtysh -b` once for all-startup" changed things so that `vtysh -b` is run after all daemons have started up instead of doing it for each daemon as they are started up. This results in one long `vtysh -b`, which for large configs and many daemons (in the case I saw, 4 daemons and 30,000 line config) can exceed the 20 second timer watchfrr uses to kill "hung" background tasks. Shouldn't be any harm to increasing this to 90 seconds to give us some leeway while still making sure we kill anything truly misbehaving. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* build: homologize path handlingDavid Lamparter2024-01-272-0/+4
| | | | | | | | | Use consistent `e_somepath` names for expanded versions of `somepath`. Also remove all paths from `config.h` and put them into `lib/config_paths.h` - this is to make more obvious when someone is doing something probably not quite properly structured. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: fix `frr_daemon_info` indentationDavid Lamparter2024-01-271-8/+9
| | | | | | | | | | clang-format doesn't understand FRR_DAEMON_INFO is a long macro where laying out items semantically makes sense. (Also use only one `FRR_DAEMON_INFO(` in isisd so editors don't get confused with the mismatching `( ( )`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: rename `frr_vtydir` to `frr_runstatedir`David Lamparter2024-01-271-5/+5
| | | | | | Also remove frr_init_vtydir(), just initialize to default. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: zebra.h is not using signal.hDonald Sharp2024-01-092-0/+4
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: zebra.h should not have fcntl.hDonald Sharp2024-01-091-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: remove sys/stat.h from zebra.hDonald Sharp2024-01-091-0/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Extend ignore option to daemon being killedDonald Sharp2023-10-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When testing GR features, it is desired to kill bgp (or really any daemon )and not immediately have bgp start up again. Modify the code to not attempt to restart the daemon by hand to let us developers work when the `watchfrr ignore XXX` command is issued. Testing: watchfrr ignore bgpd kill -9 bgpd start bgp by `/usr/lib/frr/watchfrr.sh start bgpd` at some point in time in the future leaf-1# show watchfrr watchfrr global phase: Idle Restart Command: "/usr/lib/frr/watchfrr.sh restart %s" Start Command: "/usr/lib/frr/watchfrr.sh start %s" Stop Command: "/usr/lib/frr/watchfrr.sh stop %s" Min Restart Interval: 60 Max Restart Interval: 600 Restart Timeout: 90 zebra Up bgpd Up/Ignoring Timeout staticd Up leaf-1# Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* build: add -Wimplicit-fallthroughIgor Ryzhov2023-10-121-3/+3
| | | | | | | | | | Also: - replace all /* fallthrough */ comments with portable fallthrough; pseudo keyword to accomodate both gcc and clang - add missing break; statements as required by older versions of gcc - cleanup some code to remove unnecessary fallthrough Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: Convert event.h to frrevent.hDonald Sharp2023-03-241-1/+1
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-1/+1
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-15/+15
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-1/+1
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_cancelXXX to event_cancelXXXDonald Sharp2023-03-241-3/+3
| | | | | | Modify the code base so that thread_cancel becomes event_cancel Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-28/+28
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-20/+20
| | | | | | | | | 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>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-241-1/+1
| | | | | | | | | | | 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>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-095-70/+5
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #12695 from opensourcerouting/format-warningsDonald Sharp2023-01-311-0/+4
|\ | | | | build: `-Wformat-nonliteral -Wformat-security`
| * *: no-warn pragmas for non-const format stringsDavid Lamparter2023-01-271-0/+4
| | | | | | | | | | | | | | | | We do use non-constant/literal format strings in a few places for more or less valid reasons; put `ignored "-Wformat-nonliteral"` around those so we can have the warning enabled for everywhere else. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | watchfrr: dmn variable shadows previous declarationDonald Sharp2023-01-261-7/+4
|/ | | | | | There is no need to declar the same temp variable 2 times. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-262-3/+0
| | | | | | | | | | | | | | | | | | | Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #12140 from opensourcerouting/fix/watchfrr_dont_givupJafar Al-Gharaibeh2022-10-211-0/+24
|\ | | | | watchfrr: Delay restart_kill if still reading configuration
| * watchfrr: Delay restart_kill if still reading configurationDonatas Abraitis2022-10-101-0/+24
| | | | | | | | | | | | | | This mostly happens only for large configuration files, where the default restart-time (-T, --restart-time / 20s) is not enough. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* | *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-0/+2
|/ | | | | | | | | There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Check that the operational timeout specified is good.Donald Sharp2022-08-151-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Properly use memset() when zeroingDonatas Abraitis2022-05-111-1/+1
| | | | | | | Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* watchfrr: Add some more information to `show watchfrr`Donald Sharp2022-04-181-0/+6
| | | | | | | To allow people to know the state of watchfrr from vtysh, let's add a bit more data to the output. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Send operational state to systemdDonald Sharp2022-04-081-7/+42
| | | | | | | | | | | | | | | | | When watchfrr has noticed issues, send operational state to systemd so operators issuing `systemd status frr` can see a more nuanced state of the daemon. Add the `--operational-timeout X` value to the cli. After the daemon has been restarted and communication re-established wait this time before reporting to systemd that the daemon is up and running. Default value of 60 seconds was choosen to allow some small delay in reporting so that, if the daemon is in a crash loop status will not ping pong. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Convert daemon_state_t to an enum instead of a typedefDonald Sharp2022-04-071-3/+3
| | | | | | Align watchfrr with our coding standard Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Rename restart_phase_t to `enum restart_phase`Donald Sharp2022-04-071-4/+4
| | | | | | This will align with our coding standards. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-32/+20
| | | | | | | 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>
* *: Convert quagga_signal_X to frr_signal_XDonald Sharp2021-11-111-1/+1
| | | | | | | Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Allow an integrated config to work within a namespaceDonald Sharp2021-10-063-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Since watchfrr invokes vtysh to gather the show run output and write the data, if we are operating inside of a namespace FRR must also pass this in. Yes. This seems hacky. I don't fully understand why vtysh is invoked this way. New output: sharpd@eva:~/frr3$ sudo vtysh -N one Hello, this is FRRouting (version 8.1-dev). Copyright 1996-2005 Kunihiro Ishiguro, et al. eva# wr mem Note: this version of vtysh never writes vtysh.conf % Can't open configuration file /etc/frr/one/vtysh.conf due to 'No such file or directory'. Building Configuration... Integrated configuration saved to /etc/frr/one/frr.conf [OK] eva# Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: Do not explicitly set the thread pointer to NULLDonatas Abraitis2021-10-041-6/+0
| | | | | | | | FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib, watchfrr: remove `HAVE_SYSTEMD`, use own codeDavid Lamparter2021-06-291-7/+3
| | | | | | | | | | This replaces the external libsystemd dependency with... pretty much the same amount of built-in code. But with one fewer dependency and build switch needed. Also check `JOURNAL_STREAM` for future logging integration. Signed-off-by: David Lamparter <equinox@diac24.net>
* lib: adapt to version 2 of libyangChristian Hopps2021-05-131-1/+1
| | | | | | | | | Compile with v2.0.0 tag of `libyang2` branch of: https://github.com/CESNET/libyang staticd init load time of 10k routes now 6s vs ly1 time of 150s Signed-off-by: Christian Hopps <chopps@labn.net>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+2
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-172-3/+3
| | | | | | | | | | | | | | | | | 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>
* watchfrr: Convert to not use warning in warning messagesDonald Sharp2021-03-101-3/+3
| | | | | | | We do not need to display: `Warning: ...` in a zlog_warn message Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: fix SA warningRafael Zalamena2021-01-261-0/+3
| | | | | | | | | `valid_command` now causes static analyzer complaints since it no longer assumes `optarg` is non-NULL. If this was the case then `valid_command` would return `false` (or 0) because it would mean the string is empty and doesn't contain the '%s' it expects. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* watchfrr: fix crash on missing optional argumentRafael Zalamena2021-01-251-1/+1
| | | | | | Fix `netns` command line handling for missing argument (it's optional). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* *: unify thread/event cancel macrosMark Stapp2020-10-231-0/+1
| | | | | | | | | 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>
* * : update signature of thread_cancel apiMark Stapp2020-10-231-7/+5
| | | | | | | | Change thread_cancel to take a ** to an event, NULL-check before dereferencing, and NULL the caller's pointer. Update many callers to use the new signature. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: Use proper semantics for turning off threadDonald Sharp2020-10-121-2/+1
| | | | | | | | | | | | | We have this pattern in the code base: if (thread) THREAD_OFF(thread); If we look at THREAD_OFF we check to see if thread is non-null too. So we have a double check. This is unnecessary. Convert to just using THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* watchfrr: add (network) namespace supportDavid Lamparter2020-07-221-3/+178
| | | | | | | This adds -N and --netns options to watchfrr, allowing it to start daemons with -N and switching network namespaces respectively. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: un-split strings across linesDavid Lamparter2020-07-141-26/+13
| | | | | | | | | | | | | | | | | 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>
* build: make clippy Makefile rules nicerDavid Lamparter2020-04-271-2/+3
| | | | | | | These are easy to get subtly wrong, and doing so can cause nondeterministic failures when racing in parallel builds. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* build: use VPATH for vtysh_scanDavid Lamparter2020-04-271-1/+1
| | | | | | No need to put $(top_srcdir) everywhere. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: replace all random() callsRafael Zalamena2020-04-181-1/+2
| | | | | | | | | | | Replace all `random()` calls with a function called `frr_weak_random()` and make it clear that it is only supposed to be used for weak random applications. Use the annotation described by the Coverity Scan documentation to ignore `random()` call warnings. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>