Commit graph

102 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
Andrew Dickinson b331ebdbac ospfclient: fix crash due to streamwriter garbage collect
Signed-off-by: Andrew Dickinson <andrew.dickinson.0216@gmail.com>
2024-12-20 14:41:20 -05:00
Jafar Al-Gharaibeh b3dc3680bc tools, ospfclient: add a config option to skip installing python scripts
The new config option --disable-python-runtime allows make install to proceed
without installing any of the python scripts. When installing from deb/rpm
packages those are bundled as frr-pythontools, which is independent from the
frr binaries and can already be skipped. I.e, this PR gives the option to skip
those scripts when building/installing from sources too.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-08-22 13:46:30 -05: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
Christian Hopps 6efa8fd5c1 ospfclient: remove register "READY" requirement
- also add ability of the apibin to process commands on stdin

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-02-20 11:58:30 -05:00
Christian Hopps 703d2c0a3e ospfclient: bugfix and no implicit register
- dont delete the callback on opaque data delete
- require explicit registration

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-02-20 11:58:30 -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
David Lamparter 47b6d5406f *: sort out & explain licenses used in FRR
New "introduction" note in `COPYING`, and all the licenses moved into
`doc/licenses/`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 12:46:13 +01:00
Donald Sharp 253113bcb8 ospfd, ospfclient: Do not just include .c files in another .c
ospfclient.c includes .c files directly from ospfd.  Let's separate
these out a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-05 11:55:14 -05: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
Lou Berger 08172828f6 ospfd: ospf_apiserver.c - fix link local opaque LSA delete
Signed-off-by: Lou Berger <lberger@labn.net>
2022-10-21 15:08:53 +00:00
Lou Berger 20d26a9e08 ospfclient: add 'wait,<seconds>' action to ospfclient.py - for testing
Signed-off-by: Lou Berger <lberger@labn.net>
2022-10-19 15:02:31 +00:00
sri-mohan1 ac62d9fdca ospfclient: condition optimization
Its better to check the length and then the type of the LSA

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2022-07-27 14:59:53 +05:30
Donald Sharp d2aeac3870 ospfclient: Ensure ospf_apiclient_lsa_originate cannot accidently write into stack
Even though OSPF_MAX_LSA_SIZE is quite large and holds the upper bound
on what can be written into a lsa, let's add a small check to ensure
it is not possible to do a bad thing.

This wins one of the long standing bug awards.  2003!

Fixes: #11602
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-22 13:17:58 -04:00
Christian Hopps b059fb7f32 ospfclient: add router id support to python client
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-23 05:01:40 -04:00
Jafar Al-Gharaibeh 770e16041c ospfclient: fix help url
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2022-06-21 09:54:31 -05:00
Christian Hopps 9191ac86fd ospfclient: add ospfclient api python class
Signed-off-by: Christian Hopps <chopps@labn.net>
2022-06-02 16:37:16 -04:00
Donatas Abraitis 6006b807b1 *: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
    Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:47 +03:00
Donald Sharp 78dfa0c754 *: Fix spelling of Following
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-01 16:27:55 -04: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
David Lamparter 63116a7008 build: fix AM_LDFLAGS usage (and gcov)
like the other automake variables, setting `xyz_LDFLAGS` causes
`AM_LDFLAGS` to be ignored for `xyz`.  For some reason I had in my mind
that automake doesn't do this for LDFLAGS, but... it does.  (Which is
consistent with `_CFLAGS` and co.)

So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which
includes `SAN_FLAGS` too).  Set up new `LIB_LDFLAGS` and
`MODULE_LDFLAGS` to handle all of this correctly (and move these bits to
a central location.)

Fixes: #9034
Fixes: 0c4285d77e ("build: properly split CFLAGS from AC_CFLAGS")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-21 17:10:08 +02:00
David Lamparter 80413c2073 *: require semicolon after FRR_DAEMON_INFO & co.
... again ...

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:39 +01:00
David Lamparter bf8d3d6aca *: require semicolon after DEFINE_MTYPE & co
Back when I put this together in 2015, ISO C11 was still reasonably new
and we couldn't require it just yet.  Without ISO C11, there is no
"good" way (only bad hacks) to require a semicolon after a macro that
ends with a function definition.  And if you added one anyway, you'd get
"spurious semicolon" warnings on some compilers...

With C11, `_Static_assert()` at the end of a macro will make it so that
the semicolon is properly required, consumed, and not warned about.

Consistently requiring semicolons after "file-level" macros matches
Linux kernel coding style and helps some editors against mis-syntax'ing
these macros.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17 06:18:17 +01:00
David Lamparter b2fa8c0fa3 lib/xref: put setup calls in libraries
Our "true" libraries (i.e. not modules) don't invoke neither
FRR_DAEMON_INFO nor FRR_MODULE_SETUP, hence XREF_SETUP isn't invoked
either.  Invoke it directly to get things working.

Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-01 17:18:51 +01: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
Mark Stapp d81937481d ospfd: fix SA warnings in ospfd, ospfclient
Fix some SA warnings in ospf GR and ospfclient code.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-14 13:41:00 -04:00
Donald Sharp d7b4f53a0f ospfclient: Provide some protection against blindly trusting input
Coverity rightly points out that blindly trusting the lsalen
from received data may not be the smartest thing to do.  Add
a bit of code to prevent us from blindly malloc'ing
too much memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-09 09:16:08 -04:00
Donatas Abraitis 975a328e2e *: Replace s_addr 0 => INADDR_ANY
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-02-06 09:00:12 +02:00
David Lamparter 9b5065e036 ospfclient: don't install man page
... we're not installing ospfclient (it's a demo/example program), so
installing the man page is quite useless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-15 14:05:11 +01:00
David Lamparter 429576883e doc: rename man pages to frr-*
The vrrpd one conflicts with the standalone vrrpd package; also we're
installing daemons to /usr/lib/frr on some systems so they're not on
PATH.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-15 14:05:11 +01:00
David Lamparter fdbd8086b1 build: fix a whole bunch of *FLAGS
- some target_CFLAGS that needed to include AM_CFLAGS didn't do so
- libyang/sysrepo/sqlite3/confd CFLAGS + LIBS weren't used at all
- consistently use $(FOO_CFLAGS) instead of @FOO_CFLAGS@
- 2 dependencies were missing for clippy

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-01-30 19:13:51 +01:00
David Lamparter 58596d3444 build: make rfptest and ospfclient "noinst"
Both of these are testing/demo-style tools that don't make sense as part
of a normal installation.  So don't install them.

NB: this is only the executables, libospfclient and the RFP code are not
affected.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-28 19:48:55 +01:00
David Lamparter d6e7625706 build: add --enable-static-bin option
This option can be used to get statically linked binaries.

Note: libfrr.la is removed from modules' library dependency list.  This
is intentional and explained in a comment in lib/subdir.am.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-01 14:56:18 +02:00
David Lamparter f4f2f2ccac build: fix not building docs w/o sphinx
Can't build manpages without sphinx-build, oops...

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-09 20:01:08 +02:00
David Lamparter e7c25325cc *: cleanup .gitignore files
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter 74dc19a2f5 build: move vtysh & manpage listings to subdir.am
Since we're now building through one large Makefile, we can easily put
things with their daemons and crossreference nicely.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:19 +02:00
Donald Sharp 19c0412aad ospfd: Remove unused function
The ospf_external_route_lookup function was not
being used so let's just remove it.

Unfortunately the removal was not quite so simple as
that ospf_asbr.h was being used to generate a reference
for the `struct ospf_route` data structure, so we
need to fix up the compile by fixing up header
inclusions so that ospf_route.h is actually included

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-21 08:40:51 -04: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
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
Donald Sharp fc73dd4bdf Merge pull request #911 from opensourcerouting/non-recursive-2
more non-recursive build, fix cross-compile, & doc build mangling
2017-08-09 14:38:07 -04:00
David Lamparter afca06902e build: non-recursive ospf*
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-04 11:09:50 +02: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