summaryrefslogtreecommitdiff
path: root/pimd/pim_instance.c
AgeCommit message (Collapse)Author
2021-08-27Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter
lib: remove unused argument from vrf_cmd_init
2021-08-26lib: remove unused argument from vrf_cmd_initIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-07-01pimd: support MSDP global timers configurationRafael Zalamena
Users can now configure: * Hold time * Keep alive * Connection retry Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-05-12pimd: Remove pim->vrf_id and use pim->vrf->vrf_idDonald Sharp
VRF creation can happen from either cli or from knowledged about the vrf learned from zebra. In the case where we learn about the vrf from the cli, the vrf id is UNKNOWN. Upon actual creation of the vrf, lib/vrf.c touches up the vrf_id and calls pim_vrf_enable to turn it on properly. At this point in time we have a pim->vrf_id of UNKNOWN and the vrf->vrf_id of the right value. There is no point in duplicating this data. So just remove all pim->vrf_id and use the vrf->vrf_id instead since we keep a copy of the pim->vrf pointer. This will remove some crashes where we expect the pim->vrf_id to be usable and it's not. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12pimd: There exists a path where on vrf bringup we do not create the pimregDonald Sharp
When creating configuration for a vrf *Before* the vrf has been created, pim will not properly create the pimreg device and we will promptly crash when we try to pass data. Put some code checks in place to ensure that the pimreg is created for vrf's. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-26pimd: Prevent use after freeDonald Sharp
Valgrind is reporting this: ==22220== Invalid read of size 4 ==22220== at 0x11DC2B: pim_if_delete (pim_iface.c:215) ==22220== by 0x11DD71: pim_if_terminate (pim_iface.c:76) ==22220== by 0x128E03: pim_instance_terminate (pim_instance.c:66) ==22220== by 0x128E03: pim_vrf_delete (pim_instance.c:159) ==22220== by 0x48E0010: vrf_delete (vrf.c:251) ==22220== by 0x48E0010: vrf_delete (vrf.c:225) ==22220== by 0x48E02FE: vrf_terminate (vrf.c:551) ==22220== by 0x149495: pim_terminate (pimd.c:142) ==22220== by 0x13C61B: pim_sigint (pim_signals.c:44) ==22220== by 0x48CF862: quagga_sigevent_process (sigevent.c:103) ==22220== by 0x48DD324: thread_fetch (thread.c:1404) ==22220== by 0x48A926A: frr_run (libfrr.c:1122) ==22220== by 0x11B85E: main (pim_main.c:167) ==22220== Address 0x5912160 is 1,200 bytes inside a block of size 1,624 free'd ==22220== at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==22220== by 0x128E52: pim_instance_terminate (pim_instance.c:74) ==22220== by 0x128E52: pim_vrf_delete (pim_instance.c:159) ==22220== by 0x48E0010: vrf_delete (vrf.c:251) ==22220== by 0x48E0010: vrf_delete (vrf.c:225) ==22220== by 0x48F1353: zclient_vrf_delete (zclient.c:1896) ==22220== by 0x48F1353: zclient_read (zclient.c:3511) ==22220== by 0x48DD826: thread_call (thread.c:1585) ==22220== by 0x48A925F: frr_run (libfrr.c:1123) ==22220== by 0x11B85E: main (pim_main.c:167) ==22220== Block was alloc'd at ==22220== at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==22220== by 0x48ADA4F: qcalloc (memory.c:110) ==22220== by 0x128B9B: pim_instance_init (pim_instance.c:82) ==22220== by 0x128B9B: pim_vrf_new (pim_instance.c:142) ==22220== by 0x48E0C5A: vrf_get (vrf.c:217) ==22220== by 0x48F13C9: zclient_vrf_add (zclient.c:1863) ==22220== by 0x48F13C9: zclient_read (zclient.c:3508) ==22220== by 0x48DD826: thread_call (thread.c:1585) ==22220== by 0x48A925F: frr_run (libfrr.c:1123) ==22220== by 0x11B85E: main (pim_main.c:167) On pim vrf deletion, ensure that the vrf->info pointers are NULL as well as the free'd pim pointer for ->vrf is NULL as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-04-20*: sprintf -> snprintfQuentin Young
Replace sprintf with snprintf where straightforward to do so. - sprintf's into local scope buffers of known size are replaced with the equivalent snprintf call - snprintf's into local scope buffers of known size that use the buffer size expression now use sizeof(buffer) - sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp buffer followed by strlcat Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-03-23Merge pull request #6008 from sarav511/max_vifDonald Sharp
pimd: Do not allow to configure multicast on more than MAXVIF interfaces
2020-03-16pimd: Do not allow to configure multicast on more than MAXVIF interfacessaravanank
RCA: When configured more than 32(MAXVIS), the inerfaces that are configured after 32nd interfaces have the value of MAXVIF. This is used as index to access the free vif tracker of array size 32(MAXVIFS). So the channel oil list pointer which is present as the next field in pim structure get corrupt, when updating free vif. This gets accessed during rpf update resulting in crash. Fix: Refrain from allocating mcast interface structure and throw config error when more than MAXVIFS are attempted to configure. Max vif checks are exempted for vrf device and pimreg as vrf device will be the first interface and not expected to fail and pimreg has reserved vif. vxlan tunnel termination device creation has this check and throw warning on max vif. All other creation are through CLI. Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-06pimd: Add `ip pim register-accept-list PLIST` commandDonald Sharp
When pim receives a register packet, we will apply the received source to the prefix list. If accepted normal processing continues. If denied we will send a register stop message to the source. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06pimd: Rename the PIM_SPT_PLIST_NAME to PIM_PLIST_NAMEDonald Sharp
The memory type PIM_SPT_PLIST_NAME is specific to SPT but we are going to store more prefix-list names in pim, make it generic to allow for less confusion in the future. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06pimd: the spt infinity prefix-list memory was not being freedDonald Sharp
On shutdown the string storing the prefix-list was not being properly freed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-11-13pimd : Add support for MLAG Register & Un-registerSatheesh Kumar K
when ever a FRR Client wants to send any data to another node using MLAG Channel, uses below mechanisam. 1. sends a MLAG Registration to zebra with interested messages that it is intended to receive from peer. 2. In response to this request, Zebra opens communication channel with MLAG. and also in Rx. diretion zebra forwards only those messages which client shown interest during registration 3. when client is no-longer interested in communicating with MLAG, client posts De-register to Zebra 4. if this is the last client which is interested for MLAG Communication, zebra closes the channel. why PIM Needs MLAG Communication ================================ 1. In general on LAN Networks elecetd DR will send the Join towards Multicast RP in case of a LHR and Register in case of FHR. 2. But in case DR Goes down, traffic will be re-converged only after the New DR is elected, but this can take time based on Hold Timer to detect the DR down. 3. this can be optimised by using MLAG Mecganisam. 4. and also Traffic can be forwarded more efficiently by knowing the cost towards RP using MLAG Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-10-14Revert "Merge pull request #4885 from satheeshkarra/pim_mlag"Quentin Young
This reverts commit d563896dada99f3474d428f928786cbfde936fee, reversing changes made to 09ea1a40386f02a13cdb0462cc55af0d03f0c277.
2019-09-16pimd : Add support for MLAG Register & Un-registerSatheesh Kumar K
when ever a FRR Client wants to send any data to another node using MLAG Channel, uses below mechanisam. 1. sends a MLAG Registration to zebra with interested messages that it is intended to receive from peer. 2. In response to this request, Zebra opens communication channel with MLAG. and also in Rx. diretion zebra forwards only those messages which client shown interest during registration 3. when client is no-longer interested in communicating with MLAG, client posts De-register to Zebra 4. if this is the last client which is interested for MLAG Communication, zebra closes the channel. why PIM Needs MLAG Communication ================================ 1. In general on LAN Networks elecetd DR will send the Join towards Multicast RP in case of a LHR and Register in case of FHR. 2. But in case DR Goes down, traffic will be re-converged only after the New DR is elected, but this can take time based on Hold Timer to detect the DR down. 3. this can be optimised by using MLAG Mecganisam. 4. and also Traffic can be forwarded more efficiently by knowing the cost towards RP using MLAG Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-05-14pimd: PIM BSM Processing datastructure definition/initialization/deinitsaravanank
Apart from datastructure, bsm scope initialization and deinitialiation routines called during pim instance init and deinit. Also makefile changes. Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-04-21pim: fix order of vxlan mroutes cleanup when pimd is shutdownAnuradha Karuppiah
1. vxlan instance cleanup needs to be done before the upstream entries are force-flushed. 2. also vxlan callbacks need to be ignored post instance-cleanup. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20pimd: initial infrastructure to maintain VxLAN SG databaseAnuradha Karuppiah
These entries will be used over the subsequent commits for 1. vxlan-tunnel-termination handling - setup MDT to rx VxLAN encapsulated BUM traffic. 2. vxlan-tunnel-origination handling - register local-vtep-ip as a multicast source. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-04pimd: Remove pimgDonald Sharp
The pimg data structure is only used in one spot to send the default vrf id to zebra upon startup. Add the default vrf id to the struct pim_router data structure and remove the pimg pointer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04pimd: Create a `struct pim_router` and move thread master into itDonald Sharp
Create a `struct pim_router` and move the thread master into it. Future commits will further move global varaibles into the pim_router structure. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-23vtysh: fix exit-vrf printingQuentin Young
Resolves issue with exit-vrf being placed at the end of zebra's portion of a vrf block, but before other daemons' portions of the same config block. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-02*: list_delete_and_null() -> list_delete()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-24pimd: Fix several address sanitizer issuesDonald Sharp
This commit fixes two issues during pim shutdown. 1) The rp_info structure was being freed before the outgoing notifications that depended on it's information was sent out as part of shutdown. 2) The pim->upstream_list shutdown involved iterating over the list via ALL_LIST_ELEMENTS. This typically is enough but pim will auto delete child nodes as well as itself when it goes away and they depend on it. As such the node and nnode could possibly already have been freed. So change the way we look at all the data in the upstream_list Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-28*: add a vrf update hook to be informed of the vrf namePhilippe Guibert
The Vrf aliases can be known with a specific hook. That hook will then, from zebra propagate the information to the relevant zapi clients. The registration hook function is the same for all daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-14pimd: Convert over to use LIB_ERR_XXX for zlog_errDonald Sharp
Convert, where appropriate, the zlog_err functions to zlog_ferr for the LIB_ERR_XXX enums Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-02pimd: Fix crash on shutdown in oilDonald Sharp
When shutting down, do not free oil information after interface information since we use the data there to do so. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-08pimd: Remove unnecessary alloc failuresDonald Sharp
Remove from pim unnecessary alloc failure testing as that alloc failure will cause an assert. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-07pimd: Fix ecmp_enable and ecmp_rebalance_enableDonald Sharp
These commands were being accepted in all vrf's and affecting all vrf's behavior globally, since they were global variables. Modify the code to make these two commands work on a per-vrf basis. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-11pimd: Clean up rpf_hash *after* upstream cleanupDonald Sharp
Cleanup the pim->rpf_hash after upstream cleanup is done since upstream cleanup uses the rpf_hash to cleanup itself. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-17pimd: Move some data tracking variables per VRFDonald Sharp
There were a few more global variables that needed to be per vrf. So move them over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-13lib: privileges are granted to vty netns commandPhilippe Guibert
Vty commands that link netns context to a vrf is requiring some privileges. The change consists in retrieving the privileges at the vrf_cmd_init() called by the relevant daemon. Then use it. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-01-30lib, pimd: Remove PIM_NODE as it is not neededDonald Sharp
The PIM_NODE command is only being used to display default vrf configuration. Move this into the vrf display and remove PIM_NODE. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-22pim: fix compilation issue with pimPhilippe Guibert
The change of vrf_id_t from 16 bit to 32 bit needs some changes in pim daemon. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-10-05*: Convert list_delete(struct list *) to ** to allow nullingDonald Sharp
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-09-15*: use clang's 'ForEachMacros' format style optionRenato Westphal
This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-05pimd: Add usage of vty_frame for vrf configurationDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24pimd: Cleanup a variety of SA issuesDonald Sharp
1) Error check return from setsockopt and sockets 2) Check return codes for str2prefix 3) Clean up some potential NULL References Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-02pimd: Squash some more memory leaksDonald Sharp
When a interface is flapped we were leaking some memory associated with link lists. Especially in the jp_agg code. If your network was/is stable and you are not running at any scale you probably would not see this as impactful at all. Ticket: CM-16392 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-28pimd: Allow the keepalive time to be per vrf.Donald Sharp
Allow the keepalive period to be per vrf. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-25pimd: Setup hash names appropriatelyDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Put 'struct pim_instance *' as the first function parameterDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Cleanup shutdown of vrfDonald Sharp
When shutting down the vrf don't kill the default vrf when attempting to cleanup something else. Also move the terminate to the right spot. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Fix instance startup to separate data structure setup from useDonald Sharp
Fix the instance startup to allow separation between the data structure setup for pim instances from actual attempt to use. More than likely there will be other issues that need to be fixed but this gets us 'working' again. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Get show run to display vrf sub modeDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Fix startup of pim instance a bitDonald Sharp
We will need to refine the difference between create and enable of a pim instance. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Make pim_ssmpingd.c 'struct pim_instance' awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24pimd: Make pim MSDP pim instance aware to some extentDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>