Commit graph

788 commits

Author SHA1 Message Date
David Lamparter bbd858935f build: homologize path handling
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>
2024-01-27 19:02:52 +01:00
David Lamparter bfd6d8ee19 lib, mgmtd: fix commit history location
Both of these belong in `/var/lib`, not `/var/run`.

Rather hilariously, the history read in
`mgmt_history_read_cmt_record_index` was always failing, because it was
doing a `file_exists(MGMTD_COMMIT_FILE_PATH)` check.  Which is the wrong
macro - it's `.../commit-%s.json`, including the unprocessed `%s`, which
would never exist.

I guess noone ever tried if this actually works.  Cool.

On the plus side, this means I don't have to implement legacy
compatibility for this, since it never worked to begin with.

(SQLite3 DB location is also changed in this commit since it also uses
`DAEMON_DB_DIR`.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:52 +01:00
David Lamparter 567f5702c0 ospf6d: fix GR & auth seqno state location
Unfortunately, `ospf6d` is much worse than `ospfd` and `isisd` regarding
its state saving, due to the existence of the auth trailer code.

Again, this belongs in `/var/lib`, not `/var/run`.

Merge both state files into one, and add reconciliation code for the
auth seqno.

I'm gonna save my comment on the fact that `ospf6_auth_seqno_nvm_delete`
is not in fact used anywhere.  Which is now a warning because it's
`static`.  Well.  It probably should be used somewhere, so leave it in.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:52 +01:00
David Lamparter 110945ba0d ospfd: fix GR state location
This belongs in `/var/lib`, not `/var/run`.

Use library facility to load/save, support previous path as fallback,
and do proper fsync().

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:52 +01:00
David Lamparter e354c6e343 isisd: fix overload state location
This belongs in `/var/lib`, not `/var/run`.  Also the filename was
typo'd (`isid-restart.json`).

Change to proper location and fall back to previous in case it's the
first restart after an FRR update from a version with the bugged path.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:52 +01:00
David Lamparter a97d0c5875 lib: set up frr_libstatedir
This needs to be used for persistent state, which currently is misplaced
into `/var/run` / `/run` where it gets deleted across reboots.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 0f79e6b876 build: nuke LDPD_SOCKET
This just unnecessarily complicates things by involving autoconf.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 72783ecca2 build: nuke ZEBRA_SERV_PATH
This just unnecessarily complicates things by involving autoconf.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 80b6787e27 build: nuke BFDD_CONTROL_SOCKET
This just unnecessarily complicates things by involving autoconf.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 0d5a2497ca lib, mgmtd: fix wrong mgmtd socket paths
These paths were ignoring the `-N` namespacing option.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 42eeea090e *: rename frr_vtydir to frr_runstatedir
Also remove frr_init_vtydir(), just initialize to default.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter ff62df2e44 build: untangle sysconfdir & localstatedir
`--sysconfdir` should be `/etc` and `--localstatedir` should be `/var`.
The package-specific subdirectory should be added by configure, not
given by the user, to match established behavior by other packages.

Note that `--bindir`, `--sbindir`, `--libdir` and `--libexecdir` have
different established/expected behavior due to distro specific
multi-arch support.  That's why these are left unchanged.

The reason this is getting fixed now is that we need to use
`--localstatedir` for its actual value to put things in `/var/lib`.  As
it is now, being overloaded for `/run`, the configured `/var` path
becomes inaccessible.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
David Lamparter 27f6171a25 build: use AX_RECURSIVE_EVAL
Replace inline expansion loop.  (Also correctly handles prefix=NONE and
exec_prefix=NONE inside the macro.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:01:19 +01:00
Donald Sharp 22b439090c
Merge pull request #15103 from LabNConsulting/chopps/oper-filter
Implement full XPath 1.0 functionality
2024-01-09 12:31:36 -05:00
Christian Hopps 1e4229fc1f lib: use libyang functions if they are present
Add configure.ac tests for libyang functions, if not present supply the
functionality ourselves in yang.[ch]

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:56 +00:00
Christian Hopps db3ac9d4f3 build: require libyang 2.1.128
Update building docs to reflect this as well.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-06 06:55:04 -05:00
Christian Hopps c00002d0d0 build: protobuf is required so update building docs
- recommend using libyang 2.1.128 but accept 2.0.0 for now.
- update ubuntu building doc to add GRPC section
- update ubuntu reference docker builds to match grpc doc change

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-31 13:51:21 +00:00
Christian Hopps f3d6edc7ee lib: darr: add new access and str functions
- darr_last(), and darr_strdup_cap().
- strcat, strdup, strlen, strnul equivs.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-28 17:52:57 +00:00
Donald Sharp 42ddcf71e5 *: Remove APPLE #defines from build
We cannot build on apple machines at all due
to our usage of some gcc extensions that will
probably never see the light of day again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:46:19 -05:00
Igor Ryzhov 7d67b9ff28 build: add -Wimplicit-fallthrough
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>
2023-10-12 21:23:18 +03:00
Donatas Abraitis d2324b7b4a build: FRR 9.2 development version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-10-10 19:43:56 +03:00
Donatas Abraitis fd0fe0bb6a lib: Drop deprecated enable-time-check, enable-cpu-time compile options
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-24 20:41:24 +03:00
Donald Sharp a95b8faadf *: Remove unused configure option
The `-disable-rr-semantics` or `--enable-rr-senamtics` configure
option is never used.  Let's just remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-05 15:26:40 -04:00
乐倚 9fbab41212 configure.ac: fix protobuf config
Bug description: frr_init load zebra_fpm.so error. Zebra can't
  find function `zfpm_protobuf_encode_route` in symbol table.

  Bug trigger condition ( CI have this set ):
    ./configure --enable-protobuf=no --enable-fpm=yes
    /usr/lib/frr/zebra -M fpm

  Cause: Macro `HAVE_PROTOBUF` and compile condition variable
  `HAVE_PROTOBUF`  in `configure.ac ` is not consistent. When
  configure `disable-protobuf`, compile condition variable
  `HAVE_PROTOBUF` is 0, but the macro is 1. It leads to zebra
  load protobuf module, but protobuf module is not linked.

  Fix: add a same condition statement to the macro define.

Signed-off-by: 乐倚 <lwb406054@alibaba-inc.com>
2023-08-23 08:43:28 +00:00
Christian Hopps 7ee63796bc build: disable warning for m$ extension use
This is adding a "disable warning" to ccls convenience config.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-07-06 18:07:47 -04:00
Jafar Al-Gharaibeh c158ca492e build: FRR 9.1 development version
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2023-06-06 14:03:19 -05:00
Christian Hopps 2596308a09 doc: configure: add configure option to generate .ccls file
`ccls` needs information from FRR build configuration to work,
so allow creation of a custom ccls config during autoconf.

Paraphrasing the doc entry: ccls is a very powerful tool that allows
dev environments to provide sophisticated IDE functionality, e.g.,
semantically aware jumps and code refactoring...

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-18 09:32:32 -04:00
Christian Hopps 6b7481aa8d lib: add build option to set startup log timestemp precision
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-04-29 02:36:06 -04:00
Donatas Abraitis 74675f8d44 build: Take LUA_LIBS from pkg-config
Alpine Linux has LUA_LIB with a broken path, let's use pkg-config to grab
the LUA_LIBS properly.

checking for library containing lua_load... no
configure: error: Lua 5.3 libraries are required to build with Lua support. No other version is supported.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-04-08 21:04:06 +03:00
Donatas Abraitis c9bdc0c79e tools: Set correct directory of vtysh for frr-reload.py
Before it was setting SDIR, which is /usr/lib/frr, but the vtysh binary is put
under bindir (which is /usr/local by default). And running `/usr/lib/frr/frr reload`
failed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24 19:38:46 +02:00
Yash Ranjan 74335ceb27 mgmtd: Add MGMT Transaction Framework
This commit introduces the MGMT Transaction framework that takes
management requests from one (or more) frontend client sessions,
translates them into transactions and drives them to completion
in co-oridination with one (or more) backend client daemons
involved in the request.

This commit includes the following functionalities in the changeset:
1. Introduces the actual Transaction module. Commands added related to
   transaction are:
   a. show mgmt transaction all
2. Adds support for commit rollback feature which stores upto the 10
   commit buffers. Each commit has a commit-id which can be used to
   rollback to the exact configuration state.
   Commands supported for this feature are:
   a. show mgmt commit-history
   b. mgmt rollback commit-id COMMIT_ID
3. Add hidden commands to enable record various performance metrics:
   a. mgmt performance-measurement
   b. mgmt reset-statistic

Co-authored-by: Pushpasis Sarkar <pushpasis@gmail.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2023-03-21 22:08:32 -04:00
Christian Hopps 1c84efe4fa mgmtd: Bringup MGMTD daemon and datastore module support
Features added in this commit:
1. Bringup/shutdown new management daemon 'mgmtd' along with FRR.
2. Support for Startup, Candidate and Running DBs.
3. Lock/Unlock DS feature using pthread lock.
4. Load config from a JSON file onto candidate DS.
5. Save config to a JSON file from running/candidate DS.
6. Dump candidate or running DS contents on the terminal or a file in
   JSON/XML format.
7. Maintaining commit history (Full rollback support to be added in
   future commits).
8. Addition of debug commands.

Co-authored-by: Yash Ranjan <ranjany@vmware.com>
Co-authored-by: Abhinay Ramesh <rabhinay@vmware.com>
Co-authored-by: Ujwal P <ujwalp@vmware.com>
Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
2023-03-21 22:08:32 -04:00
Donatas Abraitis 96475dfde9
Merge pull request #12707 from donaldsharp/missed_enums
Missed enums
2023-02-07 22:22:27 +02:00
Donatas Abraitis 16c38045b1 build: FRR 9.0 development version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-07 21:25:42 +02:00
Donald Sharp 57ba9e9d7c *: Add -Wswitch-enum to build
The -Wswitch-enum will allow the compiler to warn us
when a developer creates a switch over a enum and is
using `default:` when they should be iterating over
every enum

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 15:15:59 -05:00
David Lamparter c2c6c55e8d build: enable format string warnings
I thought these were included in `-Wall -Wextra`, but apparently not.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-27 12:01:20 +01:00
David Lamparter d9a2d546da build: pim6d is Linux only
This stops breaking build on FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-08 12:45:38 +01:00
Mark Stapp cee45b84f4 build: enable pim6d by default
Change configure.ac so that pim6d is enabled by default; a
command-line option can disable it.

Signed-off-by: Mark Stapp <mjs@labn.net>
2022-12-01 13:57:46 -05:00
Donatas Abraitis 061f5d1cb4 lib: Add PCRE2 support
Some results:

```
====
PCRE
====
% ./a.out "^65001" "65001"
comparing: ^65001 / 65001

ret status: 0
[14:31] donatas-pc donatas /home/donatas
% ./a.out "^65001_" "65001"
comparing: ^65001_ / 65001

ret status: 0

=====
PCRE2
=====
% ./a.out "^65001" "65001"
comparing: ^65001 / 65001

ret status: 0
[14:30] donatas-pc donatas /home/donatas
% ./a.out "^65001_" "65001"
comparing: ^65001_ / 65001

ret status: 1
```

Seems that if using PCRE2, we need to escape outer `()` chars and `|`. Sounds
like a bug.
But this is only with some older PCRE2 versions. With >= 10.36, I wasn't able
to reproduce this, everything is fine and working as expected.

Adding _FRR_PCRE2_POSIX definition because pcre2posix.h does not have
include's guard.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-07 21:23:53 +02:00
David Lamparter 89cb86aeb0 build, vtysh: extract vtysh commands from .xref
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>
2022-10-26 17:12:34 +01:00
Russ White 07735ca345
Merge pull request #11980 from isabelladeleon12/set_overload_startup
isisd: Add support for set-overload on-startup
2022-10-13 10:59:24 -04:00
Isabella de Leon 450841fe05 isisd: Add JSON object functions to save overload status between restarts.
Signed-off-by: Isabella de Leon <ideleon@microsoft.com>
2022-10-12 16:57:32 -07:00
Donatas Abraitis b81570c690 build: FRR 8.5 development version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-10-04 21:33:18 +03:00
Khem Raj 9399d58c13 configure: Check for readline() function instead of main
main is not a function found in libreadline, its better to check for a
function thats provided by it.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-09-01 10:45:36 -07:00
Mobashshera Rasool 7e08c08069 pim6d: Disable pim6d compilation by default
By default, disable pim6d compilation. If someone
wants to enable the compilation, should use ./configure option
with --enable-pim6d.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-07 07:14:27 -07:00
Anuradha Karuppiah fd03f1d4b7 configure, zebra: include DPDK headers and shared libs in the dp-dpdk build
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
   -> Moved new capabilities needed to under HAVE_DPDK
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-06-27 07:56:55 -04:00
Anuradha Karuppiah 36c3b29675 zebra: infastructure for the new dataplane plugin
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2022-06-27 07:56:55 -04:00
Donatas Abraitis 981b254297 lib: Require at least 2.1.42 version of sysrepo when compiling
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-09 18:03:22 +03:00
Donatas Abraitis 087350d968 build: FRR 8.4 development version
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-07 22:47:17 +03:00
Pushpasis Sarkar 4d571bb3c4
Merge pull request #11158 from cyberstormdotmu/master
lib/md5,lib/sha256: Use explicit_bzero to clean up sensitive data.
2022-06-07 21:05:03 +05:30