Commit Graph

105 Commits

Author SHA1 Message Date
Philippe Guibert
f13d33ccd0 ospf6d: avoid writing dumb ospf6 info at startup
in show: 'show ipv6 ospf6' handler command, the reason of SPF
executation is looked up and displayed. At startup, SPF has been
started, but shows no specific reason. Instead of dumping non
initialised string context, reset the string context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-11-03 11:48:55 +01:00
Russ White
b8beb67ef5
Merge pull request #9585 from opensourcerouting/ospf6d-nssa-dflt-originate
ospf6d: add a knob to generate Type-7 default routes
2021-09-24 13:42:49 -04:00
Renato Westphal
6735622c24 ospf6d: implement Type-7 default routes for NSSA areas
Add the "default-information-originate" option to the "area X nssa"
command. That option allows the origination of Type-7 default routes
on NSSA ABRs and ASBRs.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 17:47:13 -03:00
Donald Sharp
d0606e0a85 ospf6d: Use appropriate integer size and more context for reason strings
The ospfv3 spf reason strings are just presented internally in the code
without any real context.  Give a tiny bit more useful information for
the developer and convert the integer to a uint32_t

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-21 07:53:30 -04:00
Renato Westphal
7116509803 ospf6d: introduce support for Graceful Restart (restarting mode)
RFC 5187 specifies the Graceful Restart enhancement to the OSPFv3
routing protocol. This commit implements support for the GR
restarting mode.

Here's a quick summary of how the GR restarting mode works:
* GR can be enabled on a per-instance basis using the `graceful-restart
  [grace-period (1-1800)]` command;
* To perform a graceful shutdown, the `graceful-restart prepare ipv6
  ospf` EXEC-level command needs to be issued before restarting the
  ospf6d daemon (there's no specific requirement on how the daemon
  should be restarted);
* `graceful-restart prepare ospf` will initiate the graceful restart
  for all GR-enabled instances by taking the following actions:
  o Flooding Grace-LSAs over all interfaces
  o Freezing the OSPF routes in the RIB
  o Saving the end of the grace period in non-volatile memory (a JSON
    file stored in `$frr_statedir`)
* Once ospf6d is started again, it will follow the procedures
  described in RFC 3623 until it detects it's time to exit the graceful
  restart (either successfully or unsuccessfully).

Testing done:
* New topotest featuring a multi-area OSPF topology (including stub
  and NSSA areas);
* Successful interop tests against IOS-XR routers acting as helpers.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:48 -03:00
Renato Westphal
1a898463a3 ospf6d: add missing entry to array of strings
Commit b8212e0310 introduced OSPF6_SPF_FLAGS_ASBR_STATUS_CHANGE but
didn't update the 'ospf6_spf_reason_str' array accordingly. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-16 12:26:05 -03:00
Renato Westphal
6df89791ba ospf6d: remove incorrect debug guard
Also, update the ospf6_topo2 topotest since the expected output
was wrong. With this fix, NSSA routes will be created on r2
("redistribute connected"), and NSSA routes appear in the routing
table as regular external routes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-08-24 00:39:56 -03:00
Mobashshera Rasool
22813fdb86 ospf6d: Store ospf6 back pointer in route struct
Storing the pointer to ospf6 struct in route struct.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-21 05:20:30 +00:00
Christian Hopps
ff2052eefc ospf6d: fix backlink check
This code has been wrong ~ever (according to git history). There are 3
conditional blocks with the added assertion that both the LSA and the
vertex being checked can't both be network LSAs.

The third block is clearly assuming both LSA and vertex are router
LSAs b/c it is accessing the backlink and lsdesc as router lsdesc's also
making sure both are p2p links (which they would have to be to point at
each other).

The programming error here is that (A && B) == False does NOT imply !A,
but the code is written that way.

So we end up in the third block one of LSA or vertex being network LSAs
rather easily (whenever that is the case and the desc isn't the backlink
being sought).

This was caught by ASAN b/c the lsdesc and backlinks are being accessed
(> 4 byte field offsets) as if they were router lsdesc's in the third
block, when in fact one of them is a network lsdesc which is only 4
bytes long -- so ASAN flags the access beyond bounds.

Signed-off-by: Christian Hopps <chopps@labn.net>
2021-07-09 04:15:34 -04:00
lynne
1b1f7b4f15 ospf6d: move error logs out from behind debug flags
The logging in ospf6 is very verbose.  If you turn on logging on a scaled
system you get too many logs.   The problem is that there are some errors
that occur that are hidden behind the debug flags, and to see these errors
we currently need to turn on the debug logging.  This change converts these
error logs to warnings and removes the debug flags.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-06-14 15:46:49 -04:00
Donald Sharp
95b3f03d89 ospf6d: Rename ospf6_is_router_abr to more accurately reflect what it does
The ospf6_is_router_abr is checking to see if ospfv3 is an abr router
and also setting values.  Let's rename it too `ospf6_check_and_set_router_abr`
to more accurately reflect what it is doing.

Additionally fix coverity #1505176 where we were not checking the return
value of ospf6_is_router_abr like we did every other time.  In this
case we don't care about the return value so indicate that we do not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-10 07:59:06 -04:00
Kaushik
35769de430 ospf6d: support for nssa in ospfv3
Fix for the routes which is not classified as best routes.

Signed-off-by: Kaushik <kaushiknath.null@gmail.com>
2021-06-04 07:23:10 -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
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
David Lamparter
960b9a5383 *: require semicolon after DEFINE_<typesafe...>
Again, see previous commits.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
Yash Ranjan
305b639bca ospf6d: Json support added for command "show ipv6 ospf6 spf tree [json]"
Modify code to add JSON format output in show command
"show ipv6 ospf6 spf tree" with proper formating

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-03-02 02:14:57 -08:00
Donald Sharp
1bc19a9e1a ospf6d: turn some info->debug
The log is being spammed every spf interval:

Feb 27 16:19:34  ospf6d[462371]: SPF processing: # Areas: 1, SPF runtime: 0 sec 2043 usec, Reason: R+, R-, N+
Feb 27 16:20:59  ospf6d[462371]: SPF: Scheduled in 0 msec
Feb 27 16:20:59  ospf6d[462371]: SPF processing: # Areas: 1, SPF runtime: 0 sec 2284 usec, Reason: R+, R-
Feb 27 16:21:01  ospf6d[462371]: SPF: Scheduled in 0 msec
Feb 27 16:21:01  ospf6d[462371]: SPF processing: # Areas: 1, SPF runtime: 0 sec 2153 usec, Reason: R+, R-, N-

There is no reason to do this

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-27 10:42:07 -05:00
David Lamparter
1d5453d607 *: remove tabs & newlines from log messages
Neither tabs nor newlines are acceptable in syslog messages.  They also
break line-based parsing of file logs.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-14 15:36:51 +01:00
Mobashshera Rasool
1958143e30 ospf6d: add CLI to control maximum paths for routes.
CLI added:
maximum-paths (1-64)

Issue: #7961

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-02-01 09:05:52 +00:00
Igor Ryzhov
e285b70d3c ospf6: get instance from route table scope
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-11-30 17:36:10 +03: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
2e37407f9d ospf6d, tests: Prevent use after free
The code pattern:

for (ALL_LSDB(lsdb, lsa)) {
	remove_lsa(lsa)
}

has a use after free in ALL_LSDB, since we ask for the next pointer,
after it has been freed.

Modify the code such that we grab the next pointer before we can
possibly free it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-10-11 11:16:44 -04:00
Kaushik
c5d28568c6 ospf6d : Preparing for ospf6d VRF support.
1. Removed the VRF_DEFAULT dependency from ospf6d.
2. The dependency on show command still exist
   will be fixed when the ospf6 master is available.

Co-authored-by: Harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-09-01 03:02:46 -07:00
David Lamparter
3efd0893d0 *: un-split strings across lines
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>
2020-07-14 10:37:25 +02: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
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
David Lamparter
2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
David Lamparter
4ab0496e38 ospf6d: replace pqueue_* with DECLARE_SKIPLIST
As the previous commit, this replaces ospf6d's pqueue_* usage in SPF
calculations with a DECLARE_SKIPLIST_* skiplist.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-04-27 19:33:45 +02:00
Quentin Young
9165c5f5ff *: remove trailing newlines from zlog messages
Zlog puts its own newlines on, and doing this makes logs look nasty.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-03-14 18:41:15 +00: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
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +00:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
4ba03be5d3 ospf6d: Update OSPFv3 to use new zlog_ferr
Update OSPFv3 to use the new zlog_ferr messages

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
0ce1ca805d *: ALLOC calls cannot fail
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>
2018-08-11 17:14:58 +02:00
paco
cac84a1611
bgpd ospf6d: null check (Coverity 1221453 1461297) 2018-06-20 18:57:16 +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
Donald Sharp
cf29dab3b5 ospf6d: Fix a possible deref by null found in SA
There exists a possibility that rtr_lsa may be null.
Add an assert that shows we actually expect it to
be non-null at this point in time going forward.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-13 23:34:52 -05: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
Chirag Shah
064d4355ca ospf6d: Fix External routes ECMP
Handle RFC 2328 16.4 Calculating AS external routes with ECMP

For ASBR route, if it is learnt via new LSA and contains
different nexthop list. First lookup route in ospf6 route table
if it exists, merge nexthop list to existing and call the callback
to install into FIB (zebra). Delete created new route as it is
identical to existing entry in route table.

Ticket:CM-16139
Testing Done:
Run two ASBR with 2 ECMP paths from each
DUT neighbor receievs 4 ECMP path to a external route.
ospf6 installs all 4 ECMP path to FIB/RIB

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-01-02 10:00:38 -08:00
Chirag Shah
26e1461672 ospf6d: SPF consider all Router LSAs
Based on RFC-5340, there could be multiple Router LSAs
associated with Same Advertising Router. During SPF calculation
ensure first Root Vertex accommodates all Link state IDs for its
originated Router LSAs push them into priority queue.
Similarly follow for other Vertexes, considering Router LSAs
with multiple Link State IDs.

Ticket: CM-18069
Testing Done:
Topology: R1 === R2 -- R3

Validated with more than 100 Subinterfaces
between R1 === R2 with broadcast links,
Validated show ipv6 ospf6 spf tree containing all graph nodes.
Validated ip -6 route at R3 and all intra prefix LSAs route
installed with ospf6 as protocol.

2) Run R1 === R2 with Point-to-Point links.

3) Perform few other abr and ospf6 test cases of LSA ageout,
route install and delete cases.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-11-17 10:01:04 -08:00
Chirag Shah
1ba43456a4 ospf6d: Handle lsupdate upto max ospf6 payload
While traversing LSUpdate list, if LSUpdate message
fills up (w/ LSAs) to the interface MTU size,
Send the existing filled LSUpdate message if max
payload exceeds max ospf6 payload,
reset sendbuf (buffer) to fill rest of
the remaining LSAs.

Add relevant fields to debugs.

Ticket:CM-18069

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2017-10-16 22:37:02 -07:00
Donald Sharp
affe9e9983 *: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **.  This is to allow the list pointer to be nulled.

I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.

Let's make the api explicit in it setting the list pointer
to null.

Cynical Prediction:  This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-05 10:53:13 -04:00
Donald Sharp
ab0f1135b5 ospf6d: Note when we calculated spf
Fixes: #1181
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-14 16:03:26 -04:00