Commit Graph

97 Commits

Author SHA1 Message Date
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
Quentin Young
7e045c3d42 *: use ->text and strmatch where appropriate
Still need to go fix all the places where we do a 1-char strncmp...

spatch follows
------------------

@asdf@
expression idx;
@@
<...
 strcmp (
- argv[idx]->arg,
+ argv[idx]->text,
  ...)
...>

@depends on asdf@
expression idx;
@@
<...
- !strcmp (argv[idx]->text,
+ strmatch (argv[idx]->text,
           ...)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) == 0
+ strmatch (argv[idx]->text, arg)
...>

@depends on asdf@
expression idx;
expression arg;
@@
<...
- strcmp (argv[idx]->text, arg) != 0
+ !strmatch (argv[idx]->text, arg)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 17:46:42 +00:00
Donald Sharp
a6e895a9df Merge remote-tracking branch 'origin/stable/2.0' 2017-05-17 08:32:53 -04:00
Donald Sharp
5b0747d71d ospf6d: Allow unconfig of unknown lsa's
When we are receiving the 'no debug ospf6 lsa unknown ...'
Allow the removal of the originate examine and flooding
keywords.

Ticket: CM-12805
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 15:24:30 -04:00
Donald Sharp
2dbfa8a020 ospf6d: Fix debug line always showing up in ospf6d
The command 'debug ospf6 lsa unknown' was
always showing up, upon starting of the ospf6 daemon.

Remove this from happening.  Also fix some help strings
while we are in there.

Ticket: CM-7913
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-16 15:22:21 -04: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
Quentin Young
d9090d56c0 ospf6d, zebra: remove unnecessary asserts
These pointers are now guaranteed to be null, so asserting the opposite
will crash.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:23 +00:00
Quentin Young
66e78ae64b *: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See
previous commit message.

To ensure that the behavior stays functionally correct, any assignments
with the result of a thread_add* function have been transformed to set
the pointer to null before passing it. These can be removed wherever the
pointer is known to already be null.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:22 +00:00
Quentin Young
ffa2c8986d *: remove THREAD_ON macros, add nullity check
The way thread.c is written, a caller who wishes to be able to cancel a
thread or avoid scheduling it twice must keep a reference to the thread.
Typically this is done with a long lived pointer whose value is checked
for null in order to know if the thread is currently scheduled.  The
check-and-schedule idiom is so common that several wrapper macros in
thread.h existed solely to provide it.

This patch removes those macros and adds a new parameter to all
thread_add_* functions which is a pointer to the struct thread * to
store the result of a scheduling call. If the value passed is non-null,
the thread will only be scheduled if the value is null. This helps with
consistency.

A Coccinelle spatch has been used to transform code of the form:

  if (t == NULL)
    t = thread_add_* (...)

to the form

  thread_add_* (..., &t)

The THREAD_ON macros have also been transformed to the underlying
thread.c calls.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-09 20:44:19 +00:00
David Lamparter
cf672a8654 *: use monotime()
This is largely a bulk-replace made with coccinelle.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
David Lamparter
afe4c21720 *: remove quagga_gettime() return value checks
The next patch will bulk-replace these, and monotime() has time_t as
return value, not an error indicator.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-23 18:26:32 +01:00
Quentin Young
3a2d747c2e all: Fix all underfull doc strings
Additionally:
* Add [ip] to a couple bgp show commands
* Quick refactor of a couple ISIS commands
* Quick refactor of a couple OSPF6 commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-29 23:07:11 +00:00
Quentin Young
16cedbb01f all: Fix underfull doc strings, part 1
Add missing docstrings and separating \n.
Also eat some low-hanging refactoring fruit.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-11-04 23:03:03 +00:00