summaryrefslogtreecommitdiff
path: root/bgpd/rfapi
AgeCommit message (Collapse)Author
2023-10-11Revert "lib: register bgp link-state afi/safi"Donald Sharp
This reverts commit 1642a68d60cfade4b2fce72aaef58dea700c65c3. (cherry picked from commit 0dc12c9003a865c7ee829543d40e8c285863abe8)
2023-09-18lib: register bgp link-state afi/safiLouis Scalbert
Register BGP Link-State AFI/SAFI values from RFC7752. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com> Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-09-10bgpd: Move the peer->su to connection->suDonald Sharp
The sockunion is per connection. So let's move it over. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Convert `struct peer_connection` to dynamically allocatedDonald Sharp
As part of the conversion to a `struct peer_connection` it will be desirable to have 2 pointers one for when we open a connection and one for when we receive a connection. Start this actual conversion over to this in `struct peer`. If this sounds confusing take a look at the bgp state machine for connections and how it resolves the processing of this router opening -vs- this router receiving an open. At some point in time the state machine decides that we are keeping one of the two connections. Future commits will allow us to untangle the peer/doppelganger duality with this abstraction. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Move status and ostatus to `struct peer_connection`Donald Sharp
The status and ostatus are a function of the `struct peer_connection` move it into that data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Create destructor function for `struct peer_connection`Donald Sharp
Create a destructor function to free up memory associated with the io buffers. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Start abstraction of `struct peer_connection`Donald Sharp
BGP tracks connections based upon the peer. But the problem with this is that the doppelganger structure for it is being created. This has introduced a bunch of fragileness in that the peer exists independently of the connections to it. The whole point of the doppelganger structure was to allow BGP to both accept and initiate tcp connections and then when we get one to a `good` state we collapse into the appropriate one. The problem with this is that having 2 peer structures for this creates a situation where we have to make sure we are configing the `right` one and also make sure that we collapse the two independent peer structures into 1 acting peer. This makes no sense let's abstract out the peer into having 2 connection one for incoming connections and one for outgoing connections then we can easily collapse down without having to do crazy stuff. In addition people adding new features don't need to have to go touch a million places in the code. This is the start of this abstraction. In this commit we'll just pull out the fd and input/output buffers into a connection data structure. Future commits will abstract further. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-08bgpd: bgp_path_info_extra memory optimizationValerian_He
Even if some of the attributes in bgp_path_info_extra are not used, their memory is still allocated every time. It cause a waste of memory. This commit code deletes all unnecessary attributes and changes the optional attributes to pointer storage. Memory will only be allocated when they are actually used. After optimization, extra info related memory is reduced by about half(~400B -> ~200B). Signed-off-by: Valerian_He <1826906282@qq.com>
2023-07-21bgpd: Remove peer->sync arrayDonald Sharp
It is never used. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-21bgpd: Remove peer->obuf_workDonald Sharp
This is never used. Free up another 65k of stream data never used per peer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-26*: Rearrange vrf_bitmap_X api to reduce memory footprintDonald Sharp
When running all daemons with config for most of them, FRR has sharpd@janelle:~/frr$ vtysh -c "show debug hashtable" | grep "VRF BIT HASH" | wc -l 3570 3570 hashes for bitmaps associated with the vrf. This is a very large number of hashes. Let's do two things: a) Reduce the created size of the actually created hashes to 2 instead of 32. b) Delay generation of the hash *until* a set operation happens. As that no hash directly implies a unset value if/when checked. This reduces the number of hashes to 61 in my setup for normal operation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-20bgpd: Initialize pfx_buf to zeros before using in bgp_path_info_cmp()Donatas Abraitis
This can lead into some garbage outputs, that can't be decoded in utf-8 or so. This was catched when testing 76b246aa1f779e17ce6845c6ab0c292497b0008f. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-04-11bgpd: rfapi memleak fixesG. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2023-03-28bgpd: Remove set but unused variablesDonald Sharp
Found by clang 15. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Fixup formatting issues due to reorderingDonald Sharp
All the event changes exposed a bunch of places where we were not properly following our standards. Just clean them up in one big fell swoop. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_timer_remain_XXX to event_timer_remain_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
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*: Rename thread.[ch] to event.[ch]Donald Sharp
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-07Merge pull request #12890 from pguibert6WIND/attr_cleaning_miscRuss White
bgp attribute cleaning misc
2023-03-03bgpd: rfapi memleak: clean CE tables at exitG. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2023-02-24rfapi: free useless attrPhilippe Guibert
The attr pointer has been interned during the process of the function, but has to be uninterned at the end. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-22bgpd: free rfapi callback object alwaysMark Stapp
An rfapi timer callback is responsible for the memory in a context object, even in special-case exit paths. Always free that object. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-02-21Merge pull request #12854 from opensourcerouting/fix/bgp_withdraw_attr_not_usedRuss White
bgpd: Drop struct attr from bgp_withdraw()
2023-02-21Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White
lib, bgp: add initial support for asdot format
2023-02-21bgpd: Drop struct attr from bgp_withdraw()Donatas Abraitis
It's not used at all. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-10bgpd: Remove extraneous include of version.hDonald Sharp
It's not needed in these compiles. So let's remove it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-10bgpd: store the route-distinguisher from config as a stringPhilippe Guibert
The route-distinguisher string can be expressed in different ways when the AS number is part of the RD. And the configured string value has to be kept intact. The following vty commands store the string value internally: - router bgp / address-family ipv4 unicast / rd vpn export <> - router bgp / address-family l2vpn evpn / rd <> - router bgp / address-family l2vpn evpn / vni <> / rd <> The vty commands where RD is configured in the below places is not considered: - router bgp / rfapi related commands - router bgp / address-family xxx xxx / network .. rd <> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-10bgpd: support for as notation format for route distinguisherPhilippe Guibert
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-09*: auto-convert to SPDX License IDsDavid Lamparter
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*: manual SPDX License ID conversionsDavid Lamparter
The files converted in this commit either had some random misspelling or formatting weirdness that made them escape automated replacement, or have a particularly "weird" licensing setup (e.g. dual-licensed.) This also marks a bunch of "public domain" files as SPDX License "NONE". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-07Merge pull request #12707 from donaldsharp/missed_enumsDonatas Abraitis
Missed enums
2023-02-01bgpd/rfapi: add missing printf attributeDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31bgpd: Add missing enum's to case statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-27*: apply proper format string attributesDavid Lamparter
So that we get warnings about broken format strings. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-21bgpd: rfapi properly free a couple listsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-11-29bgpd: inet_ntop() adjustmentsDonatas Abraitis
Use %pI4/%pI6 where possible, otherwise at least atjust stack buffer sizes for inet_ntop() calls. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-03bgpd: rfapi doc strings are messed up for one commandDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-09-22bgpd: Use %pRD for prefix_rd2str()Donatas Abraitis
Convert a bunch of prefix_rd2str() for json/vty stuff. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-08-30bgpd: Fix test for matching UN prefix and the peerDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-08-24bgpd: Replace rfapi_time() with monotime()Donald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-24bgpd: Convert from bgp_clock() to monotime()Donald Sharp
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-07-26Merge pull request #11582 from liwg06/masterRuss White
bgpd: Fixup some MAC address token cli syntax
2022-07-22Merge pull request #11657 from donaldsharp/why_timerDonatas Abraitis
convert thread_cancel to THREAD_OFF
2022-07-21bgpd: Convert thread_cancel to THREAD_OFF and use THREAD_ARGDonald Sharp
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>