mirror_frr/pimd
Donald Sharp e60308f498 pimd: Fix use after free issue for ifp's moving vrfs
We have this valgrind trace:

==1125== Invalid read of size 4
==1125==    at 0x170A7D: pim_if_delete (pim_iface.c:203)
==1125==    by 0x170C01: pim_if_terminate (pim_iface.c:80)
==1125==    by 0x174F34: pim_instance_terminate (pim_instance.c:68)
==1125==    by 0x17535B: pim_vrf_terminate (pim_instance.c:260)
==1125==    by 0x1941CF: pim_terminate (pimd.c:161)
==1125==    by 0x1B476D: pim_sigint (pim_signals.c:44)
==1125==    by 0x4910C22: frr_sigevent_process (sigevent.c:133)
==1125==    by 0x49220A4: thread_fetch (thread.c:1777)
==1125==    by 0x48DC8E2: frr_run (libfrr.c:1222)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Address 0x6274d28 is 1,192 bytes inside a block of size 1,752 free'd
==1125==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x174FF1: pim_vrf_delete (pim_instance.c:181)
==1125==    by 0x4925480: vrf_delete (vrf.c:264)
==1125==    by 0x4925480: vrf_delete (vrf.c:238)
==1125==    by 0x49332C7: zclient_vrf_delete (zclient.c:2187)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Block was alloc'd at
==1125==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x48E80AF: qcalloc (memory.c:116)
==1125==    by 0x1750DA: pim_instance_init (pim_instance.c:90)
==1125==    by 0x1750DA: pim_vrf_new (pim_instance.c:161)
==1125==    by 0x4924FDC: vrf_get (vrf.c:183)
==1125==    by 0x493334C: zclient_vrf_add (zclient.c:2157)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)

and you do this series of events:

a) Create a vrf, put an interface in it
b) Turn on pim on that interface and turn on pim in that vrf
c) Delete the vrf
d) Do anything with the interface, in this case shutdown the system

The move of the interface to a new vrf is leaving the pim_ifp->pim pointer pointing
at the old pim instance, which was just deleted, so the instance pointer was freed.

Let's clean up the pim pointer in the interface pointer as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-22 18:29:56 -04:00
..
.gitignore pim6d: add skeleton for IPv6 PIM daemon 2022-01-12 18:23:50 +01:00
AUTHORS pimd: Remove unnecessary QuaggaId 2016-12-21 20:26:03 -05:00
CAVEATS pimd: added mtrace caveat 2018-02-27 14:03:39 +01:00
COMMANDS pimd: show ip igmp statistics command 2018-05-04 17:05:19 +02:00
DEBUG pimd: Cleanup the headers. 2017-01-19 10:01:02 -05:00
LINUX_KERNEL_MROUTE_MFC pimd: Remove unnecessary QuaggaId 2016-12-21 20:26:03 -05:00
Makefile build: non-recursive pimd 2017-09-07 16:20:42 +02:00
mtracebis_netlink.c *: manual SPDX License ID conversions 2023-02-09 14:09:07 +01:00
mtracebis_netlink.h *: manual SPDX License ID conversions 2023-02-09 14:09:07 +01:00
mtracebis_routeget.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
mtracebis_routeget.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
mtracebis.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim6_cmd.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim6_cmd.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim6_main.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim6_mld_protocol.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim6_mld.c pim6d: Fix missing parameters in "show ipv6 mld interface" command 2023-02-24 23:58:30 -08:00
pim6_mld.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_addr.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_addr.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_assert.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_assert.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_bfd.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_bfd.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_bsm.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_bsm.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_cmd_common.c pimd,pim6d: Modify pim_neighbor_find() API 2023-02-24 04:40:38 -08:00
pim_cmd_common.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_cmd.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_cmd.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_errors.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_errors.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_hello.c pimd,pim6d: Modify pim_neighbor_find() API 2023-02-24 04:40:38 -08:00
pim_hello.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_iface.c pimd: Prevent crash when pimreg already exists. 2023-03-01 14:56:05 -05:00
pim_iface.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ifchannel.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ifchannel.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp_join.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp_mtrace.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp_mtrace.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp_stats.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp_stats.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmp.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmpv2.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmpv2.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmpv3.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_igmpv3.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_instance.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_instance.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_int.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_int.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_join.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_join.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_jp_agg.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_jp_agg.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_macro.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_macro.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_main.c Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
pim_memory.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_memory.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_mlag.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_mlag.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_mroute.c pimd: Don't start KAT timer when traffic received on PIM disabled interface 2023-02-28 01:45:14 -08:00
pim_mroute.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp_packet.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp_packet.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp_socket.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp_socket.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msdp.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msg.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_msg.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_nb_config.c pimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source connected interface 2023-02-26 22:43:38 -08:00
pim_nb.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_nb.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_neighbor.c pimd,pim6d: Modify pim_neighbor_find() API 2023-02-24 04:40:38 -08:00
pim_neighbor.h pimd,pim6d: Modify pim_neighbor_find() API 2023-02-24 04:40:38 -08:00
pim_nht.c pimd, pim6d: Fix RP Unknown IIF 2023-02-24 04:40:38 -08:00
pim_nht.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_oil.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_oil.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_pim.c pimd,pim6d: Modify pim_neighbor_find() API 2023-02-24 04:40:38 -08:00
pim_pim.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_register.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_register.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_routemap.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_rp.c pimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0 2023-02-28 08:38:50 -08:00
pim_rp.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_rpf.c pimd, pim6d: fix pim neighbor check in pim_nexthop_lookup 2023-02-24 04:40:38 -08:00
pim_rpf.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_signals.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_signals.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_sock.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_sock.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ssm.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ssm.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ssmpingd.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_ssmpingd.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_static.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_static.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_str.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_str.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_tib.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_tib.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_time.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_time.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_tlv.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_tlv.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_upstream.c pimd, pim6d: Fix join prune handling 2023-02-24 04:40:38 -08:00
pim_upstream.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_util.c pimd: IN_MULTICAST needs host order 2023-03-11 19:39:22 -05:00
pim_util.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_vty.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_vty.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_vxlan_instance.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_vxlan.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_vxlan.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_zebra.c pimd: Fix use after free issue for ifp's moving vrfs 2023-03-22 18:29:56 -04:00
pim_zebra.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_zlookup.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_zlookup.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pim_zpthread.c Merge pull request #12780 from opensourcerouting/spdx-license-id 2023-02-17 09:43:05 -05:00
pimd.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
pimd.h *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
README pimd: fix frr url 2020-03-29 17:19:37 -04:00
subdir.am Merge pull request #12196 from opensourcerouting/xref-vtysh 2022-11-03 08:54:09 -04:00
test_igmpv3_join.c *: auto-convert to SPDX License IDs 2023-02-09 14:09:11 +01:00
TODO pimd: Cleanup TODO file 2018-02-26 21:33:02 -05:00
TROUBLESHOOTING pimd: merge pimd as of 2015-01-19 2016-05-25 20:38:32 -04:00

INTRODUCTION

        qpimd aims to implement a PIM (Protocol Independent Multicast)
	daemon for the FRR Routing Suite.

	qpimd implements PIM-SM (Sparse Mode) of RFC 4601.
        Additionally MSDP has been implemented.

	In order to deliver end-to-end multicast routing control
	plane, qpimd includes the router-side of IGMPv[2|3] (RFC 3376).

LICENSE

        qpimd - pimd for FRR
        Copyright (C) 2008 Everton da Silva Marques

        qpimd is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as
        published by the Free Software Foundation; either version 2,
        or (at your option) any later version.

        qpimd is distributed in the hope that it will be useful, but
        WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public
        License along with qpimd; see the file COPYING.  If not, write
        to the Free Software Foundation, Inc., 59 Temple Place - Suite
        330, Boston, MA 02111-1307, USA.

HOME SITE

        qpimd lives at:

        https://github.com/frrouting/frr

PLATFORMS

	qpimd has been tested with Debian Jessie.

REQUIREMENTS

	qpimd requires FRR (2.0 or higher)


CONFIGURATION COMMANDS

	See available commands in the file pimd/COMMANDS.

KNOWN CAVEATS

	See list of known caveats in the file pimd/CAVEATS.

SUPPORT

	Please post comments, questions, patches, bug reports at the
	support site:

        https://frrouting.org/frr

RELATED WORK

	igmprt:	An IGMPv3-router implementation
	- http://www.loria.fr/~lahmadi/igmpv3-router.html

	USC pimd: PIMv2-SM daemon
	- http://netweb.usc.edu/pim/pimd (URL broken in 2008-12-23)
	- http://packages.debian.org/source/sid/pimd (from Debian)

	troglobit pimd: This is the original USC pimd from
	http://netweb.usc.edu/pim/. In January 16, 2010 it was revived
	with the intention to collect patches floating around in
	Debian, Gentoo, Lintrack and other distribution repositories
	and to provide a central point of collaboration.
	- http://github.com/troglobit/pimd

	zpimd: zpimd is not dependent of zebra or any other routing daemon
	- ftp://robur.slu.se/pub/Routing/Zebra
	- http://sunsite2.icm.edu.pl/pub/unix/routing/zpimd

	mrd6: an IPv6 Multicast Router for Linux systems
	- http://fivebits.net/proj/mrd6/

	MBGP: Implementation of RFC 2858 for Quagga
	- git://git.coplanar.net/~balajig/quagga
	- http://www.gossamer-threads.com/lists/quagga/dev/18000

REFERENCES

	IANA Protocol Independent Multicast (PIM) Parameters
	http://www.iana.org/assignments/pim-parameters/pim-parameters.txt

	Address Family Numbers
	http://www.iana.org/assignments/address-family-numbers

                              -- END --