summaryrefslogtreecommitdiffstats
path: root/ripngd/ripngd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ripngd: Cleanup memory allocations on shutdownDonald Sharp2022-10-121-0/+7
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripngd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-211-4/+4
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripngd: Remove various macros that overlap THREAD_OFFDonald Sharp2022-07-211-17/+17
| | | | | | | | Let's just use THREAD_OFF consistently in the code base instead of each daemon having a special macro that needs to be looked at and remembered what it does. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Properly use memset() when zeroingDonatas Abraitis2022-05-111-5/+5
| | | | | | | Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Avoid casting to the same type as on the leftDonatas Abraitis2022-05-081-1/+1
| | | | | | Just not necessary. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-21/+11
| | | | | | | 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>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-40/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ripngd: Ensure better `struct thread *` semanticsDonald Sharp2021-10-041-11/+0
| | | | | | | | | | 1) Remove `struct thread *` pointers that are never used 2) Do not explicitly set the thread pointer to NULL. 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: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter2021-08-271-1/+1
|\ | | | | lib: remove unused argument from vrf_cmd_init
| * lib: remove unused argument from vrf_cmd_initIgor Ryzhov2021-08-261-1/+1
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib: remove vrf-interface config when removing the VRFIgor Ryzhov2021-06-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | If we have the following configuration: ``` vrf red smth exit-vrf ! interface red vrf red smth ``` And we delete the VRF using "no vrf red" command, we end up with: ``` interface red smth ``` Interface config is preserved but moved to the default VRF. This is not an expected behavior. We should remove the interface config when the VRF is deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: adapt to version 2 of libyangChristian Hopps2021-05-131-5/+5
| | | | | | | | | 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>
* lib, ripd, ripngd, vtysh: Move distribute list to `correct` spotDonald Sharp2021-05-041-3/+0
| | | | | | | Allow the `distribute-list...` command in ripd and ripngd to work correctly. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripngd: use pI6 instead of inet6_ntoaMark Stapp2021-03-311-49/+45
| | | | | | Stop using unsafe inet6_ntoa(), just use %pI6. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-171-4/+4
| | | | | | | | | | | | | | | | | 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>
* ripngd: Convet to using internal printf modifiersDonald Sharp2021-03-101-5/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripngd: Remove #if 0 codeDonald Sharp2021-01-281-140/+0
| | | | | | Remove some more dead code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Remove route_map_object_t from the systemDonald Sharp2020-11-141-6/+4
| | | | | | | | | | | | | The route_map_object_t was being used to track what protocol we were being called against. But each protocol was only ever calling itself. So we had a variable that was only ever being passed in from route_map_apply that had to be carried against and everyone was testing if that variable was for their own stack. Clean up this route_map_object_t from the entire system. We should speed some stuff up. Yes I know not a bunch but this will add up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* * : update signature of thread_cancel apiMark Stapp2020-10-231-16/+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>
* ripngd: Convert to using %pFXDonald Sharp2020-10-171-31/+20
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* rip(ng)d: fix interfaces cleaningIgor Ryzhov2020-10-091-1/+2
| | | | | | | | | | rip(ng)d_instance_disable unlinks the vrf from the instance which means that rip(ng)_interfaces_clean never works, because rip(ng)->vrf is always NULL there. This leads to the crash #6477. Clean interfaces before disabling the instance to fix the issue. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: move all userdata when changing node xpathIgor Ryzhov2020-09-241-0/+7
| | | | | | The same thing was done for interfaces in commit f7c20aa1f. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: un-split strings across linesDavid Lamparter2020-07-141-2/+1
| | | | | | | | | | | | | | | | | 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>
* *: replace all random() callsRafael Zalamena2020-04-181-2/+3
| | | | | | | | | | | 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>
* *: move CLI node names to cmd_node->nameDavid Lamparter2020-04-161-0/+1
| | | | | | | 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>
* *: move CLI parent data to cmd_node->parent_nodeDavid Lamparter2020-04-161-0/+1
| | | | | | | 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>
* *: remove second parameter on install_node()David Lamparter2020-04-161-1/+3
| | | | | | | | | | 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>
* *: remove cmd_node->vtyshDavid Lamparter2020-04-161-1/+0
| | | | | | | 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>
* *: clean up cmd_node initializersDavid Lamparter2020-04-161-1/+3
| | | | | | ... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
* bgpd, lib, ripngd: Add agg_node_get_prefixDonald Sharp2020-03-241-19/+11
| | | | | | | | | Modify code to use lookup function agg_node_get_prefix() as the abstraction layer. When we rework bgp_node to bgp_dest this will allow us to greatly limit the amount of work needed to do that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* treewide: fix some issues found with -Werror=undefRuben Kerkhof2020-03-101-1/+1
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* *: Replace `sizeof something` to sizeof(something)Donatas Abraitis2020-03-081-1/+1
| | | | | | Satisfy checkpatch.pl requirements (check for sizeof without parenthesis) Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: use gmtime_r, localtime_r exclusivelyMark Stapp2020-03-051-5/+5
| | | | | | Stop using gmtime() or localtime() everywhere. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: remove null check before XFREEQuentin Young2020-02-041-2/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: strip trailing whitespaceQuentin Young2019-09-301-1/+1
| | | | | | Some of it has snuck by CI Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "lib: introduce a read-write lock for northbound configurations"Renato Westphal2019-09-181-11/+7
| | | | | | | | | | | | | | | | | Adding a lock to protect the global running configuration doesn't help much since the FRR daemons are not prepared to process configuration changes in a pthread that is not the main one (a whole lot of new protections would be necessary to prevent race conditions). This means the lock added by commit 83981138 only adds more complexity for no benefit. Remove it now to simplify the code. All northbound clients, including the gRPC one, should either run in the main pthread or use synchronization primitives to process configuration transactions in the main pthread. This reverts commit 83981138fe8c1e0a40b8dede74eca65449dda5de.
* Merge pull request #4564 from pguibert6WIND/misc_vrf_update_nameRuss White2019-09-171-8/+42
|\ | | | | Misc vrf update name
| * ripngd: change vrf name with bypassing nb apiPhilippe Guibert2019-08-271-7/+41
| | | | | | | | | | | | | | | | ripngd operational & config data may already applied and available, while an external event requests for changing the vrf name. this change updates the config and operational context of yang. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * ripngd: update the default vrf name by registering to callbackPhilippe Guibert2019-08-271-1/+1
| | | | | | | | | | | | | | if default vrf name is updated, then ripng contexts based on that hypothetical vrfname, will be enabled. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | *: frr_elevate_privs -> frr_with_privsDavid Lamparter2019-09-031-3/+2
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Revert "Ospf missing interface handling 2"Donald Sharp2019-06-241-4/+2
|
* Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2Donald Sharp2019-06-221-2/+4
|\ | | | | Ospf missing interface handling 2
| * *: change interface structure, from vrf_id to vrfPhilippe Guibert2019-06-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
| * *: change if_lookup_by_name() api with vrfPhilippe Guibert2019-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | the vrf_id parameter is replaced by struct vrf * parameter. this impacts most of the daemons that look for an interface based on the name and the vrf identifier. Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was ignored until now. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | ripngd: use MTYPE_STATICDavid Lamparter2019-06-211-0/+5
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* ripngd: strcat -> strlcatQuentin Young2019-05-291-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ripd, ripngd: fix cleaning up of offset listsRenato Westphal2019-04-191-1/+1
| | | | | | | | | | | | | | | | | We should never attempt to remove a list item in the "del" callback of the list. This is already performed by the list_delete() function, doing it twice leads to crashes or memory corruption. Introduce the offset_list_free() function so that we can separate the removal and deallocation of offset lists into separate functions, without code duplication. offset_list_del() will be used by the northbound callbacks to remove offset lists, while offset_list_free() will be used by rip_clean() to clean up all RIP offset lists using list_delete(). Do the same for ripngd. This is a fallout from the ripd/ripngd northbound conversion. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge remote-tracking branch 'frr/master' into rip-vrfRenato Westphal2019-03-291-13/+32
|\ | | | | | | | | | | | | Merge commit to solve a bunch of conflicts with other PRs that were merged in the previous weeks. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>