Commit Graph

101 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
cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

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
Donald Sharp
cf00164b69 *: Create and use infrastructure to show debugs in lib
There are lib debugs being set but never show up in
`show debug` commands because there was no way to show
that they were being used.  Add a bit of infrastructure
to allow this and then use it for `debug route-map`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-07 12:39:05 -04:00
Abhinay Ramesh
6fc7e0c3d1 ospf6d: Enable the feature using configure.ac
Problem Statement:
=================
The feature is not enabled, needs to be enabled by doing required
initialization.

RCA:
====
Changes to support the feature is present, but the feature macro
needs to be enabled.

Fix:
====
This commit has changes to enable the code.

Risk:
=====
Medium

Need to ensure all existing ospf6 related topotests pass. to ensure
packet processing is not impacted.

Tests Executed:
===============
Have tested the functionality with enabling openssl and also disabling
openssl.

Signed-off-by: Abhinay Ramesh <rabhinay@vmware.com>
2022-02-09 01:57:08 +00:00
anlan_cs
d6b901ac78 ospf6d: give error information for commands with non-exist vrfs
Currently the ospf6d's commands with non-exist vrfs can't give the error
informations to users.

This commit adds a macro "OSPF6_CMD_CHECK_VRF" to give error information
if with non-exist vrfs. As usual, skip the checking process in the case
of json.

So one command can call this macro to do the checking process in its
end. At that time it need know json style or not, so add "json" parameter for
several related functions.

BTW, suppress the build warning of the macro `OSPF6_FIND_VRF_ARGS`:
"Macros starting with if should be enclosed by a do - while loop to avoid
possible if/else logic defects."

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2022-01-11 04:21:05 -05:00
Donatas Abraitis
c48349e346 *: Remove redundand braces for single statement blocks
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-27 11:20:59 +02:00
Donatas Abraitis
5a6c232bf8 ospf6d: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:50:37 +02:00
Renato Westphal
f4f0098ca0 ospf6d: rework filtering commands to be in line with ospfd
Issue #9535 describes how the export-list/import-list commands work
differently on ospfd and ospf6d.

In short:
* On ospfd, "area A.B.C.D export-list" filters which internal
  routes an ABR exports to other areas. On ospf6d, instead, that
  command filters which inter-area routes an ABR exports to the
  configured area (which is quite counter-intuitive). In other words,
  both commands do the same but in opposite directions.
* On ospfd, "area A.B.C.D import-list" filters which inter-area
  routes an ABR imports into the configured area. On ospf6d, that
  command filters which inter-area routes an interior router accepts.
* On both daemons, "area A.B.C.D filter-list prefix NAME <in|out>"
  works exactly the same as import/export lists, but using prefix-lists
  instead of ACLs.

The inconsistency on how those commands work is undesirable. This
PR proposes to adapt the ospf6d commands to behave like they do
in ospfd.

These changes are obviously backward incompatible and this PR doesn't
propose any mitigation strategy other than warning users about the
changes in the next release notes. Since these ospf6d commands are
undocumented and work in such a peculiar way, it's unlikely many
users will be affected (if any at all).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-20 13:06:35 -03: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
Igor Ryzhov
175c92e67e ospf6d: cleanup useless checks
om6->ospf6 is always initialized at the start of the execution.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-15 19:21:47 +03:00
Donald Sharp
819a0202ae ospf6d: Prevent crash of show ipv6 ospf data adv-router 0.0.0.0 linkstate-id 0.0.0.0
With this sequence of events:
eva# conf
eva(config)# router ospf6
eva(config-ospf6)# end
eva# show ipv6 ospf data adv-router 0.0.0.0 linkstate-id 0.0.0.0
OSPF6: Received signal 11 at 1630442431 (si_addr 0x0, PC 0x559dcfa3a656); aborting...
OSPF6: zlog_signal+0x18c                  7fd2cc8229f7     7fff606775d0 /lib/libfrr.so.0 (mapped at 0x7fd2cc770000)
OSPF6: core_handler+0xe3                  7fd2cc8616ad     7fff606776f0 /lib/libfrr.so.0 (mapped at 0x7fd2cc770000)
OSPF6: funlockfile+0x50                   7fd2cc74f140     7fff60677840 /lib/x86_64-linux-gnu/libpthread.so.0 (mapped at 0x7fd2cc73b000)
OSPF6:     ---- signal ----
OSPF6: ospf6_lsdb_type_show_wrapper+0x5d     559dcfa3a656     7fff60677dd0 /usr/lib/frr/ospf6d (mapped at 0x559dcf9a5000)
OSPF6: show_ipv6_ospf6_database_adv_router_linkstate_id+0x1f9     559dcfa3c24a     7fff60677e50 /usr/lib/frr/ospf6d (mapped at 0x559dcf9a5000)

OSPF6 crashes.  Fix.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-01 08:07:53 -04:00
rgirada
0fc3e11323 ospf6d: GR helper configurations
Description:
	Adding the following cli commands to enable/disable GR helper
	functionality.
	1. [no] graceful-restart helper-only [A.B.C.D]
	2. [no] graceful-restart helper lsa-check-disable
	3. [no] graceful-restart helper planned-only
	4. [no] graceful-restart helper supported-grace-time (10-1800)

	show commands:
	show ipv6 ospf6 graceful-restart helper [detail] [json]

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-08-11 23:06:49 -07:00
Yash Ranjan
f71ed6df3e ospf6d: "clear ipv6 ospf6 process" command
Adding the "clear ipv6 ospf6 command" . It resets
the ospfv3 datastructures and clears the database
as well as route tables. It resets the neighborship
by restarting the interface state machine.
If the user wants to change the router-id, this
command updates the router-id to the latest static
router-id and starts the neighbor formation with
the new router-id.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-06-27 20:56:10 -07: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
Russ White
d2b7ab9445
Merge pull request #8347 from volta-networks/fix_ospv6_filter_debug
ospf6d: Fix when an "export-list" or "filter-list out" is configured
2021-05-07 14:27:01 -04:00
harios_niral
d48ef099db ospf6d: add vty support for multiple vrfs
Co-authored-by: Kaushik Nath <kaushiknath.null@gmail.com>
Signed-off-by: harios_niral <hari@niralnetworks.com>
2021-05-06 10:54:31 +03:00
lynne
f6c5f2e0c3 ospf6d: Fix when an "export-list" or "filter-list out" is applied.
When an "export-filter" or "filter-list out" was configured on an area the
filter was not applied to existing database.    The user would either have
to restart the neighboring router in the other area or issue a "clear ipv6
ospf6 interface" to cause the neighbor router to resend it's LSAs.   The
new filter would then be applied to these LSAs and permit or deny summary
LSAs from being added/removed from the database.  The code now applies the
filters to the existing database without user needing to take any action
to clear ospfv3 adjacencies.

The second part of the problem was if a rule changed the updated filter was
not applied.  The code has been modifed to now process the rule update and
reapply the filter.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
2021-05-04 15:28:56 -04: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
Yash Ranjan
eacd0828d4 ospf6d: Json support added for command "show ipv6 ospf6 route [json]"
Modify code to add JSON format output in show command
"show ipv6 ospf6 route [<intra-area|inter-area|external-1|
external-2|X:X::X:X|X:X::X:X/M|detail|summary>]"
with proper formating

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-01-26 20:06:02 -08: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
Yash Ranjan
de851bf2e3 ospf6d: Structural changes in ospf6d.c
Removes the code redundancy for the show ipv6 ospf6 database
command.

Signed-off-by: Yash Ranjan <ranjany@vmware.com>
2021-01-13 00:06:28 -08:00
Igor Ryzhov
360d6f517f ospf6: don't create instance at startup
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-11-20 01:48:11 +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
Renato Westphal
8b6b6b694d
Merge pull request #7222 from idryzhov/fix-debug
fix debug commands node inconsistencies
2020-10-09 21:58:24 -03:00
Donald Sharp
c527acf1eb ospf6d: Move header includes around to reflect reality
ospf6_network.h needs ospf6_top.h to be included
first.

This makes newer versions of gcc much much happier.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-10-08 20:44:23 -04:00
Kaushik
7df1f3623e ospf6d : Socket change for ospf6d vrf support.
1. The socket() call is changed to vrf_socket().
2. The ospf6 instance creation api added.
3. The global socket fd is replaced with ospf6->fd.
4. All dependency of the global socket is resolved.
5. Added the ospf6 receive timer in the global structure.
6. Performed the thread off on receive timer when we do "no router ospf6".

Co-authored-by: harios <hari@niralnetworks.com>
Signed-off-by: Kaushik <kaushik@niralnetworks.com>
2020-10-06 21:23:54 -07:00
Igor Ryzhov
dd73744d8c *: move "show debugging ..." commands to enable node
Use the same node for "show debugging" commands in all daemons.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-10-02 15:06:05 +03:00
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Chirag Shah
257660b457 ospf6d: add newline to show debugging cmd
Ticket:CM-20738
Testing Done:
Before:
OSPF6 debugging status:debug ospf6 lsa inter-router examine
debug ospf6 lsa as-external examine
debug ospf6 route memory
debug ospf6 border-routers

After:
OSPF6 debugging status:
debug ospf6 lsa inter-router examine
debug ospf6 lsa as-external examine
debug ospf6 route memory
debug ospf6 border-routers

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2018-05-05 15:38:11 -07: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
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
2026b8afac ospf6d: Fix the cli parsing
We were not properly positioning get_argv command.

Fixes: #1182
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-14 16:03:37 -04:00
David Lamparter
427f8e61bb ospf6d: properly update prefix list references
Register add/delete hooks with the prefix list code to properly change
ospf6_area's prefix list in/out pointers.

There are 2 other uncached uses of prefix lists in the ASBR route-map
code and the interface code;  these should probably be cached too. (To
be fixed another day...)

Fixes: #453
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24 00:18:53 +02:00
Donald Sharp
87f6dc504d *: Add 'show debugging' command from vtysh
Allow vtysh to query every daemon about its
debugging status in one go.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-21 07:23:59 -04:00
Donald Sharp
3b4e6bd594 ospf6d: Remove ospf6d version string
This version string has not been updated in over 11 years.
I cannot see any viable reason that we should use or update
or anything with this value, remove.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-19 21:21:00 -04: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
625e016d14 *: remove VTYNL, part 6 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +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
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
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