summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_lsa.c
AgeCommit message (Collapse)Author
2024-09-16ospf6d: add nth_prefix()Andrew Cooks
Add utility function to find the Nth prefix in a link LSA or Intra Prefix LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: add nth_lsdesc()Andrew Cooks
Add utility function to find the Nth router lsdesc or network lsdesc in an LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: replace TLV_HDR_TOP macro with lsdesc_start functionAndrew Cooks
The original TLV_HDR_TOP implementation only worked for Graceful Restart LSAs, because they had no "LSA body". This change introduces a body size lookup table and changes the macro to a function that accounts for the LSA body for all LSA types, and provides type checking on the provided pointer before arithmetic. It also removes the open type casting and pointer arithmetic. The introduced lsdesc_start() is used to find the start of a descriptor, and will be used for TLVs in E-LSAs as well as old LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16ospf6d: replace ospf6_lsa_header_end()Andrew Cooks
The void * return type of the replacement enables the removal of a cast at every point of use, and the name no longer suggests that it points to the last byte of the header. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_SIZE with ospf6_lsa_sizeAndrew Cooks
Dropping the macro enables better compiler type checking. The macro was not used consistently when reading the lsa size from the header, so this change also aims to use the replacement inline function consistently. Keeping the inline function has (marginal) utility in that it ensures that the endian conversion is consistently performed. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_END with ospf6_lsa_endAndrew Cooks
Replacing the macro with an inline function enables better type checking. No functional change. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-05-28ospf6d: replace OSPF6_LSA_HEADER_END macroAndrew Cooks
Replacing the macro with an inline function allows the compiler to check the parameter type. Use the replacement function consistently to reduce the number of open coded pointer cast plus offset calculations. use tools/indent.py to reformat all occurences of its use. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2023-07-25* : include event ptr in event_execute apiMark Stapp
Include an event ptr-to-ptr in the event_execute() api call, like the various schedule api calls. This allows the execute() api to cancel an existing scheduled task if that task is being executed inline. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-07-12ospf6d: Convert ospf6_lsa_unlock to a better apiDonald Sharp
Make the ospf6_lsa_unlock take the same parameters that the ospf_lsa_unlock does to make it consistent and to also ensure that no-one can make the mistake of getting the pointer cleared up. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_execute to event_executeDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
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>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
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>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31*: Drop deprecated incorrect JSON fields with wrong namingDonatas Abraitis
Deprecation cycle already passed. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-05ospf6d: Stop using MTYPE_TMP in some casesDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-13Merge pull request #10447 from ton31337/fix/json_with_whitespacesDonald Sharp
*: Fix JSON keys with whitespaces and PascalCase
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
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>
2022-02-03*: Add camelCase JSON keys in addition to PascalCaseDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-16ospfd6d: replace handler vector with arrayDavid Lamparter
No point in using the vector code for this really. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-05ospf6d: add "nssa" option to the "debug ospf6 lsa" commandRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-04ospf6d: Do not explicitly set the thread pointer to NULLDonatas Abraitis
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>
2021-08-25ospf6d: Add debug commands for lsa all and route allYash Ranjan
Debug commad for all lsa types and route types are not present. Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-08-12ospf6d: JSON output for database dump show commandQuentin Young
Added missing output to "show ipv6 ospf6 databse dump json" VTY shell command. Co-authored-by: David Schweizer dschweizer@opensourcerouting.org Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-07-21ospf6d: ASBR Summarisation feature implementationMobashshera Rasool
Feature Implementation. ======================== This feature will help in advertising the External LSAs with aggregation. The commands allow us to tune the advertisement with different parameters as mentioned in the CLI List below. It can also help in case we do not want to advertise any prefix with the no-advertise option. New CLIs added: =============== summary-address X:X::X:X/M$prefix [tag (1-4294967295)] [{metric (0-16777215) | metric-type (1-2)}] no summary-address X:X::X:X/M$prefix [tag (1-4294967295)] [{metric (0-16777215) | metric-type (1-2)}] summary-address X:X::X:X/M$prefix no-advertise no summary-address X:X::X:X/M$prefix no-advertise aggregation timer (5-1800) no aggregation timer (5-1800) show ipv6 ospf6 summary-address [detail$detail] [json] debug ospf6 lsa aggregation CAT RUN: ======== QE to add test scripts Signed-Off-by: Mobashshera Rasool <mrassol@vmware.com>
2021-06-14ospf6d: consistent checksum json outputDavid Schweizer
Changed LSA checksum JSON output variable name from "checkSum" to "checksum" to maintain consistency. Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-14ospf6d: Link state ID in LSA database JSON outputDavid Schweizer
Added link state ID to JSON output of LSA database. Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-08lib, ospfd, ospf6d: fix logging of pointer addressesRenato Westphal
The %p printf format specifier does already print the pointer address with a leading "0x" prefix (indicating a hexadecimal number). There's no need to add that prefix manually. While here, replace explicit function names in log messages by __func__. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-06-04ospf6d: Support for nssa in ospfv3Kaushik
The following is implemented. 1. Configuring area as NSSA. 2. Generating Type 7 LSA. 3. Conversion of Type 7 to Type 5 ( Default Behavior). 4. NSSA ABR selection. Reviewed-by: Rafael Zalamena <rzalamena@opensourcerouting.org> Co-authored-by: Kaushik <kaushiknath.null@gmail.com> Co-authored-by: Soman K.S <somanks@gmail.com> Signed-off-by: Kaushik <kaushiknath.null@gmail.com>
2021-03-29ospf6d: Add logic to set metric if route-map not presentYash Ranjan
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-03-25ospf6d: Link LSAs are not getting MAX_AGE in neighborYash Ranjan
When the ospf6 daemon goes down, it originates MAX_AGE LSAs for all the self-originated LSAs so that it gets flushed from the neighbor's database. But the link-LSAs are not getting MAX_AGE. Set the self-originated link-LSAs age to MAX_AGE and flood it Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-03-22ospf6d: kill ospf6_memory.h, use MTYPE_STATICDavid Lamparter
Same as other commits -- 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>
2021-03-22ospf6d: split off ospf6_lsa_alloc()David Lamparter
... so we can make the MTYPEs static to ospf6_lsa.c Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-23ospf6d: fix display of unknown LSAs in show ipv6 ospf6 database commandlynne
When an unknown LSA is in the database and the user issues the "show ipv6 ospf6 database" command there is a crash. The code currently doesn't properly handle display of unknown LSAs. Signed-off-by: Lynne Morrison <lynne@voltaio.net>
2021-01-13ospf6d: Json support added for command "show ipv6 ospf6 database [json]"Yash Ranjan
Modify code to add JSON format output in show command "show ipv6 ospf6 database" with proper formating Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2020-10-30ospf6d : Transformation changes for ospf6 vrf support.harios_niral
1. All the changes are related to handle ospf6 with different vrf. 2. The dependancy of global ospf6 is removed. Co-authored-by: Kaushik <kaushik@niralnetworks.com> Signed-off-by: harios_niral <hari@niralnetworks.com>
2020-10-11ospf6d: Make ospf6_lsa_lock follow normal FRR patternDonald Sharp
The normal ospf6_lsa_lock call should return the pointer to the lock data structure we are holding. This is the normal pattern for locking a data structure in FRR. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-20*: sprintf -> snprintfQuentin Young
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>
2020-04-18ospf6d: Prevent use after freeDonald Sharp
ospf6_lsa_unlock may free the lsa data structure as such we cannot use the passed in data structure after freeing it. Provide a mechanism to know if the data has been freed using the same usage patterns of other _unlock functions in FRR. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-08*: Do not cast to the same typeDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-01ospf6d: Recent changes in our build cause const to be respectedDonald Sharp
We are seeing this crash: New LWP 7673] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/lib/frr/ospf6d -d -F datacenter -M snmp -A ::1'. Program terminated with signal SIGABRT, Aborted. (gdb) bt vtysh=vtysh@entry=0) at lib/command.c:1288 (gdb) The command entered is `debug ospf6 lsa inter-router examin`. Code inspection leads us to the fact that FRR is declaring the data as const but we are attempting to modify it, causing the crash. Remvoe the const of this set/get and let things work. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-25*: remove casts of XMALLOC / XCALLOCQuentin Young
No cast necessary for void * Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-09ospf6d: remove extra struct in ospf6_lsa_handlerDavid Lamparter
This serves no other purpose than to generate stupid warnings for overwritten initializers on old gcc versions. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
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>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-02-14ospf6d: Handle Premature Aging of LSAsChirag Shah
RFC 2328 (14.1) Premature aging of LSAs from routing domain : When ospf6d is going away (router going down), send MAXAGEd self originated LSAs to all neighbors in routing domain to trigger Premature aging to remove from resepective LSDBs. Neighbor Router Reboot: Upon receiving Self-originate MAXAGEd LSA, simply discard, Current copy could be non maxaged latest. For neighbor advertised LSA's (current copy in LSDB) is set to MAXAGE but received new LSA with Non-MAXAGE (with current age), discard the current MAXAGE LSA, Send latest copy of LSA to neighbors and update the LSDB with new LSA. When a neighbor transition to FULL, trigger AS-External LSAs update from external LSDB to new neighbor. Testing: R1 ---- DUT --- R5 | \ R2 R3 | R4 Area 1: R5 and DUT Area 0: DUT, R1, R2, R3 Area 2: R2 R4 Add IPv6 static routes at R5 Redistribute kernel routes at R5, Validate routes at R4, redistributed via backbone to area 2. Stop n start frr.service at R5 and validated MAXAGE LSAs then recent age LSAs in Database at DUT-R4. Validated external routes installed DUT to R4. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-22ospf6d: spf calculation w/ multiple router lsasChirag Shah
An OSPFv3 enabled Router can originate or receive multiple Link State-IDs for Router LSAs. As per RFC 5340 A 4.3, more than one Router LSAs, from given Vertex is considered (as concatenated) single large Router LSA. Created hidden show command to simulate concatenated large LSA from advertising/self Router LSAs. Ticket:CM-19329 Reviewed By: Testing Done: Simulate 160 subinterfaces between R1 === R2--R3, This triggers R1 and R2 to generate multiple link state IDs for Router LSAs. During SPF calculation only aggregated single router LSA processed and SPF tree formed. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>