summaryrefslogtreecommitdiffstats
path: root/vrrpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* vrrpd: iterate over all ancillary messagesRafael Zalamena2024-10-071-1/+1
| | | | | | | Assign the return of `CMSG_NXTHDR` so we can really iterate over the ancillary data. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* *: Create termtable specific temp memoryDonald Sharp2024-09-011-2/+2
| | | | | | | | | | When trying to track down a MTYPE_TMP memory leak it's harder to search for it when you happen to have some usage of ttable_dump. Let's just give it it's own memory type so that we can avoid confusion in the future. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* lib: common debug status outputIgor Ryzhov2024-08-272-41/+0
| | | | | | | Implement common code for debug status output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: common debug config outputIgor Ryzhov2024-08-273-28/+7
| | | | | | | Implement common code for debug config output and remove daemon-specific code that is duplicated everywhere. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: rework debug initIgor Ryzhov2024-08-271-23/+7
| | | | | | | | | | The debug library allows to register a `debug_set_all` callback which should enable all debugs in a daemon. This callback is implemented exactly the same in each daemon. Instead of duplicating the code, rework the lib to allow registration of each debug type, and implement the common code only once in the lib. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: create a single registry of daemons' default port valuesMark Stapp2024-02-011-2/+0
| | | | | | | | Create a single registry of default port values that daemons are using. Most of these are vty ports, but there are some others for features like ospfapi and zebra FPM. Signed-off-by: Mark Stapp <mjs@labn.net>
* *: fix `frr_daemon_info` indentationDavid Lamparter2024-01-271-7/+13
| | | | | | | | | | 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>
* lib: remove leaf-list xpath hack from northboundIgor Ryzhov2024-01-231-2/+10
| | | | | | | | | | | Currently, when editing a leaf-list, `nb_candidate_edit` expects to receive it's xpath without a predicate and the value in a separate argument, and then creates the full xpath. This hack is complicated, because it depends on the operation and on the caller being a backend or not. Instead, let's require to always include the predicate in a leaf-list xpath. Update all the usages in the code accordingly. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: all: remove './' from xpath 22% speedupChristian Hopps2023-11-292-5/+5
| | | | | | fixes #8299 Signed-off-by: Christian Hopps <chopps@labn.net>
* *: convert `struct interface->connected` to DLISTDavid Lamparter2023-11-222-9/+12
| | | | | | | | | | | | | | | | | Replace `struct list *` with `DLIST(if_connected, ...)`. NB: while converting this, I found multiple places using connected prefixes assuming they were IPv4 without checking: - vrrpd/vrrp.c: vrrp_socket() - zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(), irdp_advert_off() (these fixes are really hard to split off into separate commits as that would require going back and reapplying the change but with the old list handling) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: convert if_zapi_callbacks into actual hooksDavid Lamparter2023-11-031-2/+4
| | | | | | | | | ...so that multiple functions can be subscribed. The create/destroy hooks are renamed to real/unreal because that's what they *actually* signal. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #13731 from cyberstorm-mauritius/cid1519841mobash-rasool2023-06-211-1/+7
|\ | | | | vrrp: check return value for turning off multicast for v6
| * vrrp: check return value for turning off multicast for v6Loganaden Velvindron2023-06-131-1/+7
| | | | | | | | | | | | CID1519841: check return value and set error Signed-off-by: Loganaden Velvindron <logan@cyberstorm.mu>
* | vrrpd: add priority field into interface jsonSindhu Parvathi Gopinathan2023-06-191-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'Priority' attribute is missing in "show vrrp interface <intf> json" output. Whereas it is there in non-json output. It has been added now in show vrrp interface json output. Before Fix: ``` vrrp1# show vrrp interface swp5.101 json [ { "vrid":2, "version":3, "autoconfigured":false, "shutdown":false, "preemptMode":true, "acceptMode":true, "interface":"swp5.101", "advertisementInterval":1000, "v4":{ "interface":"vrrp4-11-2", "vmac":"00:00:5e:00:01:02", "primaryAddress":"50.0.0.2", "status":"Master", "effectivePriority":110, "masterAdverInterval":1000, "skewTime":570, "masterDownInterval":3570, "stats":{ "adverTx":248456, "adverRx":1, "garpTx":1, "transitions":2 }, "addresses":[ "50.0.0.1" ] }, "v6":{ "interface":"vrrp6-11-2", "vmac":"00:00:5e:00:02:02", "primaryAddress":"fe80::7f1:49e7:768c:aa73", "status":"Master", "effectivePriority":110, "masterAdverInterval":1000, "skewTime":570, "masterDownInterval":3570, "stats":{ "adverTx":248455, "adverRx":1, "neighborAdverTx":1, "transitions":2 }, "addresses":[ "2001:50::1" ] } } ] vrrp1# ``` After Fix: ``` vrrp1# show vrrp interface swp5.101 json [ { "vrid":2, "version":3, "autoconfigured":false, "shutdown":false, "preemptMode":true, "acceptMode":true, "interface":"swp5.101", "advertisementInterval":1000, "priority":110, ====> priority added into json output "v4":{ "interface":"vrrp4-11-2", "vmac":"00:00:5e:00:01:02", "primaryAddress":"50.0.0.2", "status":"Master", "effectivePriority":110, "masterAdverInterval":1000, "skewTime":570, "masterDownInterval":3570, "stats":{ "adverTx":15, "adverRx":4, "garpTx":1, "transitions":2 }, "addresses":[ "50.0.0.1" ] }, "v6":{ "interface":"vrrp6-11-2", "vmac":"00:00:5e:00:02:02", "primaryAddress":"fe80::7f1:49e7:768c:aa73", "status":"Master", "effectivePriority":110, "masterAdverInterval":1000, "skewTime":570, "masterDownInterval":3570, "stats":{ "adverTx":13, "adverRx":5, "neighborAdverTx":1, "transitions":2 }, "addresses":[ "2001:50::1" ] } } ] ``` Ticket:#3502432 Issue:3502432 Testing: UT done Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
* lib: Remove getopt.c and getopt1.cDonald Sharp2023-03-281-1/+2
| | | | | | | Why do we need getopt code that is standard in everything that we compile against? Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert event.h to frrevent.hDonald Sharp2023-03-242-2/+2
| | | | | | | 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-242-2/+2
| | | | | | 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-13/+13
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-242-2/+2
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-27/+27
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-242-9/+9
| | | | | | | | | 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-242-2/+2
| | | | | | | | | | | 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>
* *: Add a hash_clean_and_free() functionDonald Sharp2023-03-211-2/+1
| | | | | | | | | | Add a hash_clean_and_free() function as well as convert the code to use it. This function also takes a double pointer to the hash to set it NULL. Also it cleanly does nothing if the pointer is NULL( as a bunch of code tested for ). Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp2023-02-1716-224/+16
|\ | | | | *: convert to SPDX License identifiers
| * *: remove some leftover license blurbsDavid Lamparter2023-02-094-16/+0
| | | | | | | | | | | | The regex'ing left some paragraphs that didn't exactly match. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: auto-convert to SPDX License IDsDavid Lamparter2023-02-0916-208/+16
| | | | | | | | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | vrrpd: give null when using null ifp to lookup vrQuentin Young2023-02-101-0/+3
|/ | | | | | This is still causing crashes somehow. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: add IPv4 pseudoheader option for VRRPv3Siger Yang2022-11-257-24/+118
| | | | | | | | This commit adds a new option to control whether a VRRPv3 group accepts / computes its checksum with a prepended IPv4 pseudoheader. This should improve interoperability with other devices. Signed-off-by: Siger Yang <siger.yang@outlook.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 #12066 from opensourcerouting/cleanup-cli-xrefDonald Sharp2022-10-131-4/+4
|\ | | | | *: clean up various CLI-related bits
| * *: fix some malformed CLI docstringsDavid Lamparter2022-10-061-4/+4
| | | | | | | | Signed-off-by: David Lamparter <equinox@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>
* lib, vrrpd: Use THREAD_ARGDonald Sharp2022-07-211-3/+3
| | | | | | | Don't auto set the thread->arg pointer. It is private and should be only accessed through the THREAD_ARG pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: remove the checking returned value for hash_get()anlan_cs2022-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* vrrpd: Fix display of 'Master Advertisement interval'Rajesh Varatharaj2022-04-221-4/+4
| | | | | | | | | | VRRP as per RFC 5798 'Master Advertisement interval' field refers to the advertisement interval, we received the last time we got an Advertisement from a peer who wasn't us, who was in the master state. This could be clarified by making the field name 'Master Advertisement interval (rx)',and when we're in the Master state, we put (stale) after the interval. Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
* vrrpd: Allow it to be built in directoryDonald Sharp2022-03-111-2/+2
| | | | | | | Looks like the bones were put in place but they were slightly malformed. Fix. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-11/+5
| | | | | | | 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>
* *: use ipaddr_cmp instead of memcmpIgor Ryzhov2022-02-081-3/+3
| | | | | | | Using memcmp is wrong because struct ipaddr may contain unitialized padding bytes that should not be compared. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* vrrpd: use ipaddr_is_zero when neededIgor Ryzhov2022-01-271-5/+2
| | | | | | | | | | | Replace custom implementation or call to ipaddr_isset with a call to ipaddr_is_zero. ipaddr_isset is not fully correct, because it's fine to have some non-zero bytes at the end of the struct in case of IPv4 and the function doesn't allow that. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: cleanup ifp->vrf_idIgor Ryzhov2021-11-222-22/+22
| | | | | | | Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #10032 from opensourcerouting/build-fix-20211111Donald Sharp2021-11-131-4/+3
|\ | | | | build: assorted build system improvements, 2021-11 edition
| * build: remove some useless intermediate librariesDavid Lamparter2021-11-111-4/+3
| | | | | | | | | | | | | | These really serve no purpose other than slowing our build down. If there's a benefit to any of these, they can be readded. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: 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>
* Merge pull request #9820 from idryzhov/if-nb-configMark Stapp2021-10-261-30/+1
|\ | | | | *: fix interface config write in NB-converted daemons
| * *: fix interface config write in NB-converted daemonsIgor Ryzhov2021-10-251-30/+1
| | | | | | | | | | | | | | | | | | When writing the config from the NB-converted daemon, we must not rely on the operational data. This commit changes the output of the interface configuration to use only config data. As the code is the same for all daemons, move it to the lib and remove all the duplicated code. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White2021-10-261-4/+8
|\ \ | |/ |/| *: convert zclient callbacks to table
| * *: convert zclient callbacks to tableDavid Lamparter2021-10-201-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | lib: northbound cli show/cmd functions must not modify data nodesIgor Ryzhov2021-10-132-15/+19
|/ | | | | | | | To ensure this, add a const modifier to functions' arguments. Would be great do this initially and avoid this large code change, but better late than never. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: remove unused argument from vrf_cmd_initIgor Ryzhov2021-08-261-1/+1
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>