summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_interface.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* eigrp: use correct memory pool on interface deletionVolodymyr Huti2023-10-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Trying to delete an interface during the test test_eigrp_topo1.py triggers a crash. ``` EIGRP: abort+0x12b EIGRP: _zlog_assert_failed+0x18c EIGRP: mt_count_free+0x56 EIGRP: qfree+0x2e EIGRP: eigrp_if_delete_hook+0x8c EIGRP: hook_call_if_del+0x5f EIGRP: if_delete_retain+0x1c EIGRP: if_delete+0xfb EIGRP: if_destroy_via_zapi+0x69 EIGRP: zclient_interface_delete+0x57 EIGRP: zclient_read+0x3d0 EIGRP: event_call+0xd8 EIGRP: frr_run+0x271 EIGRP: main+0x14b EIGRP: __libc_start_main+0xf3 EIGRP: _start+0x2e EIGRP: in thread zclient_read scheduled from lib/zclient.c:4514 zclient_event() ``` Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
* *: 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 THREAD_XXX macros to EVENT_XXX macrosDonald Sharp2023-03-241-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_cancelXXX to event_cancelXXXDonald Sharp2023-03-241-2/+2
| | | | | | 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-1/+1
| | | | 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-091-16/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: introduce function for sequence numbersRafael Zalamena2023-01-201-1/+2
| | | | | | | | | | | | Don't directly use `time()` for generating sequence numbers for two reasons: 1. `time()` can go backwards (due to NTP or time adjustments) 2. Coverity Scan warns every time we truncate a `time_t` variable for good reason (verify that we are Y2K38 ready). Found by Coverity Scan (CID 1519812, 1519786, 1519783 and 1519772) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* eigrpd: Ensure better `struct thread *` semanticsDonald Sharp2021-10-041-1/+1
| | | | | | | | | | | | 1) 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. 2) Fix mixup of `struct eigrp_interface` and `struct eigrp` usage of the same thread pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* eigrpd: kill eigrp_memory.h, use MTYPE_STATICDavid Lamparter2021-03-221-1/+3
| | | | | | | Same as previous commit -- convert most DEFINE_MTYPE into the _STATIC variant, and move the remaining non-static ones to appropriate places. Signed-off-by: David Lamparter <equinox@diac24.net>
* eigrpd: Correctly set the mtu for eigrp packets sentDonald Sharp2021-01-311-3/+15
| | | | | | | | | | | | | | This version of eigrp pre-calculated the eigrp metric to be a default of 1500 bytes, but unfortunately it had entered the byte order wrong. Modify the code to properly set the byte order according to the eigrp rfc as well as actually read in and transmit the mtu of the interface instead of hard coding it to 1500 bytes. Fixes: #7986 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* eigrpd: Introduce eigrp_metric.[ch] and eigrp_types.hDonnie Savage2021-01-121-30/+2
| | | | | | | Add these file and introduce some new fundamental types Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Donnie Savage <diivious@hotmail.com>
* eigrpd: Rename nexthop_entry and prefix_entry to better namesDonnie Savage2021-01-121-10/+11
| | | | | | | | | | Rename struct eigrp_nexthop_entry to struct eigrp_route_descriptor Rename struct eigrp_prefix_entry to struct eigrp_prefix_descriptor Fix all the associated function names as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Donnie SAvage <diivious@hotmail.com>
* *: unify thread/event cancel macrosMark Stapp2020-10-231-1/+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-1/+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>
* *: 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>
* *: don't null after XFREE; XFREE does this itselfQuentin Young2020-02-031-1/+0
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* eigrpd, ospfd, pimd: Fix assumption that interface may not be upDonald Sharp2019-12-041-31/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit: ddbf3e60604019d4b38d51226700e2244cc531b6 This commit modified the interface up handling code in ZAPI such that the zclient handled the decoding for you. Prior to this commit ospf assumed that it could use the old ifp pointer to know state before reading the stream. This lead to a situation where ospf would `smartly` track and do the right thing in this situation. This commit changed this assumption and in certain scenarios, say a interface was changed after it was already up would lead to situations where ospf would not properly handle the new interface up. Modify ospf to track data that is important to it in it's interface->info pointer. This code pattern was followed in both eigrp and pim. In eigrp's case it was just behaving weirdly in any event so fixing this pattern is not a big deal. In pim's case it was not properly using this so it's a no-op to fix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert zapi->interface_delete to ifp callbackDonald Sharp2019-09-191-0/+13
| | | | | | | 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-0/+7
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert from ->interface_up to the interface callbackDonald Sharp2019-09-191-0/+41
| | | | | | | 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-0/+9
| | | | | | | 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>
* eigrpd: Update eigrp_topology.c to not use VRF_DEFAULTDonald Sharp2019-08-071-3/+3
| | | | | | | Push out the pass in of struct eigrp to all functions in eigrp_topology.c so we do not lookup the eigrp pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Add `router eigrp AS [vrf NAME]` and various stuffDonald Sharp2019-08-071-4/+1
| | | | | | | Add the ability to parse `router eigrp AS [vrf NAME]` and modify eigrp_lookup to actually handle a vrf_id for us. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrp: Make the eigrp_interface have a prefix instead of a *prefixDonald Sharp2019-02-111-6/+6
| | | | | | | | | The prefix data structure was being freed yet still needed in the future and it's a fundamental part of the eigrp_interface data structure let's keep it there instead of having it be deleted and then not. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Don't crash on a `no network A.B.C.D/M`Donald Sharp2019-02-041-11/+7
| | | | | | | | | This command was crashing. This fixes the crash we are still not behaving quite correctly on handling routes we have learned from those peers covered by the network statement. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-1/+1
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* *: list_delete_and_null() -> list_delete()David Lamparter2018-10-021-2/+2
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* eigrpd: Fix eigrp crash on shut of a interfaceDonald Sharp2018-09-221-4/+2
| | | | | | | | | | | | | The eigrp interface structure was storing a pointer to the connected interface structure and on shutdown of an interface this would cause zebra to call eigrp back with a shutdown of that interface, as part of that operation the connected interface structure is being deleted, but eigrp was keeping a pointer to the connected structure. At the same time we were keeping the address of the connected structure and this is all we need, so keep a copy of that data and use that instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: null check (Coverity 1455334 and 4 alike)paco2018-06-211-0/+3
| | | | | | | | Coverity issues fixed with this commit: 1455334 1455335 1455336 1455337 1455339 Signed-off-by: F. Aragon <paco@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-7/+7
| | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-8/+4
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp2017-10-051-2/+2
| | | | | | | | | | | | | | | | | | | Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Remove ei mapping to connected routesDonald Sharp2017-10-031-210/+54
| | | | | | | | | | We need one struct eigrp_interface per ifp structure not a ifp->info structure with a ei per connected. Some minor code cleanup as well with macros and their weird usage. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Start fixing eigrp_interfaceDonald Sharp2017-10-031-1/+1
| | | | | | | | | | | | | | | The EIGRP interface handling code created 2 levels of interface information, the ei( created per *connected* address?????) and the ifp->info pointer. Start the combination of pushing these together and cleaning up the weirdness that is these two data structures. This commit probably breaks eigrp's handling of interfaces. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #1051 from donaldsharp/plistsDavid Lamparter2017-09-051-5/+5
|\ | | | | Refactor Access and Prefix Lists application
| * eigrpd: eigrp_neighbor_entry to eigrp_nexthop_entryDonald Sharp2017-08-271-5/+5
| | | | | | | | | | | | | | | | The struct 'eigrp_neighbor_entry' really represents a nexthop for a prefix. Rename the structure to better represent what we are representing. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge pull request #1044 from donaldsharp/combinationJafar Al-Gharaibeh2017-08-311-5/+4
|\ \ | | | | | | Coverity Cleanup of Stuff
| * | eigrpd: Cleanup various SA IssuesDonald Sharp2017-08-251-5/+4
| |/ | | | | | | | | | | | | | | | | | | 1) Handle key value not found on interface 2) Handle various NULL pointer possibilities 3) Fix possible integer overflow 4) Fix memory leak 5) Check return codes on sscanf Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* / eigrpd: add correct interface metrics when interface comes upDon Slice2017-08-261-0/+1
|/ | | | | | | | Problem noticed where we were not sending the correct metric values to our peers for connected interfaces. Found that we were not storing these values on the structure used to send the update packets. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* eigrpd: Remove 'struct prefix_ipv4' from eigrp_interface.cDonald Sharp2017-08-241-6/+6
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Refactor eigrp_topoloy_table_lookup_ipv4Donald Sharp2017-08-241-6/+4
| | | | | | | Allow eigrp_topology_table_lookup_ipv4 to use 'struct prefix' Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Convert pe->destination_ipv4 to pe->destinationDonald Sharp2017-08-241-7/+6
| | | | | | | Convert the destination_ipv4 to a struct prefix and just call it destination. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Use FSM for interface pe already known.Donald Sharp2017-08-241-16/+33
| | | | | | | | | | | | | There exists a case where a switch already has a eigrp_prefix_entry for a interface that is coming up. In this situation, we need to use the FSM to let the connected route take precedence instead of blindly just updating the world about it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd: Remove unnecessary checkDonald Sharp2017-08-241-3/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: replace if_add_hook with hook_* logicDavid Lamparter2017-08-151-2/+2
| | | | | | | This allows modules to register their own additional hooks on interface creation/deletion. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* eigrpd: fix spelling of "bandwidth"Andrew Lunn2017-08-111-1/+1
| | | | | | | There are a number of spelling errors in eigrp. But this one is particular annoying because it is a variable name, not in a comment. Signed-off-by: Andrew Lunn <andrew@lunn.ch>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-3/+2
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>