Commit graph

32 commits

Author SHA1 Message Date
Mark Stapp edb330686d tools,pceplib,ospfclient: clean up variable-shadow warnings
Clean up -Wshadow warnings in these components

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
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 ce50d11c4d *: Convert thread_master_XXX functions to event_master_XXX
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 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 de2754be3a *: Convert thread_fetch and thread_call to event_fetch and event_call
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
Lou Berger 2f30cb2574 ospfd/ospfclient: add option to flush/withdrawal with zero length
default behavior is unchanged, i.e., to not zero

Signed-off-by: Lou Berger <lberger@labn.net>
2022-10-21 15:27:58 +00: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
Mark Stapp d0b0a2c545 ospfclient: replace inet_ntoa
Replace all use of inet_ntoa; use pI4 (and printfrr).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 13:41:51 -04: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
David Lamparter 37a1f2fbb6 lib: privs: make uid/gid accessible before setuid
This splits off privs_preinit(), which does the lookups for user and
group IDs.  This is so the init code can create state directories while
still running as root.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02 23:36:39 +02: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
Quentin Young 972a411ccc lib: more show thread cpu
Add support for naming pthreads. Also, note that we don't have any
records yet if that's the case.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 23:40:56 +00:00
Quentin Young 56b4067930 *: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b

The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-21 15:22:21 +00:00
Donald Sharp e6fda497d3 *: Clean up call into inet_aton
In the few places where we were not checking the return code
for inet_aton, do so.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-13 13:10:32 -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 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 5c088023db ospfclient: fix gcc -O0 build
the "static const" inside DECLARE_MTYPE still causes issues on gcc -O0
(re. gcc bug 69981).  Work around by disabling MTYPE declarations for
ospfclient.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-02-14 03:31:26 +01:00
Donald Sharp 55c7280315 *: Convert libzebra -> libfrr
The library libzebra that is installed with FRR will
conflict with Quagga.  So let's rename it to libfrr.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-02-03 08:29:13 -05:00
Paul Jakma 46f4a4d21f Add missing GPL headers, and copyright claims that certainly apply.
* Fix (a subset of)? files with non-trivial code that are missing GPL headers.

* A few copyright claims added which I am certain apply, but which I had
  missed out on the original commits.

NB: Copyright claims are not exclusive and the addition of any copyright
claim should not be read as implying a lack of any further claims, or
denying the validity of any other claims.  All those with claims of
copyright over any portion of Quagga are welcome to submit them, ideally as
patches to update copyright strings in files.

(cherry picked from commit 010ebbbca6396f272cc2d50d147dd922dda68213)
2016-05-26 01:06:59 +00:00
Donald Sharp 35dece848d Quagga: Fixup some compile warnings
Fixup compile warnings for when you turn on --enable-gcc-ultra-verbose=yes

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-23 13:31:11 -08:00
Tomasz Pala 3fc1eca92a [cleanup] Add log.h includes 2009-06-24 21:49:53 +01:00
Paul Jakma 30a2231a48 [warnings] Fix various SOS warnings
2008-08-15 Paul Jakma <paul.jakma@sun.com>

	* */*: Fix various problems flagged by Sun Studio compiler.
	  - '<qualifier> <storage>' obsolescent in declarations
	  - empty statements (';' after ALIAS definitions)
	  - implicit declarations (e.g printstack in lib/log.c)
	  - "\%" in printf string instead of "%%"
	  - loops that return on the first iteration (legitimately, but
 	    compiler can't really know), e.g. bgp_routemap.c
 	  - internal declarations which mask prototypes.
2008-08-22 19:52:59 +01:00
paul a0ace1e8f2 [ospfclient] add static qualifier
2005-11-24 Paul Jakma <paul.jakma@sun.com>

	* ospf_apiclient.c: add static qualifier to relevant functions.
	* ospfclient.c: ditto
2005-11-24 12:40:39 +00:00
paul edd7c245d3 2003-06-04 Paul Jakma <paul@dishone.st>
* Merge of zebra privileges
2003-06-04 13:59:38 +00:00
paul f894c3ad34 Author: ralph
Date: 2003-04-08 10:37:12 +0200 (Tue, 08 Apr 2003)
Log:
new ospfclient application with usage and more comments.
2003-04-09 07:26:33 +00:00
paul 2d33f15789 Addition of OSPF-API - Amir Guindehi <nospam.amir@datacore.ch> 2003-03-17 01:10:58 +00:00