Commit Graph

109 Commits

Author SHA1 Message Date
Donald Sharp
24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
8c1186d38e *: Convert thread_execute to event_execute
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -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
Donald Sharp
cb37cb336a *: Rename thread.[ch] to event.[ch]
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-03-24 08:32:16 -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
Donatas Abraitis
1ce23106eb *: Drop deprecated incorrect JSON fields with wrong naming
Deprecation cycle already passed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 10:18:28 +02:00
Donald Sharp
4898cbaf1d ospf6d: Stop using MTYPE_TMP in some cases
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-05 12:10:25 -05:00
David Lamparter
89cb86aeb0 build, vtysh: extract vtysh commands from .xref
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-10-26 17:12:34 +01:00
Donald Sharp
7baebfb715
Merge pull request #10447 from ton31337/fix/json_with_whitespaces
*: Fix JSON keys with whitespaces and PascalCase
2022-03-13 18:19:33 -04: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
Donatas Abraitis
77a2f8e592 *: Add camelCase JSON keys in addition to PascalCase
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-03 10:48:06 +02: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
576e842480 ospf6d: add "nssa" option to the "debug ospf6 lsa" command
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-10-05 21:25:55 -03:00
Donatas Abraitis
f2b64253b8 ospf6d: Do not explicitly set the thread pointer to NULL
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-10-04 19:29:06 +03: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
Quentin Young
6ddb368d6b ospf6d: JSON output for database dump show command
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-08-12 16:26:01 -04: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
David Schweizer
d6265808f4
ospf6d: consistent checksum json output
Changed LSA checksum JSON output variable name from "checkSum" to
"checksum" to maintain consistency.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-14 08:21:42 +02:00
David Schweizer
2804f2d241
ospf6d: Link state ID in LSA database JSON output
Added link state ID to JSON output of LSA database.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2021-06-14 08:41:10 +02:00
Renato Westphal
461d106dae lib, ospfd, ospf6d: fix logging of pointer addresses
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-08 11:50:44 -03: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
Yash Ranjan
e161c2dc9e ospf6d: Link LSAs are not getting MAX_AGE in neighbor
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-25 00:25:16 -07:00
David Lamparter
30043e4ce2 ospf6d: kill ospf6_memory.h, use MTYPE_STATIC
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-22 19:31:56 +01: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
lynne
3e67830c5f ospf6d: fix display of unknown LSAs in show ipv6 ospf6 database command
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-02-23 13:04:06 -05: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
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
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
Quentin Young
772270f3b6 *: sprintf -> snprintf
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-20 19:14:33 -04: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
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03: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
Quentin Young
9f5dc3192e *: remove casts of XMALLOC / XCALLOC
No cast necessary for void *

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-25 23:00:46 +00: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
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
David Lamparter
f28762d235 Merge pull request #870 from chiragshah6/mdev
Fix various memory leaks in OSPFd and OSPF6d
2017-08-04 08:46:38 +02:00
Donald Sharp
68bfcc0539 ospf6d: New version of GCC with new warnings
GCC 7.1.1 returned warnings about buffer sizes
not being big enough to handle the full string
that could be generated.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-27 18:19:31 -04:00
Chirag Shah
d107621dbc ospf6d: Fix memory leaks
Free route node upon asbr redistribute route cleanup from
external_id_table route tale.
Free route node when route_remove is called and
node->info is set to null.
Decrement route node lock in route_lookup api as it
is incremented as part of node_lookup api.
use local variable for nexthop vs. malloc in zebra parse
routine.

two of the memory leaks related to nexthops per route were not freed.
two of the memory leak detected per frr service restart

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-07-27 09:49:42 -07: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
55f70b671f *: remove VTYNL, part 4 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
26a429fe8e *: remove VTYNL, part 2 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
6b18e3b2e0 ospf6d: VNL -> VTYNL
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00