Commit Graph

131 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
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
Donald Sharp
b2a4c02cc9 ospfd: Remove unused function
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-23 16:47:47 -05: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
405e1c848f Revert "ospfd: rSPF calc and messaging for optimal route reflection"
This reverts commit a3d3a14c09.
2023-01-17 18:11:56 +02:00
Donatas Abraitis
1ea57af264 Revert "bgpd, ospfd: BGP ORR CI warning fixes"
This reverts commit d6b2761134.
2023-01-17 18:10:04 +02:00
Donatas Abraitis
3228977f58 Revert "ospfd: few fixes in rSPF calc when LSA received from non root node"
This reverts commit 9f2984d97c.
2023-01-17 18:09:55 +02: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
Madhuri Kuruganti
9f2984d97c ospfd: few fixes in rSPF calc when LSA received from non root node
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Madhuri Kuruganti
d6b2761134 bgpd, ospfd: BGP ORR CI warning fixes
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Madhuri Kuruganti
a3d3a14c09 ospfd: rSPF calc and messaging for optimal route reflection
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-10-12 13:43:55 +05:30
Donatas Abraitis
69c736ec06
Merge pull request #12074 from donaldsharp/lib_debugs
*: Create and use infrastructure to show debugs in lib
2022-10-12 10:38:21 +03: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
Madhuri Kuruganti
77ea5710b3 ospfd: fix for few debug commands lost in config after debug ospf packet is enabled
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-09-20 00:51:52 +05:30
Madhuri Kuruganti
132f7b21b0 ospfd: fix for debug ospf <inst> packet fails with instance not running
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-09-20 00:27:00 +05:30
Madhuri Kuruganti
cc75c9dc59 ospfd: fix for some of ospf debug commands config lost after reboot
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-09-19 20:40:03 +05:30
Donald Sharp
442321664b bgpd, ospfd: Remove extra newline for show debugging
This extra newline was adding a weird output to `show debugging`
display where there would be extra newlines sometims and not
others.  Make it consistent.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-15 10:34:30 -04:00
Christian Hopps
a6c39c3d1a ospfd: cli: add client api debug option
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-01 18:11:31 -04:00
Donald Sharp
0939509df9 ospfd: Convert output to host order from network order for route_tag
FRR stores the route_tag in network byte order.  Bug filed indicates
that the `show ip ospf route` command shows the correct value.
Every place route_tag is dumped in ospf_vty.c the ntohl function
is used first.

Fixes: #10450
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-31 12:51:18 -05:00
Igor Ryzhov
587cf8f170
Merge pull request #9683 from volta-networks/sr-minor-fixes
ospfd, isisd: minor SR fixes
2021-11-20 14:53:09 +03:00
rgirada
059fd3a48a ospfd: Adding apropriate ism state in ptop neighbors.
Description:
	In PointToPoint networks, There wont be DR and BDR.
	But by default, All neighbours ism state is shown as
	DR_OTHER.

	Changed the nbr state format to <nbrsate>/- (ex : FULL/-)
	to P2pnetworks.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2021-10-26 05:36:20 -07:00
Donald Sharp
3766c36a20 ospfd: Add converged and role json output for neighbor command
The `show ip ospf neighbor json` command was displaying
state:`Full\/DR`

Where state was both the role and whether or not the neigbhor
was converged.  While from a OSPF perspective this is the state.
This state is a combination of two things.

This creates a problem in testing because we have no guarantee
that a particular ospf router will actually have a particular role
given how loaded our topotest systems are.  So add a bit of json
output to display both the converged status as well as the
role this router is playing on this neighbor/interface.

The above becomes:
state:`Full\/DR`
converged:`Full`
role:`DR`

Tests can now be modified to look for `Full` and allow it to
continue.  Most of the tests do not actually care if this
router is the DR or Backup.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-13 12:40:35 -04:00
Fredi Raspall
6f609c4980 ospfd: fix display of debug flags
* Some of the debug flags were not shown in show debugging.
* The check for TI-LFA debug was made against the wrong variable.
* Some of the debugs were not cleared with 'no debug ospf'

Signed-off-by: Fredi Raspall <fredi@voltanet.io>
2021-09-28 10:20:58 +02:00
GalaxyGorilla
3f87e1d8b3 ospfd: adjust log config for GR
Remove previous log config

	debug ospf graceful-restart helper

and just use

	debug ospf graceful-restart

for everything related to OSPF GR.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-07-05 11:43:02 -03:00
Olivier Dugeon
8db278b5e3 ospfd: Correct Coverity defects
When browsing or parsing OSPF LSA TLVs, we need to use the LSA length which is
part of the LSA header. This length, encoded in 16 bits, must be first
converted to host byte order with ntohs() function. However, Coverity Scan
considers that ntohs() function return TAINTED data. Thus, when the length is
used to control for() loop, Coverity Scan marks this part of the code as defect
with "Untrusted Loop Bound" due to the usage of Tainted variable. Similar
problems occur when browsing sub-TLV where length is extracted with ntohs().

To overcome this limitation, a size attribute has been added to the ospf_lsa
structure. The size is set when lsa->data buffer is allocated. In addition,
when an OSPF packet is received, the size of the payload is controlled before
contains is processed. For OSPF LSA, this allow a secure buffer allocation.
Thus, new size attribute contains the exact buffer allocation allowing a
strict control during TLV browsing.

This patch adds extra control to bound for() loop during TLV browsing to
avoid potential problem as suggested by Coverity Scan. Controls are based
on new size attribute of the ospf_lsa structure to avoid any ambiguity.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-05-19 09:48:54 +02:00
Mark Stapp
7de06eab47 ospfd: show seconds in timeval_dump
If the number of seconds is < one minute, show seconds and
msecs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-13 09:09:31 -04:00
Rafael Zalamena
b5b3078bec ospfd: fix checkpatch warnings
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23 10:18:42 -03:00
Rafael Zalamena
e4505a2e6d ospfd: add debug option for BFD
Add specialized debug option for BFD which also enables library debugging.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23 10:18:42 -03:00
Igor Ryzhov
409f98ab44 ospfd: don't rely on instance existence in vty
Store instance index at startup and use it when processing vty commands.
The instance itself may be created and deleted by the user in runtime
using `[no] router ospf X` command.

Fixes #7908

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-24 15:31:20 +03:00
GalaxyGorilla
a4553b5bdb ospfd: Add 'debug ospf ti-lfa' command
Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2021-01-19 15:32:13 +00:00
rgirada
ac8c9518ab ospfd: OSPF external summarisation debug support
Description:
	Changes to enable/disable debugs for external
	LSA sumarisation.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-11-01 22:34:14 -08:00
Mark Stapp
96b663a381 ospfd: replace inet_ntoa
Stop using inet_ntoa, use %pI4 etc or inet_ntop instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:37:25 -04:00
rgirada
caa1cd9eab ospfd: Debug support to ospf GR helper functionality
Description:
	Added the following debug commands to enable debugs
	GR helper functionality.
	[no] debug ospf gr helper

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 03:07:31 -07:00
rgirada
06bc3110d3 ospfd: ospf GR helper initialization
Description:
	1. Graceful restart helper init/de-init.
	2. Defining dedicated memory for helper.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
2020-09-22 00:02:33 -07:00
lynne
132a782eb8 ospfd: ldp-igp-sync feature: adding ospf support
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-09-09 14:38:44 -04:00
Santosh P K
1febb13de7 ospf: Default-information originate with routemap
Default originate with route-map was broken. Routemap
was not getting applied for redistribute route but was
getting applied default route itself. No default route
was originated even when routemap was satisfied.

Signed-off-by: Santosh P K <sapk@vmware.com>
2020-07-07 04:53:14 -07: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
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
Donatas Abraitis
0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Donald Sharp
6e3e2c6d5f ospfd: Cleanup set but unused variables
There existed some variables set but never used.  Clean this up.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-27 09:41:58 -05:00
Donald Sharp
edca5860cb ospfd: The ip header dump is crazy long and useless
Turning on packet debugs and seeing a header dump that is 11
lines long is useless

2019/11/07 01:07:05.941798 OSPF: ip_v 4
2019/11/07 01:07:05.941806 OSPF: ip_hl 5
2019/11/07 01:07:05.941813 OSPF: ip_tos 192
2019/11/07 01:07:05.941821 OSPF: ip_len 68
2019/11/07 01:07:05.941831 OSPF: ip_id 48576
2019/11/07 01:07:05.941838 OSPF: ip_off 0
2019/11/07 01:07:05.941845 OSPF: ip_ttl 1
2019/11/07 01:07:05.941857 OSPF: ip_p 89
2019/11/07 01:07:05.941865 OSPF: ip_sum 0xcf33
2019/11/07 01:07:05.941873 OSPF: ip_src 200.254.30.14
2019/11/07 01:07:05.941882 OSPF: ip_dst 224.0.0.5

We already have this debugged, it's not going to change and the
end developer can stick this back in if needed by hand to debug
something that is not working properly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-19 07:47:19 -05:00
Quentin Young
4d65d9278e ospfd: strncpy -> strlcpy
strncpy is a byte copy function not a string copy function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-02-26 20:50:17 +00:00
David Lamparter
6243a7b569 ospfd: fix symbol collision
debug_init() was recently added in libfrr, which is now causing a build
error with static linking.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-01 18:18:42 +02:00
Donald Sharp
6f32955ec3
Merge pull request #2486 from pacovn/cppcheck_fmt_validation
babeld, lib, ospfd, tests: fmt fixes (cppcheck)
2018-06-18 15:23:49 -04:00
paco
1a36dd60fd
ospfd, pimd: redundant memset (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 18:01:59 +02:00
paco
2ec42b858c
babeld, lib, ospfd, tests: fmt fixes (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 17:52:56 +02:00