summaryrefslogtreecommitdiffstats
path: root/ripd/rip_interface.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ripd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-211-1/+1
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF 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>
* *: Fix spelling of IntefaceDonald Sharp2022-04-021-3/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of wetherDonald Sharp2022-04-021-4/+4
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-4/+2
| | | | | | | 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>
* *: cleanup ifp->vrf_idIgor Ryzhov2021-11-221-33/+21
| | | | | | | 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>
* *: fix interface config write in NB-converted daemonsIgor Ryzhov2021-10-251-28/+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>
* ripd: Ensure better `struct thread *` semanticsDonald Sharp2021-10-041-1/+0
| | | | | | | | | 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>
* *: cleanup interface node installationIgor Ryzhov2021-07-291-11/+1
| | | | | | | | | The only difference in daemons' interface node definition is the config write function. No need to define the node in every daemon, just pass the callback as an argument to a library function and define the node there. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis2021-07-011-1/+1
| | | | | | Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ripd: fix interface wakeup after shutdownIgor Ryzhov2021-05-171-0/+3
| | | | | | | | | | | | | | | | | RIP schedules a call to `rip_interface_wakeup` in 1 second after receiving the interface UP event from zebra. The function is called even if the interface was shut down during this interval. This is incorrect and also leads to a crash in the following scenario: ``` vtysh -c "conf" -c "router rip vrf red" -c "network enp2s0" ip link add red type vrf table 1 ip link set enp2s0 vrf red ip link set enp2s0 down ip link set enp2s0 up && ip link del red ``` Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* 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 DEFINE_HOOK & co.David Lamparter2021-03-171-2/+2
| | | | | | See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-171-2/+2
| | | | | | | | | | | | | | | | | 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>
* ripd: #if 0 we know what you are up to.Donald Sharp2021-01-281-33/+0
| | | | | | rip, ripped out the #if 0 code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* * : update signature of thread_cancel apiMark Stapp2020-10-231-4/+1
| | | | | | | | 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>
* ripd: replace inet_ntoaMark Stapp2020-10-221-6/+4
| | | | | | Replace all uses of inet_ntoa, using pI4, pFX, or inet_pton. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ripd: Convert to using %pFXDonald Sharp2020-10-171-5/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripd, ripngd: info -> debugDonald Sharp2020-09-211-4/+5
| | | | | | | There are a couple info messages in rip/ripng that really should be debugs. Modify code to be so. Signed-off-by: Donald Sharp <sharpd@nvidia.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>
* *: 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>
* *: 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>
* ripd: Add vrf name to debug outputDonald Sharp2020-02-141-14/+29
| | | | | | | The vrf id is insufficient of a discriminator in people's head Give them what they need. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: don't null after XFREE; XFREE does this itselfQuentin Young2020-02-031-1/+0
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Convert connected_free to a double pointerDonald Sharp2019-11-021-1/+1
| | | | | | Set the connected pointer to set the pointer to NULL. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert zapi->interface_delete to ifp callbackDonald Sharp2019-09-191-21/+1
| | | | | | | Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert interface_down to interface down callbackDonald Sharp2019-09-191-18/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert from ->interface_up to the interface callbackDonald Sharp2019-09-191-15/+1
| | | | | | | For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Switch all zclient->interface_add to interface create callbackDonald Sharp2019-09-191-9/+1
| | | | | | | Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Add infrastructure to support zapi interface callbacksDonald Sharp2019-09-191-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Start the conversion to allow zapi interface callbacks to be controlled like vrf creation/destruction/change callbacks. This will allow us to consolidate control into the interface.c instead of having each daemon read the stream and react accordingly. This will hopefully reduce a bunch of cut-n-paste stuff Create 4 new callback functions that will be controlled by lib/if.c create -> A upper level protocol receives an interface creation event The ifp is brand spanking newly created in the system. up -> A upper level protocol receives a interface up event This means the interface is up and ready to go. down -> A upper level protocol receives a interface down destroy -> A upper level protocol receives a destroy event This means to delete the pointers associated with it. At this point this is just boilerplate setup for future commits. There is no new functionality. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "Ospf missing interface handling 2"Donald Sharp2019-06-241-10/+6
|
* Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2Donald Sharp2019-06-221-6/+10
|\ | | | | Ospf missing interface handling 2
| * *: change interface structure, from vrf_id to vrfPhilippe Guibert2019-06-121-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change ↵Philippe Guibert2019-06-121-1/+4
| | | | | | | | | | | | | | | | | | | | if_update_to_new_vrf() api vrf_id parameter is replaced with struct vrf * parameter. It is needed to create vrf structure before entering in the fuction. an error is generated in case the vrf parameter is missing. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | ripd: use MTYPE_STATICDavid Lamparter2019-06-211-0/+2
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: use ZAPI_CALLBACK_ARGS macro for zapi handlersQuentin Young2019-05-031-14/+7
| | | | | | | | | | | | This macro: - Marks ZAPI callbacks for readability - Standardizes argument names - Makes it simple to add ZAPI arguments in the future - Ensures proper types - Looks better - Shortens function declarations Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge pull request #3548 from opensourcerouting/rip-vrfDonald Sharp2019-04-051-136/+174
|\ | | | | rip(ng)d: add VRF support
| * ripd: add VRF supportRenato Westphal2019-01-181-39/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Turn the "instance" YANG presence-container into a YANG list keyed by the new "vrf" leaf. This is a backward incompatible change but this should be ok for now. * RIP VRF instances can be configured even when the corresponding VRF doesn't exist. And a RIP VRF instance isn't deleted when the corresponding VRF is deleted. For this to work, implement the rip_instance_enable() and rip_instance_disable() functions that are called to enable/disable RIP routing instances when necessary. A RIP routing instance can be enabled only when the corresponding VRF is enabled (this information comes from zebra and depends on the underlying VRF backend). Routing instances are stored in the new rip_instances rb-tree (global variable). * Add a vrf pointer to the rip structure instead of storing vrf_id only. This is much more convenient than using vrf_lookup_by_id() every time we need to get the vrf pointer from the VRF ID. The rip->vrf pointer is updated whenever the VRF enable/disable hooks are called. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: remove the rip global variableRenato Westphal2019-01-181-57/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last step to make ripd ready for multi-instance support. Remove the rip global variable and add a "rip" parameter to all functions that need to know the RIP instance they are working on. On some functions, retrieve the RIP instance from the interface variable when it exists (this assumes interfaces can pertain to one RIP instance at most, which is ok for VRF support). In preparation for the next commits (VRF support), add a "vrd_id" member to the rip structure, and use rip->vrf_id instead of VRF_DEFAULT wherever possible. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: remove dead codeRenato Westphal2019-01-181-10/+0
| | | | | | | | | | | | | | | | None of these variables or functions were being used since the initial revision ~16 years ago. It's safe to say we can remove them now. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: move "Vrip_passive_nondefault" to the rip structureRenato Westphal2019-01-181-14/+8
| | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: move "rip_enable_network" to the rip structureRenato Westphal2019-01-181-14/+11
| | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: move "rip_enable_interface" to the rip structureRenato Westphal2019-01-181-15/+14
| | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | *: remove null check before XFREEQuentin Young2019-02-261-4/+2
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-3/+3
|/ | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* ripd: remove leftovers from the old sighup handlerRenato Westphal2018-12-031-9/+0
| | | | | | | | Commit bc1bdde2f6 removed the rip_reset() function but didn't remove other functions that were only called by rip_reset(). Remove them now (dead code). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>