| Age | Commit message (Collapse) | Author | 
 | 
Separate zebra's ZAPI server socket handling into two phases:
an early phase that opens the socket, and a later phase that
starts listening for client connections.
Signed-off-by: Mark Stapp <mjs@cisco.com>
(cherry picked from commit 506097a1b96974c261411edd25330ceaf90fa3db)
 | 
 | 
*: Rearrange vrf_bitmap_X api to reduce memory footprint
 | 
 | 
Memory leaks started flowing:
```
AddressSanitizer Topotests Part 0:  15 KB -> 283 KB
AddressSanitizer Topotests Part 1:  1 KB -> 495 KB
AddressSanitizer Topotests Part 2:  13 KB -> 478 KB
AddressSanitizer Topotests Part 3:  39 KB -> 213 KB
AddressSanitizer Topotests Part 4:  30 KB -> 836 KB
AddressSanitizer Topotests Part 5:  0 bytes -> 356 KB
AddressSanitizer Topotests Part 6:  86 KB -> 783 KB
AddressSanitizer Topotests Part 7:  0 bytes -> 354 KB
AddressSanitizer Topotests Part 8:  0 bytes -> 62 KB
AddressSanitizer Topotests Part 9:  408 KB -> 518 KB
```
```
Direct leak of 3584 byte(s) in 1 object(s) allocated from:
    #0 0x7f1957b02d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x559895c55df0 in qcalloc lib/memory.c:105
    #2 0x559895bc1cdf in zserv_client_create zebra/zserv.c:743
    #3 0x559895bc1cdf in zserv_accept zebra/zserv.c:880
    #4 0x559895cf3438 in event_call lib/event.c:1995
    #5 0x559895c3901c in frr_run lib/libfrr.c:1213
    #6 0x559895a698f1 in main zebra/main.c:472
    #7 0x7f195635ec86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
```
Fixes b20acd0 ("bgpd: Use synchronous way to get labels from Zebra")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
 | 
 | 
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>
 | 
 | 
This is for synchronous client (label/table manager) - aka session_id == 1.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
 | 
 | 
Before:
```
2023/06/18 22:00:42 ZEBRA: [VXKFG-8SJRV][EC 4043309121] Client 'bgp' encountered an error and is shutting down.
2023/06/18 22:00:42 ZEBRA: [VXKFG-8SJRV][EC 4043309121] Client 'bgp' encountered an error and is shutting down.
```
After:
```
2023/06/18 22:06:44 ZEBRA: [N5M5Y-J5BPG][EC 4043309121] Client 'bgp' (session id 0) encountered an error and is shutting down.
2023/06/18 22:06:44 ZEBRA: [N5M5Y-J5BPG][EC 4043309121] Client 'bgp' (session id 1) encountered an error and is shutting down.
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
 | 
 | 
The msg value is always reset to something new before it is used inside
the mutex.  No need to set it to NULL.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
After the restructure of the gr code to allow zebra_gr
to have individual cleanups of afi, this is no longer necessary.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When GR is running and attempting to clear up a node
if the node that is currently saved and we are coming
back to happens to be deleted during the time zebra
suspends the GR code due to hitting the node limit
then zebra GR code will just completely stop processing
and potentially leave stale nodes around forever.
Let's just remove this hole and process what we can.
Can you imagine trying to debug this after the fact?
If we remove a node then that counts toward the maximum
to process of ZEBRA_MAX_STALE_ROUTE_COUNT.  This should
prevent any non-processing with a slightly larger cost
of having to look at a few nodes repeatedly
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
We should probably prevent any type of namespace collision
with something else.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Modify the code base so that thread_cancel becomes event_cancel
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
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>
 | 
 | 
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>
 | 
 | 
Done with a combination of regex'ing and banging my head against a wall.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
 | 
 | 
Most 32-bit architectures cannot do atomic loads and stores of data
wider than their pointer size, i.e. 32 bit.  Funnily enough they
generally *can* do a CAS2, i.e., 64-bit compare-and-swap, but while a
CAS can emulate atomic add/bitops, loads and stores aren't available.
Replace with a mutex;  since this is 99% used from the zserv thread, the
mutex should take the local-to-thread fast path anyway.  And while one
atomic might be faster than a mutex lock/unlock, we're doing several
here, and at some point a mutex wins on speed anyway.
This fixes build on armel, mipsel, m68k, powerpc, and sh4.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
 | 
 | 
Fix a couple of typos in vty prompt and output text.
Signed-off-by: Mark Stapp <mjs@labn.net>
 | 
 | 
Don't use MTYPE_TMP for many things in zebra: add specific
mem types.
Signed-off-by: Mark Stapp <mjs@labn.net>
 | 
 | 
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
convert:
	frr_with_mutex(..)
to:
	frr_with_mutex (..)
To make all our code agree with what clang-format is going to produce
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
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>
 | 
 | 
At some scale we eventually run out of room displaying v4/v6 route
totals for `show zebra client summ`:
janelle# show zebra client summ
Name      Connect Time    Last Read  Last Write  IPv4 Routes       IPv6 Routes
--------------------------------------------------------------------------------
bgp           04w0d18h     00:00:19    00:01:2411729127/4052681  2037786/903094
This total over ran the space in just a little over a week of uptime.
Expand to have a bit more room.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When a client sends to zebra that GR mode is being turned
on.  The client also passes down the time zebra should hold
onto the routes.  Display this time with the output
of the `show zebra client` command as well.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When issuing the `show zebra client` command data about
Graceful Restart state is being printed 2 times.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When a vrf label is created by a client and the client disconnects
we should clean up any vrf labels associated with that client.
eva# show mpls table
 Inbound Label  Type   Nexthop  Outbound Label
 -----------------------------------------------
 1000           SHARP  RED      -
eva# exit
sharpd@eva ~/f/zebra (label_destruction)> ps -ef | grep frr
root     4017793       1  0 13:57 ?        00:00:00 /usr/lib/frr/watchfrr -d -F datacenter --log file:/var/log/frr/watchfrr.log --log-level debug zebra bgpd ospfd isisd pimd eigrpd sharpd staticd
frr      4017824       1  0 13:57 ?        00:00:00 /usr/lib/frr/zebra -d -F datacenter --log file:/tmp/zebra.log -r --graceful_restart 60 -A 127.0.0.1 -s 90000000
frr      4017829       1  0 13:57 ?        00:00:00 /usr/lib/frr/bgpd -d -F datacenter -M rpki -A 127.0.0.1
frr      4017836       1  0 13:57 ?        00:00:00 /usr/lib/frr/ospfd -d -F datacenter -A 127.0.0.1
frr      4017839       1  0 13:57 ?        00:00:00 /usr/lib/frr/isisd -d -F datacenter -A 127.0.0.1
frr      4017842       1  0 13:57 ?        00:00:00 /usr/lib/frr/pimd -d -F datacenter -A 127.0.0.1
frr      4017865       1  0 13:57 ?        00:00:00 /usr/lib/frr/eigrpd -d -F datacenter -A 127.0.0.1
frr      4017869       1  0 13:57 ?        00:00:00 /usr/lib/frr/sharpd -d -F datacenter -A 127.0.0.1
frr      4017888       1  0 13:57 ?        00:00:00 /usr/lib/frr/staticd -d -F datacenter -A 127.0.0.1
sharpd   4018624 3938423  0 14:02 pts/10   00:00:00 grep --color=auto frr
sharpd@eva ~/f/zebra (label_destruction)> sudo kill -9 4017869
sharpd@eva ~/f/zebra (label_destruction)> sudo vtysh -c "show mpls table"
sharpd@eva ~/f/zebra (label_destruction)>
Fixes: #1787
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
Move some individual add/delete lines to the table format in
the `show zebra client` command
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
There were counters FRR was keeping but never displaying.  Add them
in.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
It's not actually working properly...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
 | 
 | 
zebra implements zebra api for configuring link layer information. that
can be an arp entry (for ipv4) or ipv6 neighbor discovery entry. This
can also be an ipv4/ipv6 entry associated to an underlay ipv4 address,
as it is used in gre point to multipoint interfaces.
this api will also be used as monitoring. an hash list is instantiated
into zebra (this is the vrf bitmap). each client interested in those entries
in a specific vrf, will listen for following messages: entries added, removed,
or who-has messages.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
 | 
 | 
When displaying `show zebra client summ` when we have instances
running, display the instance number as well.
New Output:
sharpd@eva ~/frr7 (instance_data)> vtysh -c "show zebra client summ"
Name      Connect Time    Last Read  Last Write  IPv4 Routes       IPv6 Routes
--------------------------------------------------------------------------------
ospf[1]       00:00:02     00:00:02    00:00:02       0/0              0/0
ospf[5]       00:00:02     00:00:02    00:00:02       0/0              0/0
sharp         00:00:02     00:00:02    00:00:02       0/0              0/0
static        00:00:02     00:00:02    00:00:02       0/0              0/0
Routes column shows (added+updated)/deleted
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When entering `show zebra client` allow the display of the client->notify_status
for route updates.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
 | 
 | 
When zebra detects a client close, send a zapi client close
notification.
Signed-off-by: Karen Schoener <karen@voltanet.io>
 | 
 | 
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
 | 
 | 
Add code to handle proto-based NHG uninstalling after
the owning client disconnects.
This is handled the same way as rib_score_proto() but for now
we are ignoring instance.
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
 | 
 | 
The fuzzing code that is in the master branch is outdated and unused, so it
is worth to remove it to improve readablity of the code.
All the code related to the fuzzing is in the `fuzz` branch.
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
 | 
 | 
zebra: add IPv6 router-id
 | 
 | 
1. Local ethernet segments are configured in zebra by attaching a
local-es-id and sys-mac to a access interface -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
!
interface hostbond1
 evpn mh es-id 1
 evpn mh es-sys-mac 00:00:00:00:01:11
!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This info is then sent to BGP and used for the generation of EAD-per-ES
routes.
2. Access VLANs associated with an (ES) access port are translated into
ES-EVI objects and sent to BGP. This is used by BGP for the
generation of EAD-EVI routes.
3. Remote ESs are imported by BGP and sent to zebra. A list of VTEPs
is maintained per-remote ES in zebra. This list is used for the creation
of the L2-NHG that is used for forwarding traffic.
4. MAC entries with a non-zero ESI destination use the L2-NHG associated
with the ESI for forwarding traffic over the VxLAN overlay.
Please see zebra_evpn_mh.h for the datastruct organization details.
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
 | 
 | 
* add a vrf sub-command `[no] ipv6 router-id X:X::X:X`.
 * add command `[no] ipv6 router-id X:X::X:X [vrf NAME]` for backward
   compatibility.
 * add a vrf sub-command `[no] ip router-id A.B.C.D` and make the old
   one without `ip` an alias for it.
 * add a  command `[no] ip router-id A.B.C.D [vrf NAME]` for backward
   comptibility and make the old one without `ip` an alias for it.
 * add command `show ip router-id [vrf NAME]` and make
   the old one without `ip` an alias for it.
 * add command `show ipv6 router-id [vrf NAME]`.
 * add ZAPI commands `ZEBRA_ROUTER_ID_V6_ADD`,
   `ZEBRA_ROUTER_ID_V6_DELETE` and `ZEBRA_ROUTER_ID_V6_UPDATE`
   for deamons to get notified of the IPv6 router-id.
 * update zebra documentation.
Signed-off-by: Sebastien Merle <sebastien@netdef.org>
 | 
 | 
Distinguish between unicast and broadcast opaque messages
in zebra handler code. Add cli and internal api changes to
have sharpd send unicast opaque messages. Add opaque cli
commands to the sharp user doc.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
Add a zserv api to send a batch (a fifo) of messages to a
zapi client.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
Don't print GR show output header if no GR info is present
for a zapi client.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
The zapi code processes a batch of incoming messages, using a
fifo. Hand the entire batch into the main zebra handling code,
and let it loop through the individual messages.
Divert the special OPAQUE messages from the normal processing
flow, and offer them to the new zebra_opaque module instead.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
Add a mutex used to manage the list of zclients. Add a busy
counter to the zapi client session, so that we can use a
client session from another pthread.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
`debug zebra packet detail` dumps the full message whereas
it had been dropping exactly 10 bytes, the size of the zebra header
Signed-off-by: Wesley Coakley <wcoakley@cumulusnetworks.com>
 | 
 | 
Distinguish zapi sessions, for daemons who use more than one,
by adding a session id. The tuple of proto + instance is not
adequate to support clients who use multiple zapi sessions.
Include the id in the client show output if it's present. Add
a bit of info about this to the developer doc.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 | 
 | 
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
 | 
 | 
Add a common api that formats a time interval into a string
with different output for short and longer intervals. We do
this in several places, for cli/ui output.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
 |