Commit graph

66 commits

Author SHA1 Message Date
Andrew Cooks b2526ddc3f ospf6d: apply CI style suggestions
Apply formatting changes suggested by CI frrbot.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:17 +10:00
Andrew Cooks 554350abe0 ospf6d: add nth_prefix()
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-16 18:38:17 +10:00
Andrew Cooks cd6d36fd82 ospf6d: add nth_lsdesc()
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-16 18:38:16 +10:00
Andrew Cooks d0366de57c ospf6d: replace TLV_HDR_TOP macro with lsdesc_start function
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-16 18:38:16 +10:00
Andrew Cooks 1bb4955371 ospf6d: use lsa_after_header pointer arithmetic
Replaces open type casting and pointer arithmetic for readability.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks 1b64893e23 ospf6d: replace ospf6_lsa_header_end()
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-09-16 18:38:16 +10:00
Andrew Cooks 89e18bfad1 ospf6d: move lsa structs to ospf6_lsa.h
It will be cleaner to have the LSAs in a single header and the future
TLVs in a single header.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks 0dd99a6733 ospf6d: replace OSPF6_LSA_SIZE with ospf6_lsa_size
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-28 14:07:14 +10:00
Andrew Cooks 954f2ac581 ospf6d: replace OSPF6_LSA_END with ospf6_lsa_end
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-28 14:06:25 +10:00
Andrew Cooks 4d06e27569 ospf6d: replace OSPF6_LSA_HEADER_END macro
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>
2024-05-28 14:05:56 +10:00
Donald Sharp 0cbd5855a9 ospf6d: Convert ospf6_lsa_unlock to a better api
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-07-12 17:56:29 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
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 08:32:17 -04:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
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-23 19:56:04 -05:00
David Lamparter 067967b8c7 ospfd6d: replace handler vector with array
No point in using the vector code for this really.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16 13:34:46 +01:00
Renato Westphal d2487a6633 ospf6d: remove unnecessary code
Every received or originated LSA is automatically scheduled to be
refreshed periodically, there's no need to do that manually here.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-05 21:21:43 -03:00
Mark Stapp 5fbbd15d1e
Merge pull request #9438 from ranjanyash54/debug_comm
ospf6d: Add debug commands for lsa all and route all
2021-09-14 11:38:21 -04:00
Donald Sharp 7932dd9331 ospf6d: Cleanup headers to our standard
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-09 16:42:52 -04:00
Yash Ranjan d5cb350834 ospf6d: Add debug commands for lsa all and route all
Debug commad for all lsa types and route types are not present.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-08-25 04:54:11 -07:00
rgirada 91c169f7d7 ospf6d: Datastructure modification for GR helper functionality.
Description:
	Adding GR helper specific datastructures.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-10 02:57:23 -07:00
Mobashshera Rasool c3a70f6517 ospf6d: ASBR summarisation feature changes for NSSA area
1. ASBR summarisation for Type-7 LSAs are done here.

2. Fixed Code warnings

Signed-off-by: Mobashshera Rasool<mrasool@vmware.com>
2021-07-21 05:16:54 +00:00
Mobashshera Rasool 4dc4388691 ospf6d: ASBR Summarisation feature implementation
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-07-21 05:16:54 +00:00
Kaushik ad500b22b5 ospf6d: Support for nssa in ospfv3
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-06-04 07:23:10 -03:00
Yash Ranjan c4122b55a6 ospf6d: Add logic to set metric if route-map not present
Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-03-29 06:37:10 -07:00
David Lamparter 771e1fbee0 ospf6d: split off ospf6_lsa_alloc()
... so we can make the MTYPEs static to ospf6_lsa.c

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-22 19:26:02 +01:00
Yash Ranjan e4bacbaac4 ospf6d: Json support added for command "show ipv6 ospf6 database [json]"
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>
2021-01-13 00:06:28 -08:00
Rafael Zalamena 7c62dc76d4
Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6
ospf6d : Transformation changes for ospf6 vrf support.
2020-11-03 11:59:38 -03:00
harios_niral beadc736bb ospf6d : Transformation changes for ospf6 vrf support.
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-30 23:50:08 -07:00
Donatas Abraitis 2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Donald Sharp 62270cc3ee ospf6d: Make ospf6_lsa_lock follow normal FRR pattern
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-10-11 11:14:45 -04:00
David Lamparter 858f9c0822 ospf6d: use in_addr_t for area/router IDs
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 11:16:01 +02:00
Donald Sharp 744ba56969 ospf6d: Prevent use after free
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-18 08:35:06 -04:00
Donald Sharp 4062abfae5 ospf6d: Recent changes in our build cause const to be respected
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>
2020-04-01 06:37:34 -04:00
David Lamparter 01db90cd83 ospf6d: remove extra struct in ospf6_lsa_handler
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-09-09 01:16:25 +02:00
Quentin Young d7c0a89a3a
*: use C99 standard fixed-width integer types
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-27 15:13:34 -04:00
Lou Berger 996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Chirag Shah 76249532fa ospf6d: Handle Premature Aging of LSAs
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-02-14 17:37:34 -08:00
Chirag Shah da086a3ba6 ospf6d: spf calculation w/ multiple router lsas
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>
2018-01-22 17:33:56 -08:00
Donald Sharp 0ab500803f ospf6d: Fix snmp compile breakage
The recent clang fixes for Static Analysis were run without
compiling `--enable-snmp` these changes broke the snmp build.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-09 08:54:30 -04:00
Vincent JARDIN 3981b5c7f3 ospf6d: fix clang warning, NULL() calls
Avoid show() methods from being a NULL function when it is called.
Meanwhile, I did const'ify the handlers so only its debug field can be changed.

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
2017-10-08 23:06:57 +02:00
whitespace / reindent d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
David Lamparter 896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Donald Sharp 4690c7d74c Quagga: prefix2str fixup
During CR for nexthop upstream it was noticed that usage
of prefix2str was not consistent.  This fixes this problem

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-23 13:31:11 -08:00
Daniel Walton 4dfd8affa2 Add "no debug ospf" and "no debug ospf6" commands to disable all ospf debugging
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-4010
2015-11-03 10:37:25 -08:00
Donald Sharp ca1f4309e6 ospf6d: ospfv3-stub-area-support.patch
Support stubby and totally stubby areas in OSPFv3

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
2015-05-19 18:03:40 -07:00
David Lamparter 6b0655a251 *: nuke ^L (page feed)
Quagga sources have inherited a slew of Page Feed (^L, \xC) characters
from ancient history.  Among other things, these break patchwork's
XML-RPC API because \xC is not a valid character in XML documents.

Nuke them from high orbit.

Patches can be adapted simply by:
	sed -e 's%^L%%' -i filename.patch
(you can type page feeds in some environments with Ctrl-V Ctrl-L)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-04 06:58:02 +02:00
Dinesh Dutt e68a67672c ospf6d: add LSA payload to show summary output
Unlike OSPFv2, the LSID of an LSA isn't sufficient to know what the contents
of the LSA are. Its useful for debugging and basic eyeball tests to see the
contents of the LSA in the simple tabular format of "show ipv6 ospf6 database".
This patch adds that output to the command. It replaces the existing fields of
"duration, Chksum and Length" with a single field called Payload which is
dependent on the LSA type. For Inter-Area Prefix, Intra-Area Prefix and
AS-External LSAs, this will be the advertised prefix/prefix length, for Router
LSAs, it is RtrID/IfID etc.

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com>
[DL: rebase fix, line disappeared in ospf6_abr_originate_summary_to_area]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-11-07 18:15:43 -08:00
Dinesh Dutt 3b220289a4 ospf6d: handle seqnum wrapping
Signed-off-by: Shrijeet Mukherjee <shm at cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
[DL: mechanical adjust to rebase]
[DL: adjust to removal of timerwheel code]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-11-07 18:15:43 -08:00
Dinesh Dutt a765eb9383 ospf6d: convert LSDB to use route_node, improve performance
the performance in the presence of a large number of LSAs. I also verified
that the performance improvements stayed in the presence of a large number
of peers (I tested upto 128).

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com>Summary:
Reviewed-by: James Li <jli at cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-11-07 18:15:42 -08:00
Dinesh Dutt 8551e6dadc ospf6d/ospfd: refactor some common defines
Rearranging common defs and structures for use betweeen OSPFv2 and
OSPFv3.  Created a new file called libospf.h under lib directory to
hold defines that are common between OSPFv2 and OSPFv3 code bases.

[DL: split of defines refactor from timer refactor]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-10-22 18:01:31 -07:00