summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_sr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ospfd: Correct Segment Routing prefix bugsOlivier Dugeon2021-03-091-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Debug race condition in Segment RoutingOlivier Dugeon2021-02-111-23/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #7926 hilight a race condition in Segment Routing processing. The problem occurs when Router Information Opaque LSA is received late, in particular after SPF run and after ospf_sr_nhlfe_update() was called. This scenario is unfrequent and takes place due to a slow DR election. In this particular case, SR Prefix are handle but not fully fill. In fact, SRGB for the nexthop is not yet received and thus, output label could not be computed. When Router Information Opaque LSA is received and processed, if the corresponding SR node is a direct neighbor of the self node, update_out_nhlfe() is called against all SR nodes to adjust SR prefix if the next hop is the new SR node. The function wrongly computes output label and configure a bad MPLS LFIB entries. Another way to hilight the problem is to change through CLI the SRGB of a node and look to MPLS LFIB of direct neighbor, in particular those who announce EXPLICIT NULL Prefix SID. This patch correct the update_out_nhlfe() function by calling the appropriate function (sr_prefix_out_label() instead of index2label()) to compute the output label. Some log debugs were adjusted and unused prefix route table was removed too. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Make use of adjacency SIDs in TI-LFAGalaxyGorilla2021-01-191-0/+27
| | | | | | | | When P and Q spaces are adjacent then it makes sense to use adjacency SIDs to from the P node to the Q node. There are some other corner cases where this makes also sense like when a P/Q node adjacent to root node. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
* ospfd: TI-LFA basic infrastructure and algorithmsGalaxyGorilla2021-01-191-0/+34
| | | | Signed-off-by: GalaxyGorilla <sascha@netdef.org>
* Merge pull request #7380 from Orange-OpenSource/ospf-srDonald Sharp2020-10-241-1/+5
|\ | | | | Add more Segment Routing controls
| * ospfd: Add more Segment Routing controlsOlivier Dugeon2020-10-231-1/+5
| | | | | | | | | | | | | | | | | | | | 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>
* | *: 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>
* ospfd: replace inet_ntoaMark Stapp2020-10-221-22/+36
| | | | | | Stop using inet_ntoa, use %pI4 etc or inet_ntop instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ospfd: Store neighbor Adjacency SID in SR databaseOlivier Dugeon2020-10-141-18/+22
| | | | | | | | | | | | For TI-LFA, it is necessay to known the Adjacency SID advetise by the nieghbor routers. However, the current Segment Routing code skip neighbor Adjacency SID and thus, don't store them into the Segment Routing database. This PR takes care of neighbor Adjacency SID by allowing to store them in the Segment Routing database. Corresponding MPLS table entry is only configured if the advertised Adjacency SID is global i.e. with L-Flag unset. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Coverity correctionsOlivier Dugeon2020-08-261-18/+26
| | | | | | | 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: Explicit Null option for Segment-RoutingOlivier Dugeon2020-08-201-64/+110
| | | | | | | | Add new option to `segment-routing prefix` command to set the Explcit Null flag in addition to the No-PHP flag. MPLS LFIB configuration has been also updated to take into account the Explicit Null flag. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add Segment Routing Local BlockOlivier Dugeon2020-08-201-83/+433
| | | | | | | | | | | | | | 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: Add Label Manager for Segment RoutingOlivier Dugeon2020-08-201-92/+174
| | | | | | | | | Segment Routing Global Block is now using the Label Manager to reserved label range. Label Manager connection uses the synchronous mode and dedicated thread timer is used to establish the connection in safe manner without blocking OSPFd is the Label Manager is not available. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: fix processing of SR RI LSAsGalaxyGorilla2020-08-101-21/+14
| | | | | | | | | | | | | | Router Information are contained in opaque LSAs and when such a LSA is received a new SR node for the advertising router is created. However, the RI related data is currently not set when such a SR node already exists. This can happen when e.g. link and prefix information arrive before the RI and therefore an SR node is created. This is now fixed by setting the data everytime the RI is received, independent of the SR node already existing or not. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
* *: un-split strings across linesDavid Lamparter2020-07-141-12/+6
| | | | | | | | | | | | | | | | | 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: Move Segment Routing Zebra functionsOlivier Dugeon2020-06-031-132/+15
| | | | | | | | | | For coherency, move and rename functions that send MPLS labels configurations from ospf_sr.c to ospf_zebra.c: - ospf_zebra_update_prefix_sid() - ospf_zebra_delete_prefix_sid() - ospf_zebra_send_adjacency_sid() Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Update Prefix & Adjacency SIDs ManagementOlivier Dugeon2020-06-031-6/+132
| | | | | | | | | | 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: OSPF Segment Routing improvementOlivier Dugeon2020-06-031-143/+160
| | | | | | | | - Improve parsing of Router Information, especially when a router stops advertising Segment Routing capabilities - Finish conversion to '%pFX' and '%pI4' Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
* ospfd: Add ECMP support to OSPF Segment RoutingOlivier Dugeon2020-06-031-391/+456
| | | | | | | | | * 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>
* *: sprintf -> snprintfQuentin Young2020-04-211-15/+22
| | | | | | | | | | | | | Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Do not cast to the same typeDonatas Abraitis2020-04-081-4/+4
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: encode zapi labels message using nexthopsMark Stapp2020-02-141-4/+4
| | | | | | | | Use the zapi_nexthop struct with the mpls_labels zapi messages instead of the special-purpose (and more limited) nexthop struct that was being used. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* ospfd: avoid installing SR FTNs twiceRenato Westphal2019-09-101-51/+2
| | | | | | | | There's no need to install MPLS FTNs using the ZEBRA_ROUTE_ADD message since the ZEBRA_MPLS_LABELS_ADD message already does that (in addition to installing an MPLS LSP). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib, zebra: add new MPLS zapi message with route replace semanticsRenato Westphal2019-09-101-5/+8
| | | | | | | This new message makes it possible to install/reinstall LSPs with multiple nexthops using a single ZAPI message. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib, zebra: enhance the MPLS zapi messagesRenato Westphal2019-09-071-8/+13
| | | | | | | | | | * Add ability to specify the nexthop type; * Add ability to install or not a FTN (in addition to an LSP). These two additions will be useful to install local SR Prefix-SIDs configured with the no-PHP option. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib, zebra: rename LSP type used for OSPF SRRenato Westphal2019-09-071-1/+1
| | | | | | | | | | SR support for IS-IS is coming so we need to be able to distinguish OSPF and IS-IS LSPs. While here, add missing case statement for LDP on lsp_type_from_re_type(). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: identify MPLS FTNs by route type and instanceRenato Westphal2019-09-071-1/+2
| | | | | | | | | Use the route type and instance instead of the route distance to identify MPLS FTNs. This is a more robust approach since the routing daemons can modify the distance of their announced routes via configuration, which can cause inconsistencies. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: introduce encode/decode functions for the MPLS zapi messagesRenato Westphal2019-09-071-21/+12
| | | | | | | | | Do this for the following reasons: * Improve modularity of the code by separating the decoding of the ZAPI messages from their processing; * Create an API that is easier to use by the client daemons. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* lib: hashing functions should take const argumentsQuentin Young2019-05-141-1/+1
| | | | | | | | | | It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-1/+1
| | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: Rename backet to bucketTim Bray2019-02-251-16/+16
| | | | | | Presume typo from original author Signed-off-by: Tim Bray <tim@kooky.org>
* Merge branch 'pull/3197'David Lamparter2018-10-231-1/+1
|\ | | | | | | | | | | ...with a nit fix Signed-off-by: David Lamparter <equinox@diac24.net>
| * *: Replace hash_cmp function return value to a boolDonald Sharp2018-10-191-1/+1
| | | | | | | | | | | | | | | | | | The ->hash_cmp and linked list ->cmp functions were sometimes being used interchangeably and this really is not a good thing. So let's modify the hash_cmp function pointer to return a boolean and convert everything to use the new syntax. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | ospfd: fix issue with the "no segment-routing prefix A.B.C.D/M" commandRenato Westphal2018-10-201-0/+3
|/ | | | | | | | | | | | Add a missing check to bail out earlier when SR is not configured. The same command without the "no" prefix has the same check as it prevents unexpected things (i.e. crashes) from happening. Fixes the following segfaults: ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32" ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32 index 65535 no-php-flag" Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: list_delete_and_null() -> list_delete()David Lamparter2018-10-021-3/+3
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: style for EC replacementsQuentin Young2018-09-131-15/+14
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ospfd: OSPF_[ERR|WARN] -> EC_OSPFQuentin Young2018-09-131-18/+18
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Merge remote-tracking branch 'frr/master' into warningsDavid Lamparter2018-09-121-0/+4
|\ | | | | | | | | | | | | | | Conflicts: zebra/if_ioctl_solaris.c zebra/rtread_getmsg.c Signed-off-by: David Lamparter <equinox@diac24.net>
| * *: fix config.h/zebra.h include orderDavid Lamparter2018-09-081-0/+4
| | | | | | | | | | | | | | | | config.h (or, transitively, zebra.h) must be the first include file listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work correctly. Signed-off-by: David Lamparter <equinox@diac24.net>
* | *: style for flog_warn conversionsQuentin Young2018-09-061-2/+2
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ospfd: Convert ospf_sr.c to use error-card subsystem.Donald Sharp2018-09-061-22/+25
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | ospfd: Convert ospf_ext.c to use new error-code subsystemDonald Sharp2018-09-061-1/+1
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | ospfd: Cleanup some warnings that were not warningsDonald Sharp2018-09-061-9/+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>
* bgpd, ospfd, pimd, zebra: Convert more use_json locations to boolDon Slice2018-09-041-1/+1
| | | | Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* Merge pull request #2846 from donaldsharp/backet_dataRuss White2018-08-161-4/+0
|\ | | | | Backet data
| * ospfd: trust backet->dataDonald Sharp2018-08-151-4/+0
| | | | | | | | | | | | The backet->data cannot be NULL, no need to check for it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: rename zlog_fer -> flog_errQuentin Young2018-08-141-13/+13
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ospfd: zlog_ferr facilityChirag Shah2018-08-141-24/+38
|/ | | | | | | Ticket:CM-21333 Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: ALLOC calls cannot failDonald Sharp2018-08-111-12/+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>
* *: 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>