summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_opaque.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ospfd: Prepare Opaque LSA for json outputOlivier Dugeon2024-02-121-10/+7
| | | | | | | Instead of output bulk of data with json output, prepare json context to decode opaque TLVs and sub-TLVs. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Fix opaque functab leak and opaque AS cleanup problemsAcee2023-12-201-30/+71
| | | | | | | | | | | 1. Fix ospf opaque LSA function table memory leak. 2. Remove incorrect one-to-one association of OSPF info-per-type to function table (since there many be many). 3. Fix a problem with opaque AS external cleanup that was exposed by #2. 4. Fix LSA memory leak in ospf_opaque_type9_lsa_if_cleanup(). Signed-off-by: Acee <aceelindem@gmail.com>
* ospfd: Fix OSPF link-local opaque LSA crash and opaque memory corruptionAcee2023-11-281-3/+54
| | | | | | | | | | | | | 1. When an OSPF interface is deleted, remove the references in link-local LSA. Delete the LSA from the LSDB so that the callback has accessibily to the interface prior to deletion. 2. Fix a double free for the opaque function table data structure. 3. Assure that the opaque per-type information and opaque function table structures are removed at the same time since they have back pointers to one another. 4. Add a topotest variation for the link-local opaque LSA crash. Signed-off-by: Acee <aceelindem@gmail.com>
* ospfd: Configurable interface-level 'capability opaque' supportAcee2023-06-281-3/+3
| | | | | | | | | | | | | | | | Add support for "[no] ip ospf capbility opaque" at the interface level with the default being capability opaque enabled. The command "no ip ospf capability opaque" will disable opaque LSA database exchange and flooding on the interface. A change in configuration will result in the interface being flapped to update our options for neighbors but no attempt will be made to purge existing LSAs as in dense topologies, these may received by neighbors through different interfaces. Topotests are added to test both the configuration and the LSA opaque flooding suppression. Signed-off-by: Acee <aceelindem@gmail.com>
* ospfd: OSPF opaque LSA stale processing fix and topotests.Acee2023-05-091-5/+11
| | | | | | | | | | | | 1. Fix OSPF opaque LSA processing to preserve the stale opaque LSAs in the Link State Database for 60 seconds consistent with what is done for other LSA types. 2. Add a topotest that tests for cases where ospfd is restarted and a stale OSPF opaque LSA exists in the OSPF routing domain both when the LSA is purged and when the LSA is reoriginagted with a more recent instance. Signed-off-by: Acee <aceelindem@gmail.com>
* ospfd: Force Opaque LSA & co to default VRFOlivier Dugeon2023-04-181-7/+14
| | | | | | | | | | | | Ospf segfault when Router Information is enabled in a non default VRF, see issue #13144. This patch forces vrf_id to default VRF for Opaque LSA and extension based on Opaque LSA: Router Information, Traffic Engineering, Extended Prefix, Extended Link and Segment Routing. Indeed, non default VRF is not yet supported for Opaque LSA & co. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* *: 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-12/+12
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert thread_add_XXX functions to event_add_XXXDonald Sharp2023-03-241-7/+8
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename `struct thread` to `struct event`Donald Sharp2023-03-241-17/+17
| | | | | | | | | 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-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>
* ospfd: Cleanup some memory leaks on shutdown in ospf_apiserver.cDonald Sharp2023-03-181-0/+4
| | | | | | | Clean up some memory leaks found in ospf_apiserver.c Also a crash in the original implementation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ospfd: inc. opaque data in `show opaque info detail json` outputChristian Hopps2023-02-201-4/+15
| | | | Signed-off-by: Christian Hopps <chopps@labn.net>
* *: 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>
* ospfd/ospfclient: add option to flush/withdrawal with zero lengthLou Berger2022-10-211-0/+11
| | | | | | default behavior is unchanged, i.e., to not zero Signed-off-by: Lou Berger <lberger@labn.net>
* ospfd: changes for code maintainabilitysri-mohan12022-08-231-97/+57
| | | | | | these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* ospfd: Remove various macros that overlap THREAD_OFFDonald Sharp2022-07-211-5/+5
| | | | | | | | 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>
* ospfd: api: fix recovery of LSA after restart of api clientChristian Hopps2022-06-021-47/+49
| | | | | | | | | Prior to this fix, restarting the client just failed b/c the code tried to "refresh" the existing LSA being added, except that code checked for meta-data to exist, which was deleted when the client disconnected previously (or had never connected and the LSA state was picked up from the network). Signed-off-by: Christian Hopps <chopps@labn.net>
* *: Fix spelling of FollowingDonald Sharp2022-04-011-9/+9
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-241-53/+31
| | | | | | | 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>
* Merge pull request #9763 from ton31337/fix/more_thread_nullRuss White2021-10-121-6/+0
|\ | | | | More struct thread null
| * ospfd: Do not explicitly set the thread pointer to NULLDonatas Abraitis2021-10-081-6/+0
| | | | | | | | | | | | | | | | 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: Donatas Abraitis <donatas.abraitis@gmail.com>
* | ospfd: fix display of plain-text data on "show ... json" commandsRenato Westphal2021-10-081-3/+5
| | | | | | | | | | | | | | | | Add a 'json' parameter to the 'show_opaque_info' callback definition, and update all instances of that callback to not display plain-text data when the user requested JSON data. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | ospfd: display detailed information about opaque LSAs in JSON formatRenato Westphal2021-10-081-0/+10
|/ | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: print extra LSA information in some log messagesRenato Westphal2021-07-051-0/+5
| | | | | | | | | | | | Log the LSA advertising router in addition to the LSA type and ID in the places where that information is necessary to uniquely identify the LSA in the LSDB. This is useful, for example, to know exactly which LSA has changed when the router is exiting from the GR helper mode when a topology change was detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: fix null pointer dereference when flushing an opaque LSARenato Westphal2021-06-081-8/+5
| | | | | | | | | | Call ospf_lsa_flush() before free_opaque_info_per_id() since the latter can deallocate the LSA that is going to be flushed. Also, there's no need to set the LSA MaxAge to OSPF_LSA_MAXAGE manually as the ospf_lsa_flush() function already takes care of that. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: Correct Coverity defectsOlivier Dugeon2021-05-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is part of the LSA header. This length, encoded in 16 bits, must be first converted to host byte order with ntohs() function. However, Coverity Scan considers that ntohs() function return TAINTED data. Thus, when the length is used to control for() loop, Coverity Scan marks this part of the code as defect with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar problems occur when browsing sub-TLV where length is extracted with ntohs(). To overcome this limitation, a size attribute has been added to the ospf_lsa structure. The size is set when lsa->data buffer is allocated. In addition, when an OSPF packet is received, the size of the payload is controlled before contains is processed. For OSPF LSA, this allow a secure buffer allocation. Thus, new size attribute contains the exact buffer allocation allowing a strict control during TLV browsing. This patch adds extra control to bound for() loop during TLV browsing to avoid potential problem as suggested by Coverity Scan. Controls are based on new size attribute of the ospf_lsa structure to avoid any ambiguity. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-171-3/+3
| | | | | | | | | | | | | | | | | 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>
* ospfd: reset mpls-te prior to ospf router removalCarlo Galiotto2020-11-161-0/+2
| | | | | | | | | | | | | | | | | | This commits attempts to fix a problem that occurs when mpls-te gets removed from ospfd config. Mpls-te has an inter-as option, which can be set to Off/Area/AS. Whenever the inter-as takes "Area" or "AS" as a value, this value will not be cleaned after removing mpls-te or after removing the ospf router. Therefore, if mpls-te is configured with inter-as AS or Area and we remove mpls-te or the ospf router, the inter-as will still preserve its value; therefore, next time mpls-te is enabled, it will automatically inherits the previous inter-as value (either Area or AS). This leads to wrong configuration, which can be a problem for frr_reload.py. The commits forces mpls-te to reset inter-as to Off before it mpls-te gets removed from the configuration and before the ospf router gets removed. Signed-off-by: Carlo Galiotto <carlo@voltanet.io>
* ospfd: json support for ospf database command.rgirada2020-11-011-9/+14
| | | | | | | | | | | | | | | | | Description: Added json support to ospf lsdb command and its subcommands. Added json to the following sub commands. show ip ospf database json show ip ospf database router json show ip ospf database network json show ip ospf database external json show ip ospf database summary json show ip ospf database asbr-summary json show ip ospf database nssa-external json show ip ospf databas max-age json show ip ospf database self-originate json Signed-off-by: Rajesh Girada <rgirada@vmware.com>
* ospfd: replace inet_ntoaMark Stapp2020-10-221-10/+10
| | | | | | Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: un-split strings across linesDavid Lamparter2020-07-141-8/+4
| | | | | | | | | | | | | | | | | 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>
* *: Do not cast to the same typeDonatas Abraitis2020-04-081-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* ospfd: Cleanup set but unused variablesDonald Sharp2020-02-271-2/+2
| | | | | | There existed some variables set but never used. Clean this up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Function order caused use after free.Donald Sharp2019-11-111-3/+3
| | | | | | | | | | | | The opaque lsa that we are storing is stored on various lists depending on it's type. This removal from the list was being done *after* the pointer was freed. This is not a good idea. Since the use after free was just removal from a linked list and the freeing function does not do anything other than free data, than just switching the function order should be sufficient. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: spelchekDavid Lamparter2018-10-251-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: list_delete_and_null() -> list_delete()David Lamparter2018-10-021-11/+11
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* ospfd: remove unnecessary housekeeping code when using linked listsRenato Westphal2018-09-241-8/+0
| | | | | | | | The head and tail pointers of linked lists should never be modified manually, the linked list API guarantees that these pointers are always valid and up-to-date. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: OSPF_[ERR|WARN] -> EC_OSPFQuentin Young2018-09-131-39/+39
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib: Convert ospf_opaque.c to use the err-card systemDonald Sharp2018-09-061-91/+107
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: ALLOC calls cannot failDonald Sharp2018-08-111-22/+7
| | | | | | | | There is no need to check for failure of a ALLOC call as that any failure to do so will result in a assert happening. So we can safely remove all of this code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-22/+22
| | | | | | | | | | | | | | | | | | | | | | 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-40/+37
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* ospfd: Fix ospfd crashOlivier Dugeon2018-02-091-1/+35
| | | | | | | | | | | | | | | | - ospfd/ospf_opaque.c: Update issue #1652 by introducing a new function 'free_opaque_info_owner()' to clean list of callback owner and call this function in appropriate place where 'listdelete_and_null' is not used. - ospfd/ospf_packet.c: In case of crash, ospfd is not been able to flush LSA. In case of self Opaque LSA, when restarting, ospfd crash during the resynchronisation process with its neighbor due to an empty list of LSA to flood. Just add a control on the list count in 'ospf_ls_upd_queue_send()' to escape the function and avoid the problem. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Fix ospfd crash during CIOlivier Dugeon2018-02-031-0/+9
| | | | | | | | | | | | | | | | | When preforming CI test, CLI command 'no router ospf' followed by a 'router ospf' is performed to clean up the previous configuration. Ospfd crash when configuring 'netwoark area'. This is due to opsf_opaque_term() introduce in previous commit that cause this crash. It remove not only Opaque LSA but also the list through the call to 'list_delete_and_null()' function. Same take place in 'ospf_mpls_te_term()', 'ospf_router_info_term()' and 'ospf_ext_term()' function. New set of 'ospf_XXX_finish()' has been introduced to solve this issue while keeping the possiblity to terminate properly the Opaque LSA and remove MPLS LFIB entries set by Segment Routing. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Clean up Segment Routing patchOlivier Dugeon2018-01-301-1/+1
| | | | | | | | | | | | | - ospfd/ospf_te.c: Remove unregister function and call to ospf_delete_opaque_functab() following the introduction of ospf_opaque_term() function in ospfd.c for ospfd termination. - ospfd/ospf_sr.c: Set initial index value for node-msd CLI to avaoid crash when using this command - ospfd/ospf_ext.c: Disable call to ospf_sr_update_prefix() if Segment Routing, thus Extended Link/Prefix, is not enable - ospfd/ospf_opaque.c: Correct scheduling of Opaque LSA flooding Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* Merge remote-tracking 'frr/master' into SR-RoutingOlivier Dugeon2018-01-301-24/+0
|\
| * OSPFD: Solve Issue #1652Olivier Dugeon2018-01-231-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue 1652 was related to OSPF Crash on termination when ospf is configured to flood self Opaque LSA e.g TE or RI Opaque LSA. Analysis: The problem resides in free_opaque_info_per_type() line 576 of ospf_opaque.c. Once LSA flush, the function removes by calling listnode_delete() function the opaque_info_per_type data structure. However, this is also performed at the upper level function ospf_opaque_type10lsa_term() which call list_delete_and_null() function. This result into a double free pointer exception. Solution: Remove call to listnode_delete() calls in free_opaque_info_per_type() function as it is done by list_delete_and_null(). Delete lines 592 - 615. Remove also second call to ospf_opaque_type10lsa_term() in ospfd.c line 848. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* | OSPFd: Update Segment Routing PR following reviewOlivier Dugeon2018-01-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following various review, following files have been modfied: - All: Change u_intXX_t typedef to standard uintXX_t types - doc/OSPF-SR.rst: Update doc in particular the Linux Kernel configuration section - doc/ospfd.texi: Update CLI - ospfd/ospf_dump.[c,h]: Add new 'debug ospf sr' when performing 'sh run' - ospfd/ospf_ext.[c, h]: Various bug corrections notably to handle flooding of Extended Prefix at startup. iFix TLVs size for LAN Adjacency. Update Licence as per Community.md - ospfd/ospf_opaque.c: Add proper termination function call to remove MPLS entries - ospfd/ospf_ri.[c,h]: Bug corrections - ospfd/ospf_sr.[c,h]: Various bug corrections, notably to determine the nexthop SR Node. Add support to 'no-php-flag'. Update Licence as per Community.md - ospfd/ospfd.c: Add call to 'ospf_opaque_term()' Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* | OSPFD: Add Experimental Segment Routing supportOlivier Dugeon2018-01-181-3/+22
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an implementation of draft-ietf-ospf-segment-routing-extensions-24 and RFC7684 for Extended Link & Prefix Opaque LSA. Look to doc/OSPF_SR.rst for implementation details & known limitations. New files: - ospfd/ospf_sr.h: Segment Routing structure definition (SubTLVs + SRDB) - ospfd/ospf_sr.c: Main functions for Segment Routing support - ospfd/ospf_ext.h: TLVs and SubTLVs definition for RFC7684 - ospfd/ospf_ext.c: RFC7684 Extended Link / Prefix implementation - doc/OSPF-SRr.rst: Documentation Modified Files: - doc/ospfd.texi: Add new Segment Routing CLI command definition - lib/command.h: Add new string command for Segment Routing CLI - lib/mpls.h: Add default value for SRGB - lib/route_types.txt: Add new OSPF Segment Routing route type - ospfd/ospf_dump.[c,h]: Add OSPF SR debug - ospfd/ospf_memory.[c,h]: Add new Segment Routing memory type - ospfd/ospf_opaque.[c,h]: Add ospf_sr_init() starting function - ospfd/ospf_ri.c: Add new functions to Set/Get Segment Routing TLVs Add new ospf_router_info_lsa_upadte() to send Opaque LSA to ospf_sr.c() - ospfd/ospf_ri.h: Add new Router Information SR SubTLVs - ospfd/ospf_spf.c: Add new scheduler when running SPF to trigger update of NHLFE - ospfd/ospfd.h: Add new thread for Segment Routing scheduler - ospfd/subdir.am: Add new files - vtysh/Makefile.am: Add new ospf_sr.c file for vtysh - zebra/kernel_netlink.c: Add new OSPF_SR route type - zebra/rt_netlink.[c,h]: Add new OSPF_SR route type - zebra/zebra_mpls.h: Add new OSPF_SR route type Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>