Go to file
Donald Sharp 20bd3821d3 bgpd: Ensure community data is freed in some cases.
Customer has this valgrind trace:

Direct leak of 2829120 byte(s) in 70728 object(s) allocated from:
  0 in community_new ../bgpd/bgp_community.c:39
  1 in community_uniq_sort ../bgpd/bgp_community.c:170
  2 in route_set_community ../bgpd/bgp_routemap.c:2342
  3 in route_map_apply_ext ../lib/routemap.c:2673
  4 in subgroup_announce_check ../bgpd/bgp_route.c:2367
  5 in subgroup_process_announce_selected ../bgpd/bgp_route.c:2914
  6 in group_announce_route_walkcb ../bgpd/bgp_updgrp_adv.c:199
  7 in hash_walk ../lib/hash.c:285
  8 in update_group_af_walk ../bgpd/bgp_updgrp.c:2061
  9 in group_announce_route ../bgpd/bgp_updgrp_adv.c:1059
 10 in bgp_process_main_one ../bgpd/bgp_route.c:3221
 11 in bgp_process_wq ../bgpd/bgp_route.c:3221
 12 in work_queue_run ../lib/workqueue.c:282

The above leak detected by valgrind was from a screenshot so I copied it
by hand.  Any mistakes in line numbers are purely from my transcription.
Additionally this is against a slightly modified 8.5.1 version of FRR.
Code inspection of 8.5.1 -vs- latest master shows the same problem
exists.  Code should be able to be followed from there to here.

What is happening:

There is a route-map being applied that modifes the outgoing community
to a peer.  This is saved in the attr copy created in
subgroup_process_announce_selected.  This community pointer is not
interned.  So the community->refcount is still 0.  Normally when
a prefix is announced, the attr and the prefix are placed on a
adjency out structure where the attribute is interned.  This will
cause the community to be saved in the community hash list as well.
In a non-normal operation when the decision to send is aborted after
the route-map application, the attribute is just dropped and the
pointer to the community is just dropped too, leading to situations
where the memory is leaked.  The usage of bgp suppress-fib would
would be a case where the community is caused to be leaked.
Additionally the previous commit where an unsuppress-map is used
to modify the outgoing attribute but since unsuppress-map was
not considered part of outgoing policy the attribute would be dropped as
well.  This pointer drop also extends to any dynamically allocated
memory saved by the attribute pointer that was not interned yet as well.

So let's modify the return case where the decision is made to
not send the prefix to the peer to always just flush the attribute
to ensure memory is not leaked.

Fixes: #15459
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit addff17a55)
2024-03-14 08:26:28 +00:00
.github github: Add rebase label on PR if it's > 50 commits behind 2023-05-09 09:37:23 +03:00
alpine docker: Use openssl instead of libressl 2023-07-31 11:04:30 +03:00
babeld Merge pull request #13333 from donaldsharp/vrf_bitmap_cleanup 2023-07-04 22:11:11 +03:00
bfdd *: remove ZEBRA_INTERFACE_VRF_UPDATE 2023-10-07 10:06:39 +08:00
bgpd bgpd: Ensure community data is freed in some cases. 2024-03-14 08:26:28 +00:00
debian debian: Drop 9.2-dev release from stable branch changelog 2023-11-15 22:17:04 +02:00
doc doc: add param range for graceful-restart helper supported-grace-time 2023-12-14 05:42:06 +00:00
docker docker: Install the apk packages regardless of the platform 2023-07-31 11:05:15 +03:00
eigrpd eigrp: use correct memory pool on interface deletion 2023-10-11 14:19:23 +00:00
fpm *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
gdb *: Rename thread.[ch] to event.[ch] 2023-03-24 08:32:16 -04:00
grpc *: manual SPDX License ID conversions 2023-02-09 14:09:07 +01:00
include bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthop 2023-09-20 15:07:15 +02:00
isisd isisd: fix _isis_spftree_del heap-use-after-free 2024-01-05 08:47:58 +00:00
ldpd ldpd: Stop and free synchronous Zebra client on destroy 2023-06-27 11:47:50 +03:00
lib lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed 2024-02-23 09:34:05 +02:00
m4 build: fix sed regex in Lua macro 2022-12-08 12:39:17 +01:00
mgmtd mgmtd: fix local validation 2023-11-08 13:50:36 +00:00
mlag build: fix AM_LDFLAGS usage (and gcov) 2021-07-21 17:10:08 +02:00
nhrpd nhrp: fix race condition 2024-02-09 15:58:16 +00:00
ospf6d ospf6d: Let the user override interface cost for a loopback 2023-11-14 13:57:10 +00:00
ospfclient *: Convert event.h to frrevent.h 2023-03-24 08:32:17 -04:00
ospfd ospfd: Solved crash in OSPF TE parsing 2024-02-27 15:42:49 +00:00
pathd pathd: add no pcep command 2023-10-31 16:05:32 +00:00
pbrd pbrd: Fix PBR handling for last rule deletion 2024-01-25 08:01:07 +00:00
pceplib *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pimd pimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils 2024-02-09 15:17:03 +00:00
pkgsrc mgmtd: Bringup MGMTD daemon and datastore module support 2023-03-21 22:08:32 -04:00
python [ospfd]: add support for RFC 5709 HMAC-SHA Auth 2023-09-16 07:38:23 +03:30
qpb mgmtd: Bringup MGMTD daemon and datastore module support 2023-03-21 22:08:32 -04:00
redhat redhat, debian: Update release notes for 9.1 release 2023-11-12 20:08:56 +02:00
ripd *: remove ZEBRA_INTERFACE_VRF_UPDATE 2023-10-07 10:06:39 +08:00
ripngd *: remove ZEBRA_INTERFACE_VRF_UPDATE 2023-10-07 10:06:39 +08:00
sharpd *: Do not cast to the same type as the destination is 2023-09-29 10:24:16 +03:00
snapcraft snapcraft: Use libyang 2.1.80 2023-07-20 21:46:38 +03:00
staticd staticd: fix changing to source auto in bfd monitor 2023-12-06 13:06:16 +00:00
tests topotests: add an ebgp 6vpe test 2024-02-28 09:35:43 +00:00
tools tools: fix frr-reload multiple no description cmds 2024-02-08 22:04:57 +01:00
vrrpd Merge pull request #13731 from cyberstorm-mauritius/cid1519841 2023-06-21 23:15:41 +05:30
vtysh lib,vtysh: fix show route map JSON output 2023-11-28 13:47:41 +00:00
watchfrr watchfrr: Extend ignore option to daemon being killed 2023-10-19 15:49:16 +00:00
yang Revert "yang: add bgp link-state" 2023-10-11 05:02:53 +00:00
zebra zebra: fix crash if macvlan link in another netns 2024-02-27 16:32:40 +00:00
.clang-format lib: add dynamic array type 2023-06-27 18:00:56 -04:00
.dockerignore docker: Make docker image on CentOS 7 2019-11-26 19:29:30 +00:00
.flake8 style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -04:00
.git-blame-ignore-revs tools: Ignore mass renaming of topotests for git blame 2021-05-11 14:14:26 +03:00
.gitignore doc: configure: add configure option to generate .ccls file 2023-05-18 09:32:32 -04:00
.isort.cfg style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -04:00
.pylintrc style: add format checker config that matches FRR style standards 2023-04-18 05:18:26 -04:00
.travis.yml lib: libyang2 add missed conversion 2021-05-17 22:13:59 -04:00
bootstrap.sh build: turn on automake warnings (& symlinks) 2021-04-21 15:42:37 +02:00
buildtest.sh *: manual SPDX License ID conversions 2023-02-09 14:09:07 +01:00
config.version.in build: carry --with-pkg-extra-version into tarballs 2018-10-24 15:11:50 +02:00
configure.ac FRR Release 9.1 2023-11-15 17:01:50 +02:00
COPYING *: sort out & explain licenses used in FRR 2023-02-09 12:46:13 +01:00
Makefile.am build: clean up mgmtd lib protobuf make syntax 2023-03-27 16:44:27 -04:00
README.md doc: Fix the link that points to Slack invitation in README 2022-03-24 13:13:37 +02:00
stamp-h.in Initial revision 2002-12-13 20:15:29 +00:00
version.h build: make builddir include path consistent 2021-04-21 15:42:33 +02:00

Icon

FRRouting

FRR is free software that implements and manages various IPv4 and IPv6 routing protocols. It runs on nearly all distributions of Linux and BSD and supports all modern CPU architectures.

FRR currently supports the following protocols:

  • BGP
  • OSPFv2
  • OSPFv3
  • RIPv1
  • RIPv2
  • RIPng
  • IS-IS
  • PIM-SM/MSDP
  • LDP
  • BFD
  • Babel
  • PBR
  • OpenFabric
  • VRRP
  • EIGRP (alpha)
  • NHRP (alpha)

Installation & Use

For source tarballs, see the releases page.

For Debian and its derivatives, use the APT repository at https://deb.frrouting.org/.

Instructions on building and installing from source for supported platforms may be found in the developer docs.

Once installed, please refer to the user guide for instructions on use.

Community

The FRRouting email list server is located here and offers the following public lists:

Topic List
Development dev@lists.frrouting.org
Users & Operators frog@lists.frrouting.org
Announcements announce@lists.frrouting.org

For chat, we currently use Slack. You can join by clicking the "Slack" link under the Participate section of our website.

Contributing

FRR maintains developer's documentation which contains the project workflow and expectations for contributors. Some technical documentation on project internals is also available.

We welcome and appreciate all contributions, no matter how small!

Security

To report security issues, please use our security mailing list:

security [at] lists.frrouting.org