Merge pull request #22093 from opensourcerouting/fix/move_link_bw_from_attr_extra_to_bgp_path_info_extrabgpd: Move link_bw from attr_extra to bgp_path_info_extra
topotests: skip support bundle collection after topology teardownTrack topology_stopped in Topogen and skip generate_support_bundle()
when teardown already ran, e.g. on module-level memleak failures.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
topotests: reap mutini zombies in xdist worker cleanupReap unreaped mutini/nsenter children after munet SIGKILL cleanup so
pytest-xdist workers exit instead of blocking the controller.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
tests: Modify conditional advertisement test to show that no change happensModify the test_bgp_conditional_advertisement_track_peer.py script
to ensure that the version # for a bgp prefix stays the same
after a cycle of the conditional advertisement fires.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Move link_bw from attr_extra to bgp_path_info_extraattr and attr_extra are "designed" for BGP attributes, but link_bw is not an
actual BGP attribute, it's derived from Extended Community.
Let's move it to bgp_path_info_extra.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd: Fix infinite loop in MRT route dump for oversized pathsThis is a complete fix for CVE-2016-4049.
Fixes: 246556b ("bgpd: Fix buffer overflow error in bgp_dump_routes_func")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd: Move bgp_path_info_get_srte_color to bgp_route.[ch]Since srte_color is moved from struct attr, move the getter outside attr
as well.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd: Add bgp_path_info_extra_same helper to compare extra fieldsSince srte_color is moved from struct attr to struct bgp_path_info_extra, we
need still to compare it if it's the same or not before UPDATE/WITHDRAW/LEAK,
so let's do this with this new helper method. Maybe something more fields
need to be checked/compared in the future.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd: Move srte_color from attr struct to bgp_path_info_extrastruct attr is used for BGP attributes, but srte_color is just encoded as
an extended community. Move this srte_color member to bgp_path_info_extra
struct to avoid confusions and occupying 4-bytes for attr if not needed at all.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd: Use lookup not get for VNC pdest on new route in rfapiUse lookup to avoid a get/free cycle on the removal case.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC pdest on attr change add in rfapiUse a lookup to avoid the creation/deletion of a node in the removal
case.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC pdest on new route in bgp_updateUse a lookup to avoid a get/free cycle in the deletion case.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC pdest on attr change add in bgp_updateAvoid a alloc/free cycle on the removal case by doing a lookup
instead.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC pdest on attr change delete in rfapiWhen removing a node, use lookup instead of a get/free cycle.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC implicit withdraw pdest in bgp_updateDo not use a get operation on withdrawal, do a lookup and
only do the withdrawal if found, to avoid a alloc/free cycle.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC pdest in del_vnc_routeSwitch to _lookup for finding the parent dest and not create
and then delete the node on deletion.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Use lookup not get for VNC withdraw pdest in bgp_rib_withdrawConvert get of the two level table into a lookup so that there
is no creation/deletion of the table on withdrawal.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Do not create rd table if negate of network statementDo not create the rd table if in a negate operation.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra: Track netlink carrier changes valueTurns out netlink lets us know how many times a carrier change
has happened. Keep track of it. At this point do nothing with
it.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: Fix use-after-free for ORF caseThis is similar to ffff1a1, and 3d43d7b.
Just mirror and use the same pattern to avoid dangling pointers for orf_plist.
==1==ERROR: AddressSanitizer: heap-use-after-free on address 0x508000037638 at pc 0x7f4daf26dae3 bp 0x7fffb1118f40 sp 0x7fffb1118f30
READ of size 4 at 0x508000037638 thread T0
0 0x7f4daf26dae2 in prefix_list_apply_ext lib/plist.c:789
1 0x55b2c256c487 in subgroup_anno...
*: Remove null pointer checks on codeXCALLOC/XMALLOC and XREALLOC cannot fail, as such
checking for NULL is redundant and unnecessary, remove.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
*: use event_is_scheduled() for struct event * truth testsThe pattern:
if (event)
Should really be:
if (event_is_scheduled(event))
Replace.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
*: Drop redundant if-guard before event_cancel()The pattern of:
if (event)
event_cancel();
makes no sense, just do a `event_cancel()`. That is sufficient.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
*: drop redundant struct event * NULL assignmentsThe event system when calling a event handler has already
set the event pointer to NULL that was handed in. There
is no need to do this again.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra: explicitly cancel event timers instead of null'ing pointerInstead of null'ing pointers, explicitly cancel the event timer
as that leaving a event dangling is dangerous and causes problems.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
pimd: cancel pim sock read event before recreating socketThe code was using this as a pattern:
event = NULL;
event_add_timer(...,&event,...);
This can leave a dangling event in the event system. Explicitly
cancel and then restart.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd: cancel rfapi withdraw timer before re-armingWe have this pattern:
event = NULL
event_add_timer(..., &event...);
FRR code should never set a event to NULL as that any existing
timer will be run but the ability to stop it has been lost,
modify the code to cancel the event and then add the timer again.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
ospfd: use XCALLOC for ospf_apiserver allocationsospf_apiserver.c is using XMALLOC for alloc'ing memory,
switch over to XCALLOC and drop the NULL pointer assignments
to event structures as well as the memset.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
ldpd: Cleanup event system handling of pointersThere are several classes of problems:
a) event pointer is set to NULL inside the handler function.
This is unnecessary and redundant, so we can safely remove the
set.
b) event_cancel is called then the event pointer is set to
NULL. Again this is redundant.
c) fresh calloc call we set the event pointer to NULL.
This is redundant.
d) Actual bug, use malloc to grab memory and then
call some ...