summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_ext.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: 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-14/+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-5/+5
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #9683 from volta-networks/sr-minor-fixesIgor Ryzhov2021-11-201-2/+2
|\ | | | | ospfd, isisd: minor SR fixes
| * ospfd: replace iterator by RO version ..Fredi Raspall2021-09-281-2/+2
| | | | | | | | | | | | ..since it's used for read-only lookups. Signed-off-by: Fredi Raspall <fredi@voltanet.io>
* | ospfd: fix display of plain-text data on "show ... json" commandsRenato Westphal2021-10-081-4/+14
|/ | | | | | | | 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: Correct Coverity defectsOlivier Dugeon2021-05-191-19/+64
| | | | | | | | | | | | | | | | | | | | | | | 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>
* ospfd: Correct Segment Routing prefix bugsOlivier Dugeon2021-03-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch solves 2 Segment Routing prefix bugs: - If Segment Routing is not enabled in the initial configuration, Extended Prefix Opaque LSA is not flood. This is due to a control flag which is set only when Segment Routing is enabled at startup and not latter. - Attempting to modify Segment Routing prefix flag e.g. adding or removing no-php or explicit-null flag, doesn't work as expected: Corresponding entry in the MPLS table is not updated, Extended Prefix Opaque LSA carry wrong flag value, and neighbor set a wrong configuration in the MPLS table for this Segment Routing prefix. The first bug is corrected in ospfd/ospf_ext.c: - Flag setting is moved from ospf_ext_ism_change() to set_ext_prefix() function The seconf one is corrected in ospfd/ospf_sr.c: - For self node, previous MPLS entry is removed if needed and flag reset before setting the new Segment Routing prefix configuration - For neighbor node, srnext field of sr_prefix structure is always set and not only for new SR Prefix. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add more Segment Routing controlsOlivier Dugeon2020-10-231-9/+16
| | | | | | | | | | When Segment Routing is not enabled, some related output messages are printed on the console especially when Segment Routing Debug is enabled. This patch adds additional controls to check whether segment routing is enabled or not. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: replace inet_ntoaMark Stapp2020-10-221-9/+9
| | | | | | 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-4/+4
| | | | | | | 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: Correct Extended Prefix flooding for SROlivier Dugeon2020-08-201-8/+1
| | | | | | | | | PR #6416 that solves opsf crash when segment routing is restarted, introduce a regression in Extended Prefix flooding: when segment routing prefix is modified or removed, new segment routing prefix is no more flooded. This patch correct this regression. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add Segment Routing Local BlockOlivier Dugeon2020-08-201-30/+135
| | | | | | | | | | | | | | 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>
* *: un-split strings across linesDavid Lamparter2020-07-141-23/+11
| | | | | | | | | | | | | | | | | 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>
* ospfd: Update Prefix & Adjacency SIDs ManagementOlivier Dugeon2020-06-031-10/+65
| | | | | | | | | | SIDs are not uninstall in LFIB when ospf adjacenyi or loopback goes down as self LSA flusing is not handle by ospf_ext_link_lsa_update(). The patch introduces new functions ospf_sr_ext_itf_add() and ospf_sr_ext_itf_delete() in ospf_sr.c to directly manage LFIB for SIDs when change is detected in ospf_ext_link_ism_change() and ospf_ext_link_nsm_change(). Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add ECMP support to OSPF Segment RoutingOlivier Dugeon2020-06-031-104/+72
| | | | | | | | | * Change sr_prefix structure in ospf_sr.h to add support to ECMP * Add new Segment Routing information to ospf_paths in ospf_route.h * Backport MPLS label configuration from IS-IS Segment Routing implementation * Re-write log message in ospf_sr.c and ospf_ext.c Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Solve crash after removing and adding conf.Olivier Dugeon2020-05-261-90/+104
| | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: list_delete_and_null() -> list_delete()David Lamparter2018-10-021-1/+1
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* ospfd: OSPF_[ERR|WARN] -> EC_OSPFQuentin Young2018-09-131-25/+25
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: style for flog_warn conversionsQuentin Young2018-09-061-15/+19
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ospfd: Convert ospf_ext.c to use new error-code subsystemDonald Sharp2018-09-061-47/+45
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Add OSPF_WARN_LSA_INSTALL_FAILURE error codeDonald Sharp2018-09-061-4/+8
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Add OSPF_WARN_OPAQUE_REGISTRATIONDonald Sharp2018-09-061-2/+5
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ospfd: Cleanup some warnings that were not warningsDonald Sharp2018-09-061-10/+0
| | | | | | | | | | 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-28/+2
| | | | | | | | | | | | | | 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>
* *: ALLOC calls cannot failDonald Sharp2018-08-111-5/+0
| | | | | | | | 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>
* ospfd: buffer termination (Coverity 1464993)paco2018-06-141-2/+2
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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-95/+72
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* OSPFD: Fix Segment Routing Lan Adjacency TLVsOlivier Dugeon2018-02-191-11/+18
| | | | | | | | | | - Lan Adjacency TLVs was incorrectly formatted due to an error in TLV size computation. Add new macro to fix this issue - Update SR link nexthop when it corresponds to an LAN Adj SID. The nexthop is set to the router id in the TLVi (as per draft), but we need the neighbor IP address to set the corresponding MPLS LFIB entry Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Fix some new SA issues found by coverityDonald Sharp2018-02-141-1/+1
| | | | | | | | | | Fix a || && mixup. Add an assert for area to show we expect it to be non-null going forward. When memory is allocated if it fails we abort then no need to check for null. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* OSPFd: Fix Opaque LSA filtering in Segment RoutingOlivier Dugeon2018-02-051-2/+12
| | | | | | | | | | | | | | | 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-2/+26
| | | | | | | | | | | | | | | | | 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 Extended Prefix LSA refreshOlivier Dugeon2018-02-011-7/+10
| | | | | | | | | | - When Extended Prefix LSA need to be refresh, paramaters may be taken from the wrong interface i.e. Extended Link instead of Prefix resulting in producing an empty LSA body. Then, ospfd crash due to the assert on LSA length in ospf_lsa_different() function: code check that the LSA size is larger than LSA header i.e. LSA is not empty. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Clean up Segment Routing patchOlivier Dugeon2018-01-301-1/+2
| | | | | | | | | | | | | - 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>
* OSPFd: Remove unecessary debug messageOlivier Dugeon2018-01-301-1/+0
| | | | | | | | - Line 865 in ospfd/ospf_ext.c cause compilation failure when -werror is set. This line was not necessary and add only for debugging purpose. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFd: Update Segment Routing PR following reviewOlivier Dugeon2018-01-291-283/+296
| | | | | | | | | | | | | | | | | | | | | 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-35/+35
| | | | | | | - 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: Update Segment Routing implementationOlivier Dugeon2018-01-191-0/+8
| | | | | | | | | | | | | | - ospf_ext.c: Correct deferred pointer raised by valgrind - ospf_sr.c: Correct deffered pointer raised by valgrind. Modify Segment Routing shutdown. This is due to the fact that RI LSA 4.0.0.0 is flush prior to 7.0.0.X & 8.0.0.X LSA. This trigger SR-Node deletion which also remove all Extended Link / Prefix leaving them unavailable when there are referenced by 7.0.0.X & 8.0.0.X LSA flushing. - doc/OSPF-SR.rst: Correct Restructured Text syntax and add Configuration example as well as Credit section Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* OSPFD: Add Experimental Segment Routing supportOlivier Dugeon2018-01-181-0/+1769
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>