summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_ri.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ospfd: Force Opaque LSA & co to default VRFOlivier Dugeon2023-04-181-20/+19
| | | | | | | | | | | | 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>
* *: 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>
* *: 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 FollowingDonald Sharp2022-04-011-6/+6
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ospfd: fix display of plain-text data on "show ... json" commandsRenato Westphal2021-10-081-2/+9
| | | | | | | | 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: New code adds newline to log filesDonald Sharp2021-05-191-1/+1
| | | | | | FRR is not using newlines in log messages. Remove them. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #8690 from idryzhov/ospf-fix-tlv-sizeOlivier Dugeon2021-05-191-4/+2
|\ | | | | ospfd: fix SID/Label Sub TLV size
| * ospfd: fix SID/Label Sub TLV sizeIgor Ryzhov2021-05-181-4/+2
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | ospfd: Correct Coverity defectsOlivier Dugeon2021-05-191-27/+100
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* *: remove tabs & newlines from log messagesDavid Lamparter2021-02-141-5/+2
| | | | | | | Neither tabs nor newlines are acceptable in syslog messages. They also break line-based parsing of file logs. Signed-off-by: David Lamparter <equinox@diac24.net>
* ospfd: replace inet_ntoaMark Stapp2020-10-221-25/+26
| | | | | | Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ospfd: Coverity correctionsOlivier Dugeon2020-08-261-8/+15
| | | | | | | Following PR #6726, Coverity Scan detected some new errors in the OSPF Segment Routing code. This patch corrects them. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add Segment Routing Local BlockOlivier Dugeon2020-08-201-27/+59
| | | | | | | | | | | | | | RFC 8665 defines a Segment Routing Local Block for Adjacency SID. This patch provides the possibility to modify the SRLB as well as reserved the block range from the Label Manager. - Introduce new CLI 'segment-routing local-block' - Add local block to SRDB structure - Parse / Serialize SRLB in Router Information LSA - Update OSPF-SR topotest - Update documentation Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Solve crash after removing and adding conf.Olivier Dugeon2020-05-261-0/+10
| | | | | | | | | | | | | | | | | | | | Issue number #6291 describes how OSPFd crashes after being deleted and then added again with configuration when segment routing is used. The problem occurs in ospf_ri.c because the OspfRI structures retains the reference to the old area pointer which is mofified when ospfd is reactivated by configuration. When segment routing is activated, the LSA Router Information is sent with reference to the old area pointer, instead the new one, which causes the crash. The same problem is also present in ospf_ext.c with OspfEXT structure and Extended Link/Prefix structure. This commit introduces Extended Link/Prefix and Router Information LSAs flusing when OSPFd is stopped when configuration is removed and adds the correct initialization to the area pointer in OspfRI and Extended Link/Prefix structure when OSPFd is re-enabled with the configuration. Area pointer has been removed from the OspfEXT structure as it is never used with this commit. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* *: Do not cast to the same typeDonatas Abraitis2020-04-081-1/+1
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: remove line breaks from log messagesDavid Lamparter2020-03-241-3/+2
| | | | | | | | Line break at the end of the message is implicit for zlog_* and flog_*, don't put it in the string. Mid-message line breaks are currently unsupported. (LF is "end of message" in syslog.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-3/+3
| | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-1/+1
| | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* OSPF: Add support to multi-area to Router Info.Olivier Dugeon2018-11-091-225/+351
| | | | | | | | | | | | Router Information needs to specify the area ID when flooding scope is set to AREA. However, this authorize only one AREA. Thus, Area Border Router (ABR) are unable to flood Router Information Opaque LSA in all areas they are belongs to. The path implies that the area ID is no more necessary for the command 'router-info area'. It remains suported for compatibility, but mark as deprecated. Documentation has been updated accordingly. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.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-2/+2
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* ospfd: remove unnecessary housekeeping code when using linked listsRenato Westphal2018-09-241-9/+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-8/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: style for flog_warn conversionsQuentin Young2018-09-061-3/+5
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ospfd: Convert ospf_ri to use error-code subsystemDonald Sharp2018-09-061-9/+12
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Add OSPF_WARN_LSA_INSTALL_FAILURE error codeDonald Sharp2018-09-061-2/+4
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Modify ospf_ri.c to use new error-code subsystemDonald Sharp2018-09-061-12/+3
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Add OSPF_WARN_OPAQUE_REGISTRATIONDonald Sharp2018-09-061-2/+3
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Cleanup some warnings that were not warningsDonald Sharp2018-09-061-4/+2
| | | | | | | | | | 1) stream allocation cannot fail 2) some warnings were removed when functions safely ignored the calling parameters being wrong. 3) some warnings were removed when functions did not consider the state as an error since we did not return an error code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Add ospf_lsa_new_and_data function and abstract awayDonald Sharp2018-08-211-12/+1
| | | | | | | | | | | | | | In all but one instance we were following this pattern with ospf_lsa_new: ospf_lsa_new() ospf_lsa_data_new() so let's create a ospf_lsa_new_and_data to abstract this bit of fun and cleanup all the places where it assumes these function calls can fail. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* eigrpd nhrpd ospfd pimd: fomat fixes (PVS-Studio)F. Aragon2018-07-021-4/+4
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* ospfd: OoB access (Cov 1452454 1452455 1452456)paco2018-06-141-5/+6
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-34/+34
| | | | | | | | | | | | | | | | | | | | | | 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-26/+16
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* OSPFd: Fix Opaque LSA filtering in Segment RoutingOlivier Dugeon2018-02-051-2/+7
| | | | | | | | | | | | | | | Opaque LSA were incorrectly filtered. LSA Type 1 with a router id set to 4.x.x.x or 7.x.x.x. or 8.x.x.x are not correctly filtered and pass to Segment Routing as wrong Opaque LSA of type Router Information, Extended Prefix respectively Extended Link. - Add Opaque LSA check to the filter The CLI command 'segment-routing prefix' didn't check if a same prefix already exist in SRDB resulting to multiple entries in the SRDB for the same prefix. - Update prefix intead of adding a new one if already present in the SRDB Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Fix ospfd crash during CIOlivier Dugeon2018-02-031-0/+27
| | | | | | | | | | | | | | | | | 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: Correct compilation errorOlivier Dugeon2018-01-301-3/+0
| | | | | | - Forget to remove ospf_router_info_unregister in ospfd_ri.c Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Update Segment Routing PR following reviewOlivier Dugeon2018-01-291-31/+11
| | | | | | | | | | | | | | | | | | | | | 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: Set Segment Routing patch conform to C99Olivier Dugeon2018-01-231-10/+10
| | | | | | | - Change all u_intXX_t typedef to standard type uintXX_t - Correct removal of ZEBRA_OSPF_SR route in ospf_sr.c line 670 Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFD: Add Experimental Segment Routing supportOlivier Dugeon2018-01-181-55/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: add missing \n in some help stringsRenato Westphal2017-10-241-1/+1
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ospfd: Fix leak of route_nodeDonald Sharp2017-10-101-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp2017-10-051-4/+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>
* ospfd: OSPFv2 VRF SupportChirag Shah2017-10-031-5/+20
| | | | Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
* Correct build TLV functionsOlivier Dugeon2017-07-311-1/+1
| | | | | | | | * Functions that build TLVs in ospf_te.c and ospf_te.c use 'tlvh + 1' to move the pointer to the TLV payload ifor strem_put(). * Correct this by using TLV_DATA() macro which is saffer. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* Update PR #839 following reviewOlivier Dugeon2017-07-271-33/+33
| | | | | | | | * Remove enum status_t opcode in ospfd.h * Replace enum status_t opcode by bool enabled in ospf_te.[c,h] and ospf_ri.c * Add missign parenthesis '()' around 'if CHECK_FLAG' in ospf_te.c and ospf_ri.c Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* Correct indentation and remove _opcode_t typedefOlivier Dugeon2017-07-211-2/+2
| | | | | | | | * Correct struct tlh_header indentation in opaque.h * Change typedef enum _opcode_t by enum lsa_opcode * Propagate change in ospf_te.[c,h) and ospf_ri.c Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPF OPAQUE, TE and RI macro refactoring & cleanupOlivier Dugeon2017-07-201-138/+135
| | | | | | | | | | | * TLV macros where define itwice in ospf_te.h and in ospf_ri.h * Merge both definition in ospf_opaque.h and adjust accordingly RI and TE * Same for typedef status_t which is move in ospfd.h * Remove also all 'goto' statement in ospf_te.c and ospf_ri.c * Remove strange function lookup_oi_by_ifp() in ospf_te.c and replace it by a valid code in initialize_linkparams() function Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>