mirror_frr/zebra
Stephen Worley c7c0b007a4 zebra: separate zebra_vrf_lookup_table_with_id()
We were creating `other` tables in rib_del(), vty commands, and
dataplane return callback via the zebra_vrf_table_with_table_id()
API.

Seperate the API into only a lookup, never create
and added another with `get` in the name (following the standard
we use in other table APIs).

Then changed the rib_del(), rib_find_rn_from_ctx(), and show route
summary vty command to use the lookup API instead.

This was found via a crash where two different vrfs though they owned
the table. On delete, one free'd all the nodes, and then the other tried
to use them. It required specific timing of a VRF existing, going away,
and coming back again to cause the crash.

=23464== Invalid read of size 8
==23464==    at 0x179EA4: rib_dest_from_rnode (rib.h:433)
==23464==    by 0x17ACB1: zebra_vrf_delete (zebra_vrf.c:253)
==23464==    by 0x48F3D45: vrf_delete (vrf.c:243)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==    by 0x13D8C5: sigint (main.c:172)
==23464==    by 0x48DD25C: quagga_sigevent_process (sigevent.c:105)
==23464==    by 0x48F0502: thread_fetch (thread.c:1417)
==23464==    by 0x48AC82B: frr_run (libfrr.c:1023)
==23464==    by 0x13DD02: main (main.c:483)
==23464==  Address 0x5152788 is 104 bytes inside a block of size 112 free'd
==23464==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B25B8: qfree (memory.c:129)
==23464==    by 0x48EA335: route_node_destroy (table.c:500)
==23464==    by 0x48E967F: route_node_free (table.c:90)
==23464==    by 0x48E9742: route_table_free (table.c:124)
==23464==    by 0x48E9599: route_table_finish (table.c:60)
==23464==    by 0x170CEA: zebra_router_free_table (zebra_router.c:165)
==23464==    by 0x170DB4: zebra_router_release_table (zebra_router.c:188)
==23464==    by 0x17AAD2: zebra_vrf_disable (zebra_vrf.c:222)
==23464==    by 0x48F3F0C: vrf_disable (vrf.c:313)
==23464==    by 0x48F3CCF: vrf_delete (vrf.c:223)
==23464==    by 0x48F4468: vrf_terminate (vrf.c:532)
==23464==  Block was alloc'd at
==23464==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==23464==    by 0x48B24A2: qcalloc (memory.c:110)
==23464==    by 0x48EA2FE: route_node_create (table.c:488)
==23464==    by 0x48E95C7: route_node_new (table.c:66)
==23464==    by 0x48E95E5: route_node_set (table.c:75)
==23464==    by 0x48E9EA9: route_node_get (table.c:326)
==23464==    by 0x48E1EDB: srcdest_rnode_get (srcdest_table.c:244)
==23464==    by 0x16EA4B: rib_add_multipath (zebra_rib.c:2730)
==23464==    by 0x1A5310: zread_route_add (zapi_msg.c:1592)
==23464==    by 0x1A7B8E: zserv_handle_commands (zapi_msg.c:2579)
==23464==    by 0x19D689: zserv_process_messages (zserv.c:523)
==23464==    by 0x48F09F8: thread_call (thread.c:1599)

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-11-01 16:06:19 -04:00
..
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
connected.c Merge pull request #4897 from sworleys/zebra_nhg_add 2019-10-28 13:07:23 +01:00
connected.h zebra: Do not use connection dest for bcast 2019-08-18 18:54:46 +02:00
debug.c zebra: Add detailed debugging command for NHT tracking 2019-03-27 16:22:22 -04:00
debug.h zebra: Add detailed debugging command for NHT tracking 2019-03-27 16:22:22 -04: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 zebra: Move the supports_nh bool to a better place 2019-10-25 11:13:41 -04: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 zebra: Re-work zebra_nhg_*_valid APIs 2019-10-25 11:13:44 -04:00
interface.h zebra: Cleanup zebra_nhg APIs 2019-10-25 11:13:44 -04: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 *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ipforward_solaris.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
ipforward_sysctl.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +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 *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02:00
irdp_packet.c zebra: remove bs irdp error code 2019-07-03 00:27:14 +00:00
irdp.h *: strip trailing whitespace 2019-09-30 16:44:43 +00:00
kernel_netlink.c zebra: Don't error on nexthop object support check 2019-10-25 11:13:40 -04:00
kernel_netlink.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
kernel_socket.c zebra: Use nexthop object id on route delete 2019-10-25 11:13:42 -04:00
kernel_socket.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
label_manager.c zebra: Guard debug messages 2019-07-16 20:30:55 -04:00
label_manager.h zebra: label manager refactor 2019-07-10 15:20:27 +02:00
main.c zebra: Remove cleanup and nhg workqueue boilerplate 2019-10-25 11:13:43 -04:00
Makefile build: convert zebra/ to non-recursive build 2017-07-31 23:03:30 +02:00
redistribute.c zebra: separate zebra_vrf_lookup_table_with_id() 2019-11-01 16:06:19 -04:00
redistribute.h zebra: revise redistribution delete to improve update case 2019-09-12 08:51:05 -04:00
rib.h zebra: Use nexthop object id on route delete 2019-10-25 11:13:42 -04:00
router-id.c Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
router-id.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
rt_netlink.c zebra: Fix some nhg SA issues found in latest Coverity 2019-10-28 20:30:06 -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: Add bsd nexthop install boilerplate 2019-10-25 11:13:43 -04:00
rt.h zebra: Add base functionality for nexthop processing via the dataplane 2019-10-25 11:13:36 -04:00
rtadv.c *: strip trailing whitespace 2019-09-30 16:44:43 +00:00
rtadv.h zebra: move rtadv service from zrouter to zvrf 2019-06-04 18:33:53 +02:00
rtread_getmsg.c zebra: Update rib_add to take a nexthop ID 2019-10-25 11:13:37 -04: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 zebra: Don't bother ref'ing ifp in zebra_pbr_rule 2019-10-15 15:39:49 -04:00
rule_netlink.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
rule_socket.c zebra: Create zebra_dplane.c and .h 2018-09-19 18:29:55 -04:00
subdir.am zebra: Cleanup zebra_nhg APIs 2019-10-25 11:13:44 -04: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 zebra: Build the test client, can be useful, and add IPv6 to testrib.conf 2016-05-26 01:13:58 +00:00
zapi_msg.c lib,pbrd,zebra: Use one api to delete nexthops/group 2019-10-25 11:13:43 -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: Fallback to default ns if nhg vrf lookup fails 2019-10-25 11:13:43 -04:00
zebra_dplane.h zebra: Sweep our nexthop objects out on restart 2019-10-25 11:13:41 -04:00
zebra_errors.c zebra: Error if the ifp lookup fails for an NHE 2019-10-25 11:13:40 -04:00
zebra_errors.h zebra: Error if the ifp lookup fails for an NHE 2019-10-25 11:13:40 -04:00
zebra_fpm_dt.c zebra: Remove nexthop_active_num from route entry 2019-10-25 11:13:36 -04:00
zebra_fpm_netlink.c zebra: Replace nexthop_group with pointer in route entry 2019-10-25 11:13:36 -04: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: Replace nexthop_group with pointer in route entry 2019-10-25 11:13:36 -04:00
zebra_fpm.c Zebra: Rectifying the log messages. 2019-09-19 02:59:04 -07: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.c Revert "Merge pull request #4885 from satheeshkarra/pim_mlag" 2019-10-14 17:15:09 +00:00
zebra_mlag.h Revert "Merge pull request #4885 from satheeshkarra/pim_mlag" 2019-10-14 17:15:09 +00: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 *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +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: Use ng pointer in mpls_ftn_uninstall 2019-10-25 11:13:43 -04:00
zebra_mpls.h lib, zebra: add new MPLS zapi message with route replace semantics 2019-09-10 00:01:10 -03: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: Cleanup zebra_nhg APIs 2019-10-25 11:13:44 -04:00
zebra_nhg.c zebra: Fix some nhg SA issues found in latest Coverity 2019-10-28 20:30:06 -04:00
zebra_nhg.h zebra: Cleanup zebra_nhg APIs 2019-10-25 11:13:44 -04:00
zebra_ns.c *: frr_elevate_privs -> frr_with_privs 2019-09-03 17:18:35 +02: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 zebra: Don't bother ref'ing ifp in zebra_pbr_rule 2019-10-15 15:39:49 -04: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: Remove zclient->idinfo restrictions 2019-02-05 09:13:30 -05:00
zebra_ptm_redistribute.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_ptm.c Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
zebra_ptm.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_pw.c zebra: Replace nexthop_group with pointer in route entry 2019-10-25 11:13:36 -04:00
zebra_pw.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_rib.c zebra: separate zebra_vrf_lookup_table_with_id() 2019-11-01 16:06:19 -04:00
zebra_rnh.c lib,pbrd,zebra: Use one api to delete nexthops/group 2019-10-25 11:13:43 -04:00
zebra_rnh.h zebra: nht resolution default configurable per vrf 2019-08-28 16:19:34 +02:00
zebra_routemap.c lib: rmap dep table is not correct in case of exact-match clause 2019-09-15 05:45:27 -07:00
zebra_routemap.h add cplusplus guards to all zebra headers 2019-03-25 16:05:27 +01:00
zebra_router.c zebra: Cleanup zebra_nhg APIs 2019-10-25 11:13:44 -04:00
zebra_router.h zebra: Sweep our nexthop objects out on restart 2019-10-25 11:13:41 -04:00
zebra_snmp.c zebra: Update snmp code to use nexthop pointer 2019-10-25 11:13:40 -04:00
zebra_vrf.c zebra: separate zebra_vrf_lookup_table_with_id() 2019-11-01 16:06:19 -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: separate zebra_vrf_lookup_table_with_id() 2019-11-01 16:06:19 -04:00
zebra_vxlan_private.h Zebra: Handle RMAC add/delete operation and add fpm_mac_info_t 2019-06-17 12:05:38 -07:00
zebra_vxlan.c zebra: zvni_map_to_svi may return NULL act accordingly 2019-10-28 20:52:40 -04:00
zebra_vxlan.h zebra: use dataplane for vxlan remote mac programming 2019-08-02 14:54:16 -04:00
zebra.conf.sample *: Remove cvs control points 2017-12-05 17:28:12 -05:00
zserv.c lib, zebra: Fix last write command written 2019-10-15 14:54:35 -04:00
zserv.h Revert "Merge pull request #4885 from satheeshkarra/pim_mlag" 2019-10-14 17:15:09 +00:00