Commit Graph

68 Commits

Author SHA1 Message Date
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
Russ White
ba755d35e5
Merge pull request #12248 from pguibert6WIND/bgpasdot
lib, bgp: add initial support for asdot format
2023-02-21 08:01:03 -05:00
Philippe Guibert
4a8cd6ad7f bgpd: support for as notation format for route distinguisher
RD may be built based on an AS number. Like for the AS, the RD
may use the AS notation. The two below examples can illustrate:

RD 1.1:20 stands for an AS4B:NN RD with AS4B=65536 in dot format.
RD 0.1:20 stands for an AS2B:NNNN RD with AS2B=0.1 in dot+ format.

This commit adds the asnotation mode to prefix_rd2str() API so as
to pick up the relevant display.

Two new printfrr extensions are available to display the RD with
the two above display methods.
- The pRDD extension stands for dot asnotation format
- The pRDE extension stands for dot+ asnotation format.
- The pRD extension has been renamed to pRDP extension

The code is changed each time '%pRD' printf extension is called.
Possibly, the asnotation may change the output, then a macro defines
the asnotation mode to use. A side effect of forging the mode to
use is that the string could not be concatenated with other strings
in vty_out and snprintfrr. Those functions have been called multiple
times. When zlog_debug needs to display the RD with some other string,
the prefix_rd2str() old API is used instead of the printf extension.

Some code has been kept untouched:
- code related to running-config. Actually, wherever an RD is displayed,
its configured name should be dumped.
- bgp rfapi code
- bgp evpn multihoming code (partially done), since the logic is
missing to get the asnotation of 'struct bgp_evpn_es'.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-10 10:27:23 +01: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
c4f64ea94d bgpd: Use %pRD for prefix_rd2str()
Convert a bunch of prefix_rd2str() for json/vty stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-22 13:12:11 +03:00
Donald Sharp
98b7e9754c bgpd: Replace rfapi_time() with monotime()
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-24 08:28:51 -04:00
Donald Sharp
083ec940ab bgpd: Convert from bgp_clock() to monotime()
Let's convert to our actual library call instead
of using yet another abstraction that makes it fun
for people to switch daemons.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-24 08:23:40 -04:00
Donald Sharp
c3aaa89a44 bgpd: Convert thread_cancel to THREAD_OFF and use THREAD_ARG
Just convert all uses of thread_cancel to THREAD_OFF.  Additionally
use THREAD_ARG instead of t->arg to get the arguement.  Individual
files should never be accessing thread private data like this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:30:49 -04:00
Donald Sharp
04fd828f3f bgpd: rfapi code does not need to assert on memory allocations
cleanup memory allocations asserting that it didn't fail
as well as clean up some thread shenanigans.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-19 13:54:10 -04:00
Donatas Abraitis
8998807f69 *: Avoid casting to the same type as on the left
Just not necessary.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-08 16:07:42 +03: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
Donald Sharp
518223c161
Merge pull request #10496 from ton31337/fix/move_struct_ecommunity_to_extra
bgpd: Use bgp_attr_[sg]et_ecommunity for struct ecommunity
2022-02-08 14:12:15 -05:00
Donald Sharp
c7ca5ccf6f bgpd: Use AF_UNSPEC instead of setting to 0
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-07 13:16:59 -05:00
Donatas Abraitis
b53e67a389 bgpd: Use bgp_attr_[sg]et_ecommunity for struct ecommunity
This is an extra work before moving attr->ecommunity to attra_extra struct.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-04 15:56:20 +02:00
Donald Sharp
91ebf12cb9 bgpd: Convert attr->vnc_subtlvs to use accessor functions
Add a get/set accessor functions and use them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15 09:49:14 -05:00
Mark Stapp
b3d6bc6ef0 * : update signature of thread_cancel api
Change thread_cancel to take a ** to an event, NULL-check
before dereferencing, and NULL the caller's pointer. Update
many callers to use the new signature.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23 08:59:34 -04: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
c10e14e96d *: Create/Use accessor functions for lock count
Create appropriate accessor functions for the rn->lock
data.  We should be accessing this data through accessor
functions since it is private data to the data structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-17 13:39:10 -04: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
b54892e0ea bgpd: Convert users of rn->p to use accessor function
Add new function `bgp_node_get_prefix()` and modify
the bgp code base to use it.

This is prep work for the struct bgp_dest rework.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-26 16:25:16 -04:00
Donald Sharp
26a3ffd60e bgpd, lib, ripngd: Add agg_node_get_prefix
Modify code to use lookup function agg_node_get_prefix()
as the abstraction layer.  When we rework bgp_node to
bgp_dest this will allow us to greatly limit the amount
of work needed to do that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-24 07:51:41 -04:00
Donald Sharp
1a4189d4a1 bgpd, isisd, lib: Make key values const for skiplist
Make some key values const for the skiplist code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-24 07:33:13 -04:00
Ruben Kerkhof
1e20238af5 treewide: fix some issues found with -Werror=undef
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2020-03-10 16:53:13 +01:00
Donald Sharp
94f7f37d54 bgpd: agg_node_lookup not unlocking
SA has found a case where we did a table lookup of a rn( and
associated lock of that node ) where we did not unlock it.

Unlock the node before moving on to the next one.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-27 09:41:58 -05:00
Donald Sharp
05864da791 bgpd: struct bgp_path_info *->attr must not be NULL
We make the assumption that ->attr is not NULL throughout
the code base.  We are totally inconsistent about application
of this though.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-16 13:38:29 -04:00
Ruben Kerkhof
4d762f2607 Treewide: use ANSI function definitions
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2019-01-24 11:21:59 +01:00
Donald Sharp
40381db785 bgpd: Rename various variable names to something more appropriate
ri -> pi
bi -> bpi
info -> path
info -> rmap_path ( for routemap applications )

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:26:30 -04:00
Donald Sharp
4b7e606625 bgpd: Convert struct bgp_info to struct bgp_path_info
Do a straight conversion of `struct bgp_info` to `struct bgp_path_info`.
This commit will setup the rename of variables as well.

This is being done because `struct bgp_info` is not descriptive
of what this data actually is.  It is path information for routes
that we keep to build the actual routes nexthops plus some extra
information.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-09 14:14:25 -04: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
David Lamparter
b45ac5f5c6 *: fix config.h/zebra.h include order
config.h (or, transitively, zebra.h) must be the first include file
listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work
correctly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
Donald Sharp
fe08ba7e11 bgpd, ripngd: Convert to using new agg_table/route
Switch bgp and ripngd to use the new aggregate table and
route data structures.  This was mainly a search and replace
operation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-30 17:47:59 -04:00
Pascal Mathis
3f54c705ec
bgpd: Cleanup of bgp daemon code
This commit removes various parts of the bgpd implementation code which
are unused/useless, e.g. unused functions, unused variable
initializations, unused structs, ...

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
2018-07-07 22:51:13 +02:00
Donald Sharp
e208c8f943 bgpd, lib, zebra: Switch to work_queue_free_and_null
The work_queue_free function free'd up the wq pointer but
did not set it too NULL.  This of course causes situations
where we may use the work_queue after it is freed.  Let's
modify the work_queue to set the pointer for you.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-09 11:07:41 -05: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
mitesh
317f1fe02f zebra/bgpd: fix compilation issues
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2018-01-23 16:30:40 -08:00
Donald Sharp
06b9f471ab bgpd: Fixup buffer sizes for prefix_rd2str
The prefix_rd2str uses a buffer size of RD_ADDRSTRLEN.
Modify the code to consistently use this for all of BGP.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-11 12:39:16 -05:00
Donald Sharp
872ed4c793 bgpd: Fix prefix2str using BUFSIZ to PREFIX_STRLEN
PREFIX_STRLEN is the correct length for buffers needed to output
a prefix2str.  Additionally cleanup some setting of the last
value to a `\0` this is handled by prefix2str.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-11 08:42:51 -05:00
Donald Sharp
8cea954775 bgpd: Cleanup unneeded NULL checks.
All the NULL checks come after previous dereferences.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-12-04 21:28:19 -05:00
Renato Westphal
cbb65f5ef5 *: fix coverity warnings - error handling issues
Ignore the return value of some functions in the places we know they
can't fail, and other small fixes.

Regarding the change in bgpd/rfapi/rfapi_rib.c, asserting that
rfapiRaddr2Qprefix() didn't fail is the common idiom inside the rfapi
code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-24 19:30:30 -02: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
28328ea953 bgpd: Convert to using ETH_ALEN
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-04 09:06:14 -04:00
Renato Westphal
9b86009a38 bgpd/eigrpd: fix crashes found by the CLI fuzzer
Fixes the following crashes:
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1 json"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show ip bgp l2vpn evpn all 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1 json"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp l2vpn evpn all 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 2001:db8::1/128 json"
* bgpd aborted: vtysh  -c "show bgp ipv4 vpn rd 1:1 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 1.1.1.1/32 json"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 2001:db8::1/128 json"
* bgpd aborted: vtysh  -c "show bgp ipv6 vpn rd 1:1 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show vnc responses 1.1.1.1/32"
* bgpd aborted: vtysh  -c "show vnc responses 2001:db8::1/128"
* bgpd aborted: vtysh  -c "show vnc responses 11:11:11:11:11:11"
* bgpd aborted: vtysh  -c "show vnc responses"
* eigrpd aborted: vtysh -c "configure terminal" -c "no router eigrp 65535"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-07-25 13:58:23 -03:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -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
22106bbf68 Merge remote-tracking branch 'frr/master' into table-hash-ospf6-lsdb-refactor
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 17:30:56 +02:00
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04: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
cdda201036 *: remove VTYNL, part 5 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00