summaryrefslogtreecommitdiff
path: root/pimd/pim_zebra.c
AgeCommit message (Collapse)Author
2023-03-24pimd: Fix use after free issue for ifp's moving vrfsDonald Sharp
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> (cherry picked from commit e60308f498c356227df5dbc6cc04015a3b213f1d)
2022-07-06pim6d: Adjust rpf_addr in pim_zebrasarita patra
In this PR, we are handling the pim_zebra code after rpf_addr modified from prefix to pim_addr. Signed-off-by: sarita patra <saritap@vmware.com>
2022-06-23pimd: Limit pim's ecmp to what zebra tells us is the multipathDonald Sharp
Zebra can be setup to use a value that is less than MULTIPATH_NUM. When pimd connects to zebra, zebra will inform pim about the MULTIPATH_NUM used. Let's use that value for figuring out our multipath value. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-13pimd: Changing PIM_OIF_FLAG_PROTO_IGMP to PIM_OIF_FLAG_PROTO_GMAbhishek N R
Modified marco name so that it can be reused in mld. Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-04-04pimd: fix pim_instance NULL deference in pim_zebra_if_address_addsarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-03-12pim6d: reenable address management codeDavid Lamparter
A few more pieces that should now work reasonably well for IPv6. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12pim6d: rework interface address tracking/selectionDavid Lamparter
We only care about link-local addresses for IPv6 operation. Also, MLD needs the lowest while PIM needs the highest... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12pimd: refactor/split IGMP integrationDavid Lamparter
Try to untangle some spaghetti... This is an 1:1 change that should not result in any functional difference. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-11pim6d: fix some format strings for IPv6David Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-02pim6d: reenable NHT codeDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-26Merge pull request #10400 from opensourcerouting/pim6-compilefixDonald Sharp
pim6d: get running with ipv6 types throughout
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-16pim6d: get into a kinda-working state wrt. zebraDavid Lamparter
Fix up just enough to make us not operate in complete darkness. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16pim6d: drop off IGMP codeDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16pim6d: IPv6-adjust RPF lookupsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust iface primary/DR addrsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust neigh->source_addrDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust various pim_sgaddr usesDavid Lamparter
Since `pim_sgaddr` is `pim_addr` now, that causes a whole lot of fallout anywhere S,G pairs are handled. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17pimd: replace pim_inet4_dump with `%pPAs`David Lamparter
Only pim_sgaddr uses are covered by this since regular in_addr is still used for singular addresses, so only a part of pim_inet4_dump calls are gone with this. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17pimd: move, rename and deploy pim_addr_is_any()David Lamparter
Replaces comparison against INADDR_ANY, so we can do IPv6 too. (Renamed from "pim_is_addr_any" for "pim_addr_*" naming pattern, and type fixed to bool.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17pimd: remove pim_str_sg_dump()David Lamparter
... and replace with `%pSG` printfrr specifier. This actually used a static buffer in the formatting function, so subsequent formatting would overwrite earlier uses. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17pimd: remove pim_str_sg_set()David Lamparter
... and replace with `%pSG` printfrr specifier. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-13Merge pull request #10279 from SaiGomathiN/pim_intfDavid Lamparter
2022-01-12pimd: `prefix_sg` => `pim_sgaddr`David Lamparter
Mostly just 2 sed calls: - `sed -e 's%struct prefix_sg%pim_sgaddr%g'` - `sed -e 's%memset(&sg, 0, sizeof(pim_sgaddr));%memset(\&sg, 0, sizeof(sg));%g'` Plus a bunch of fixing whatever that broke. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-11pimd: Modifying members of pim_interface to accommodate IPv6 changesSai Gomathi
Modifying the members of pim_interface which are to be used for both IPv4 and IPv6 to common names(for both MLD and IGMP). Issues: #10023 Co-authored-by: Mobashshera Rasool <mrasool@vmware.com> Co-authored-by: Sarita Patra <saritap@vmware.com> Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-15Merge pull request #10215 from FRRouting/revert-10164-name_changeStephen Worley
Revert "pimd: Modifying members of pim_interface to accommodate IPv6 changes"
2021-12-14Revert "pimd: Modifying members of pim_interface to accommodate IPv6 changes"David Lamparter
2021-12-03pimd: Modifying name of struct igmp_group to struct gm_group for IPv6.Sai Gomathi
Modifying name of struct igmp_group to struct gm_group, which is to be used by both IPv4 and IPv6(for both MLD and IGMP). Co-authored-by: Mobashshera Rasool <mrasool@vmware.com> Co-authored-by: Sarita Patra <saritap@vmware.com> Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-03pimd: Modifying name of struct igmp_source to struct gm_source for IPv6.Sai Gomathi
Modifying name of struct igmp_source to struct gm_source, which is to be used by both IPv4 and IPv6(for both MLD and IGMP). Co-authored-by: Mobashshera Rasool <mrasool@vmware.com> Co-authored-by: Sarita Patra <saritap@vmware.com> Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-02pimd: Modifying members of pim_interface to accommodate IPv6 changesSai Gomathi
Modifying the members of pim_interface which are to be used for both IPv4 and IPv6 to common names(for both MLD and IGMP). Issue: #10023 Co-authored-by: Mobashshera Rasool <mrasool@vmware.com> Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-11-22Merge pull request #10088 from opensourcerouting/pim-forward-stopDonald Sharp
pimd: fix stale forwarding entries left around after join goes away
2021-11-17pimd: remove some constant parametersDavid Lamparter
ch_del is always true for all callers of ifjoin_to_noinfo. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-16pimd: use correct VRF when processing interface address addIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-05Merge pull request #9900 from SaiGomathiN/sai-pimjoinRuss White
pimd: Change in PIM join and mroute
2021-10-26pimd: modification in mrouteSai Gomathi
Problem: ------- (*,G) created on transit node where same groups are defined as SSM At present FRR has SSM checks for IGMP report, but SSM check is missing for PIM join. Fix: ---- Whenever there is a modification in prefix list for SSM range, then we need to browse the ifchannels (PIM joins) and groups coming in SSM range with (and *,G) should be removed from ifchannel database and also withdraw those routes from upstream routers. Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-10-20*: convert zclient callbacks to tableDavid Lamparter
This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27pimd: fuse source_new() and add_source_by_addr()David Lamparter
This makes a lot more sense semantically (and matches the way groups are handled.) Also allows placing additional restrictions on source creation (e.g. limit on number of sources or ACLs.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27pimd: reformat after dropping indent levelsDavid Lamparter
Intentionally separate here because the previous patch does a whole bunch of "move stuff up 1 level of indentation", and reviewing that is easier when you can use the ignore-whitespace option on diff. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27pimd: IGMP memberships are not querier specificDavid Lamparter
IGMP group/source memberships are a property of the interface; the particular IP address that the querier used to collect the data is irrelevant. ... and IGMP packets get delivered only once to pimd anyway, since we receive them on the "global" per-VRF IGMP socket. (The one in igmp_sock is only used for sending queries.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23pimd: zassert => assertDavid Lamparter
No point in having pimd use zassert() while everything else uses plain assert(). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-10-22pimd: replace inet_ntoaMark Stapp
Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-06-02pimd: Allow mlag to create ifchannelDonald Sharp
When the mlag code was ported upstream the structure of the calls in igmp_source_forward_start had been reset and as a result we missed the call to check that creating an ifchannel when we are DualActive is allowed. Ticket: CM-29941 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-16pimd: fix OIL not removed after IGMP pruneSarita Patra
Issue: Client1------LHR-----(int-1)RP(int-2)------client2 Client2 send IGMP join for group G. Client1 send IGMP join for group G. verify show ip mroute in RP, will have 2 OIL. Client2 send IGMP leave. Verify show ip mroute in RP, will still have 2. Root cause: When RP receives IGMP join from client2, it creates a (s,g) channel oil and add the interface int-2 into oil list and set the flag PIM_OIF_FLAG_PROTO_IGMP to int-2 Client1 send IGMP join, LHR will send a (*,G) join to RP. RP will add the interface int-1 into the oil list of (s,g) channel_oil and will set the flag PIM_OIF_FLAG_PROTO_IGMP and PIM_OIF_FLAG_PROTO_PIM to the int-1 and set PIM_OIF_FLAG_PROTO_PIM to int-2 as well. It is happening because of the pim_upstream_inherited_olist_decide() and forward_on() get all the oil and update the flag wrongly. So now when client 2 sends IGMP prune, RP will not remove the int-2 from oil list since both PIM_OIF_FLAG_PROTO_PIM & PIM_OIF_FLAG_PROTO_IGMP are set, it just unset the flag PIM_OIF_FLAG_PROTO_IGMP. Fix: Introduced new flags in if_channel, PIM_IF_FLAG_MASK_PROTO_PIM & PIM_IF_FLAG_MASK_PROTO_IGMP. If a if_channel is created because of pim join or pim (s,g,rpt) prune received, then set the flag PIM_IF_FLAG_MASK_PROTO_PIM. If a if_channel is created becuase of IGMP join received, then set the flag PIM_IF_FLAG_MASK_PROTO_IGMP. When an interface needs to be added into the oil list check if PIM_IF_FLAG_MASK_PROTO_PIM or PIM_IF_FLAG_MASK_PROTO_IGMP is set, then update oil flag accordingly. Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-06*: Finish off the __PRETTY_FUNCTION__ to __func__Donald Sharp
FINISH IT 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>
2020-02-14pimd: stop overloading SRC_IGMP upstream for vxlan local membershipAnuradha Karuppiah
A local membership is created on the vxlan termination device ipmr-lo. This is done to - 1. Pull multicast vxlan tunnel traffic to the VTEP for termination by triggering JoinDesired on the BUM multicast group. 2. Include the OIF in the mroute to signal to the dataplane component that flow needs to be vxlan terminated. Earlier we were overloading the PIM_UPSTREAM_FLAG_MASK_SRC_IGMP for this local membership creation but that is creating confusion both in the state machine and in the show outputs. To avoid that we use the more apparent PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM. With this change - 1. We get LHR functionality for VXLAN_TERM mroutes 2. OIF is populated with PIM_OIF_FLAG_PROTO_PIM only Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-02-14pim: DF election for tunnel termination mroutes in an anycast-VTEP setupAnuradha Karuppiah
1. Upstream entries associated with tunnel termination mroutes are synced to the MLAG peer via the local MLAG daemon. 2. These entries are installed in the peer switch (via an upstream ref flag). 3. DF (Designated Forwarder) election is run per-upstream entry by both the MLAG switches - a. The switch with the lowest RPF cost is the DF winner b. If both switches have the same RPF cost the MLAG role is used as a tie breaker with the MLAG primary becoming the DF winner. 4. The DF winner terminates the multicast traffic by adding the tunnel termination device to the OIL. The non-DF suppresses the termination device from the OIL. Note: Before the PIM-MLAG interface was available hidden config was used to test the EVPN-PIM functionality with MLAG. I have removed the code to persist that config to avoid confusion. The hidden commands are still available. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-01-03pimd: Convert the channel_oil_list|hash to a rb_treeDonald Sharp
The channel_oil_list and hash are taking significant cpu at scale when adding to the sorted list. Replace with a RB_TREE. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-06Merge pull request #5355 from AnuradhaKaruppiah/pim-state-machine-fixesJafar Al-Gharaibeh
PIM state machine fixes