mirror_frr/zebra
Stephen Worley c25c3ea57a zebra: free unhashable (dup) NHEs via ID table cleanup
Free unhashable (duplicate NHEs from the kernel) via ID table
cleanup. Since the NHE ID hash table contains extra entries,
that's the one we need to be calling zebra_nhg_hash_free()
on, otherwise we will never free the unhashable NHEs.

This was found via a memleak:

==1478713== HEAP SUMMARY:
==1478713==     in use at exit: 10,267 bytes in 46 blocks
==1478713==   total heap usage: 76,810 allocs, 76,764 frees, 3,901,237 bytes allocated
==1478713==
==1478713== 208 (88 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 35 of 41
==1478713==    at 0x483BB1A: calloc (vg_replace_malloc.c:762)
==1478713==    by 0x48E35E8: qcalloc (memory.c:110)
==1478713==    by 0x451CCB: zebra_nhg_alloc (zebra_nhg.c:369)
==1478713==    by 0x453DE3: zebra_nhg_copy (zebra_nhg.c:379)
==1478713==    by 0x452670: nhg_ctx_process_new (zebra_nhg.c:1143)
==1478713==    by 0x4523A8: nhg_ctx_process (zebra_nhg.c:1234)
==1478713==    by 0x452A2D: zebra_nhg_kernel_find (zebra_nhg.c:1294)
==1478713==    by 0x4326E0: netlink_nexthop_change (rt_netlink.c:2433)
==1478713==    by 0x427320: netlink_parse_info (kernel_netlink.c:945)
==1478713==    by 0x432DAD: netlink_nexthop_read (rt_netlink.c:2488)
==1478713==    by 0x41B600: interface_list (if_netlink.c:1486)
==1478713==    by 0x457275: zebra_ns_enable (zebra_ns.c:127)

Repro with:
ip next add id 1 blackhole
ip next add id 2 blackhole

valgrind /usr/lib/frr/zebra

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-04-02 11:41:25 -04:00
..
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
connected.c *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__ 2020-03-05 20:23:23 +02:00
connected.h zebra: Do not use connection dest for bcast 2019-08-18 18:54:46 +02:00
debug.c zebra: mlag debug was not being persisted 2020-02-14 09:18:30 -08:00
debug.h zebra: add a debug category for nexthops 2019-12-23 08:47:38 -05:00
if_ioctl_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
if_ioctl.c Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
if_netlink.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
if_netlink.h vrrpd: protodown macvlan in backup state 2019-05-17 00:27:08 +00:00
if_sysctl.c *: spelchek 2018-10-25 20:10:57 +02:00
interface.c *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__ 2020-03-05 20:23:23 +02:00
interface.h zebra: knob to make ra retransmit interval rfc compliant 2019-11-22 18:40:20 +00:00
ioctl_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ioctl_solaris.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
ioctl.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ioctl.h zebra: removing old intf address code 2019-04-22 13:49:27 -04:00
ipforward_proc.c zebra: Cleanup set but unused variables 2020-02-27 09:41:58 -05:00
ipforward_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ipforward_sysctl.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
ipforward.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
irdp_interface.c *: s/TRUE/true/, s/FALSE/false/ 2019-07-01 17:26:05 +00:00
irdp_main.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
irdp_packet.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
irdp.h *: strip trailing whitespace 2019-09-30 16:44:43 +00:00
kernel_netlink.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
kernel_netlink.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
kernel_socket.c *: remove line breaks from log messages 2020-03-24 19:43:18 +01:00
kernel_socket.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
label_manager.c *: use the current project name (FRRouting) 2020-03-25 17:38:56 -04:00
label_manager.h *: use the current project name (FRRouting) 2020-03-25 17:38:56 -04:00
main.c zebra: implement zebra route map northbound 2020-03-23 07:55:13 -03:00
Makefile build: convert zebra/ to non-recursive build 2017-07-31 23:03:30 +02:00
redistribute.c Merge pull request #5925 from volta-networks/synchronous_client 2020-03-26 17:32:37 -03:00
redistribute.h zebra: revise redistribution delete to improve update case 2019-09-12 08:51:05 -04:00
rib.h zebra: add per-nexthop backup index 2020-03-27 11:50:03 -04:00
router-id.c *: Replace s_addr 0 => INADDR_ANY 2020-02-06 09:00:12 +02:00
router-id.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
rt_netlink.c zebra: clean up a debug and an api in netlink code 2020-03-27 09:37:02 -04:00
rt_netlink.h zebra: Add functionality to parse RTM_NEWNEXTHOP and RTM_DELNEXTHOP messages 2019-10-25 11:13:36 -04:00
rt_socket.c zebra: BSD null routes were not being installed 2019-11-21 09:37:36 -05:00
rt.h zebra: Add base functionality for nexthop processing via the dataplane 2019-10-25 11:13:36 -04:00
rtadv.c zebra: delete ipv6 RA prefix entries when zebra is killed 2020-03-10 11:07:14 +00:00
rtadv.h zebra: add all ipv6 global addresses to RA messages 2020-02-14 17:03:16 +00:00
rtread_getmsg.c *: Replace sizeof something to sizeof(something) 2020-03-08 21:44:53 +02:00
rtread_netlink.c zebra: evpn remote delete fetch local entry 2018-12-31 14:40:31 -08:00
rtread_sysctl.c zebra: evpn remote delete fetch local entry 2018-12-31 14:40:31 -08:00
rule_netlink.c *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__ 2020-03-05 20:23:23 +02:00
rule_netlink.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
rule_socket.c *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__ 2020-03-05 20:23:23 +02:00
sample_plugin.c zebra: Add a sample dataplane plugin module 2019-10-31 16:24:16 -04:00
subdir.am zebra: implement zebra route map northbound 2020-03-23 07:55:13 -03:00
table_manager.c *: list_delete_and_null() -> list_delete() 2018-10-02 11:40:52 +02:00
table_manager.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
testrib.conf
zapi_msg.c zebra: handle backup nexthops in nhe/nhgs 2020-03-27 11:50:03 -04:00
zapi_msg.h zebra: revise redistribution delete to improve update case 2019-09-12 08:51:05 -04:00
zebra_dplane.c zebra: add per-nexthop backup index 2020-03-27 11:50:03 -04:00
zebra_dplane.h zebra: add per-nexthop backup index 2020-03-27 11:50:03 -04:00
zebra_errors.c zebra: default ns->info should be default zebra_ns 2019-11-15 12:33:35 -05:00
zebra_errors.h zebra: default ns->info should be default zebra_ns 2019-11-15 12:33:35 -05:00
zebra_fpm_dt.c zebra: fix nexthop_group conversion in fpm code 2020-02-28 08:45:56 -05:00
zebra_fpm_netlink.c *: Finish off the __PRETTY_FUNCTION__ to __func__ 2020-03-06 09:23:22 -05:00
zebra_fpm_private.h Zebra: Build nelink message for RMAC updates 2019-06-17 12:05:38 -07:00
zebra_fpm_protobuf.c zebra: fix nexthop_group conversion in fpm code 2020-02-28 08:45:56 -05:00
zebra_fpm.c *: change hash_backet to hash_bucket 2020-02-28 13:59:13 -05:00
zebra_gr.c lib, zebra: remove nullity check before XFREE... 2020-03-09 18:16:32 -04:00
zebra_l2.c zebra: Ensure master's ifname is known, even if slave comes up first 2019-08-13 16:29:40 +00:00
zebra_l2.h zebra: Ensure master's ifname is known, even if slave comes up first 2019-08-13 16:29:40 +00:00
zebra_memory.c zebra: use MTYPE_STATIC 2019-06-21 08:54:25 +02:00
zebra_memory.h zebra: use MTYPE_STATIC 2019-06-21 08:54:25 +02:00
zebra_mlag_private.c zebra: SO_PEERCRED is a getsockopt call 2020-03-06 16:03:52 -05:00
zebra_mlag_vty.c zebra: Do not build mlag protobuf support if version 3 is not avail 2019-12-15 09:37:51 -05:00
zebra_mlag_vty.h zebra: Do not build mlag protobuf support if version 3 is not avail 2019-12-15 09:37:51 -05:00
zebra_mlag.c zebra: Fix spelling mistakes found by debian packaging 2020-03-13 19:16:11 -04:00
zebra_mlag.h pimd: Add accidently missed code during upstreaming process 2020-03-06 16:02:52 -05:00
zebra_mpls_netlink.c zebra: convert PW updates to async dataplane 2019-01-25 10:45:57 -05:00
zebra_mpls_null.c zebra: convert PW updates to async dataplane 2019-01-25 10:45:57 -05:00
zebra_mpls_openbsd.c *: Remove parenthesis on return for constants 2020-02-09 14:21:56 +02:00
zebra_mpls_vty.c bgpd, ospfd, pimd, zebra: Convert more use_json locations to bool 2018-09-04 17:39:04 +00:00
zebra_mpls.c zebra,lib: use const in more apis 2020-03-27 09:37:02 -04:00
zebra_mpls.h zebra,lib: use const in more apis 2020-03-27 09:37:02 -04:00
zebra_mroute.c zebra: Add some additional vrf debug for retrieving mroute info 2018-09-17 09:22:31 -04:00
zebra_mroute.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_netns_id.c zebra: dead code (Coverity 1465497) 2018-10-02 15:45:44 +02:00
zebra_netns_id.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_netns_notify.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
zebra_netns_notify.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_nhg_private.h zebra: don't created connected if duplicate depend 2020-01-30 17:15:05 -05:00
zebra_nhg.c zebra: don't include backup nhs in main nhe dependency tree 2020-03-27 11:50:03 -04:00
zebra_nhg.h zebra: handle backup nexthops in nhe/nhgs 2020-03-27 11:50:03 -04:00
zebra_northbound.c zebra: implement zebra route map northbound 2020-03-23 07:55:13 -03:00
zebra_ns.c zebra: XFREE ns->info directly to NULL it out 2019-11-15 12:33:35 -05:00
zebra_ns.h zebra: Move the supports_nh bool to a better place 2019-10-25 11:13:41 -04:00
zebra_pbr.c *: Finish off the __PRETTY_FUNCTION__ to __func__ 2020-03-06 09:23:22 -05:00
zebra_pbr.h zebra: Don't bother ref'ing ifp in zebra_pbr_rule 2019-10-15 15:39:49 -04:00
zebra_ptm_redistribute.c zebra: Add missing c-bit uint8_t 2020-03-17 16:01:59 -04:00
zebra_ptm_redistribute.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_ptm.c *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__ 2020-03-05 20:23:23 +02:00
zebra_ptm.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_pw.c zebra: Embed lib nexthop-group in zebra hash entry 2020-02-27 15:49:31 -05:00
zebra_pw.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_rib.c Merge pull request #5901 from mjstapp/backup_nh_prep 2020-03-30 10:26:17 -04:00
zebra_rnh.c *: remove tabs from log messages 2020-03-24 18:47:12 +01:00
zebra_rnh.h zebra: nht resolution default configurable per vrf 2019-08-28 16:19:34 +02:00
zebra_routemap.c zebra: migrate route map commands to northbound 2020-03-23 07:55:13 -03:00
zebra_routemap.h zebra: Disable rmap update thread before routemap_finish while shutting down zebra 2020-03-16 23:57:45 -07:00
zebra_router.c zebra: free unhashable (dup) NHEs via ID table cleanup 2020-04-02 11:41:25 -04:00
zebra_router.h zebra: implement zebra route map northbound 2020-03-23 07:55:13 -03:00
zebra_snmp.c zebra: Embed lib nexthop-group in zebra hash entry 2020-02-27 15:49:31 -05:00
zebra_vrf.c zebra: Synchronous client queues accumulate messages from zebra. 2020-03-23 09:17:17 -04:00
zebra_vrf.h zebra: separate zebra_vrf_lookup_table_with_id() 2019-11-01 16:06:19 -04:00
zebra_vty.c zebra: include backup info in show ip route 2020-03-27 11:50:03 -04:00
zebra_vxlan_private.h zebra: remove cast from l3vni XMALLOC 2020-01-07 13:54:41 -05:00
zebra_vxlan.c zebra,lib: use const in more apis 2020-03-27 09:37:02 -04:00
zebra_vxlan.h zebra,lib: use const in more apis 2020-03-27 09:37:02 -04:00
zebra.conf.sample *: Remove cvs control points 2017-12-05 17:28:12 -05:00
zserv.c lib, *: add a common time interval formatting api 2020-03-09 11:12:32 -04:00
zserv.h Merge pull request #5925 from volta-networks/synchronous_client 2020-03-26 17:32:37 -03:00