Commit Graph

92 Commits

Author SHA1 Message Date
Donald Sharp
42f5ab16ec pimd: Fix old commit that got in
An old fix that used THREAD_OFF was pushed in, should
have used EVENT_OFF instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-02 14:49:32 -04:00
Sai Gomathi N
1c883aef96 pimd: PIM not sending register packets after changing from non DR to DR
When the router is non dr for an interface, it installs mroute to drop
the packets from directly connected source. This was done to avoid packets
coming to cpu as nocache hit. Later when it gets change from non-DR to DR,
these entries are not cleared. So the packets are still dropped.
This causes register packets not getting generated.
So cleaning up the mroute entries and channel oil without
upstream reference which was created to drop.

Co-authored-by: Saravanan K <saravanank@vmware.com>
Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2023-03-17 03:51:16 -07:00
David Lamparter
acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Sarita Patra
a5a221bf34 pimd: Fix (S,G) debug issue
Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-12-16 03:05:37 -08:00
Mobashshera Rasool
692b118698 pimd: Fix the setting of oif_flags in channel oil
When pim_upstream_inherited_olist_decide calls the api
pim_channel_add_oif, it can pass PIM_OIF_FLAG_PROTO_GM,
PIM_OIF_FLAG_PROTO_PIM and/or PIM_OIF_FLAG_PROTO_STAR.
Now a consider a case where PIM flag was already set
but STAR flag was not set and this api tries to set
both STAR + PIM and passes the same. The api pim_channel_add_oif
returns since it sees that PIM is already set without
setting the STAR flag.

So basically this will lead to issues in scenarios where for the
same OIF multiple flags(IGMP, PIM, STAR) needs to be set.

Fixing it for all combinations.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-06-15 00:55:55 -07:00
Donald Sharp
aa0bb312b1 pimd: Fixup oil_if_has and oil_if_set to be consistent
the v4 and v6 versions were different.  Make them the same.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-09 09:37:33 -04:00
Donald Sharp
30b82c7af7 pimd: Fix pim_channel_oil_empty tests
The pim_channel_oil_empty() function was setting
the pimreg if it ever existed for NULL comparison
but of course the pimreg device is never pulled back
out again when it was needed to be when the pimreg
is not present.

Commit: a5fa982256
broke this.

Fixes: #11368
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-09 09:36:11 -04:00
plsaranya
a5fa982256 pim6d: Mroute changes
Mroute and supporting changes

Signed-off-by: plsaranya <Saranya_Panjarathina@dell.com>
2022-03-23 19:34:28 +05:30
David Lamparter
d6890c49b2 pimd: add safety check to OIL add/del
These will corrupt memory if mroute_vif_index is -1 (e.g. interface not
operating.)  That shouldn't happen, but it does while doing development
work, so trip an assert rather than corrupting memory.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12 22:47:08 +01:00
David Lamparter
a9338fa449 pim6d: IPv6-adjust mroute code
This is just hitting the pim_mroute code with a hammer until it doesn't
print warnings anymore.  This is NOT quite tested or working yet, it
just compiles.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16 16:40:56 +01:00
David Lamparter
2a27f13b21 pimd: move, rename and deploy pim_addr_is_any()
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-17 14:03:26 +01:00
David Lamparter
98a81d2bff pimd: remove pim_str_sg_dump()
... 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-17 14:02:18 +01:00
David Lamparter
6fff2cc620 pimd: prefix_sg => pim_sgaddr
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-12 18:24:25 +01:00
David Lamparter
d51f8b0f1e pimd: move %pSG4 to %pPSG4
Since this is only used in very few places, moving it out of the way is
reasonable.  (`%pSG` will be pim_sgaddr)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-12 18:24:07 +01:00
Donald Sharp
dd4a4b5697 pimd: Cleanup weird indentation
The zlog_warn used to be bounded by a debug guard
but the debug guard was removed but the code was
never fixed up to remove the open and close paranthesis.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-08 07:11:07 -05:00
Donald Sharp
8c70a46b65 pimd: Fix rare crash situation
When running pim on an interface and that interface has
state and we move that interface into a different vrf
there exists a call path where we have not created the pimreg
device yet.  Prevent a crash in this rare situation.

Ticket: #2552763
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-19 14:48:11 -04:00
David Lamparter
df5dfb77b5 pimd: zassert => assert
No point in having pimd use zassert() while everything else uses plain
assert().

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-04-23 12:25:47 +02:00
Donald Sharp
df94b33a6e pimd: Fix missing code
Found some more missing code that got dropped during the
upstreaming process causing issues with things actually
working.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-06-03 13:05:41 -04:00
Anuradha Karuppiah
b900ad16ee pimd: logs to help debug leaked channel OIF problems
Additional protocols were being set on the OIF proto-mask without
logs. Added logs in that area.

Also added start and end logs to ifchannel_delete to help
identify state machine changes that play out as a part of this
event handling.

Ticket: CM-26732

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-06 16:12:25 -05:00
Donald Sharp
17823cdd2c pimd: Add accidently missed code during upstreaming process
There was some code missed during the upstreaming process
due to code squash.  Identify and put into a commit
to keep code consistent and correct.

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:02:52 -05:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Donald Sharp
dd3364cb1a pimd: Convert the upstream_list and hash to a rb tree
Convert the upstream_list and hash to a rb tree, Significant
time was being spent in the listnode_add_sort.  This reduces
this time greatly.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-01-03 08:39:55 -05:00
Donald Sharp
7315ecdabe pimd: Convert the channel_oil_list|hash to a rb_tree
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>
2020-01-03 08:39:55 -05:00
Anuradha Karuppiah
9e558d9ac8 pimd: exclude pimreg from the inherited OIL
Inherited OIL is used as a part of the JoinDesired macro. And in FRR we
use the channel OIL as the inherited OIL (to reduce processing overhead
everytime JD needs to be re-evaluated). On a FHR pimreg is a part of the
channel-OIL but must not be used for JD computation.

This commit blacklists pimreg from the inherited_oil i.e. present but
ignored.

Note: This fixup is being done to address topotest failures.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-19 10:47:01 -08:00
Anuradha Karuppiah
60eb7e6b80 pimd: enforce PIM_ENFORCE_LOOPFREE_MFC at the time of MFC programming
This is needed for two reasons -
1. The inherited OIL needs to be setup independent of the RPF interface
to allow correct computation of the JoinDesired macro.
2. The RPF interface is computed at the time of MFC programming so
it is not possible to permanently evict the OIF at that time oif_add

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 14:16:08 -08:00
Anuradha Karuppiah
1537a66871 pimd: re-eval JD on sources when a STAR_OIF is removed
When a inherited OIL becomes empty join-desired can go to false. So
we need to re-run join-desired evaluation on any inherited OIL changes.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 14:16:08 -08:00
Anuradha Karuppiah
d86632fba3 pimd: fixup pim_channel_oil_empty macro
The macro was always returning non-empty because of comparing an
array of u8_t with an array of u32_t.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 14:16:08 -08:00
Anuradha Karuppiah
7984af1840 pimd: set mfcc_parent at the time of MFCC programming
mfcc_parent for an (S, G) entry was being updated on any upstream RPF
change. With the change to use RPT for (S,G) in some cases we can no
longer do that. Instead the upstream entry's RPF neigbor is managed
separately form the channel_oil's mfcc_parent i.e. via NHT. And the
mfcc_parent is evaluated at the time of mroute programming.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 12:00:29 -08:00
Anuradha Karuppiah
69e3538cd8 pimd: decide between SPT based and RPT based forwarding
An (S,G) mroute can be created as a result of rpt prune. However that
entry needs to stay on the parent (*,G)'s tree (IIF) till a decision is
made to switch the source to the SPT.

The decision to stay on the RPT is made based on the SPTbit setting
according to - RFC7761, Section 4.2 “Data Packet Forwarding Rules”

However those rules are hard to achieve when hw acceleration i.e.
control and data planes are separate. So instead of relying on data
we make the decision of using SPT if we have decided to join the SPT -
Use_RPT(S,G) {
    if (Joined(S,G) == TRUE          // we have decided to join the SPT
            OR Directly_Connected(S) == TRUE // source is directly connected
            OR I_am_RP(G) == TRUE)   // RP
        //use_spt
        return FALSE;
    //use_rpt
    return TRUE;
}

To make that change some re-org was needed -
1. pim static mroutes and dynamic (upstream mroutes) top level APIs
have been separated. This is to limit the state machine to dynamic
mroutes.
2. c_oil->oil.mfcc_parent is re-evaluated based on if we decided
to use the SPT or stay on the RPT.
3. upstream mroute re-eval is done when any of the criteria involved
in Use_RPT changes.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 12:00:29 -08:00
Anuradha Karuppiah
a155fed53c pimd: re-eval c_oil mute flags on upstream attach/detach
Theoretically there should be no case where the channel-oil hangs
around after the upstream entry is removed. But currently there are
cases where it does. This is a precautionary fixup till we are
rid off all of those cases.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 10:05:06 -08:00
Anuradha Karuppiah
5923b7396e pimd: MUTE flag to suppress traffic forwarding on non-DF
If an mroute loses DF election (with the MLAG peer) it has to stop
forwarding traffic on active-active devices such as ipmr-lo used
for vxlan traffic termination. To acheive that this commit
introduces a concept of OIF muting. That way we can let the PIM and
IGMP state machines play out and silence OIFs after the fact.

Relevant outputs:
=================
1. muted OIFs are displayed with the M flag in "pim state" -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@TORC12:~# net show pim state |grep "27.0.0.13"|grep 100
1         27.0.0.13        239.1.1.100      uplink-1          ipmr-lo(   *M)
root@TORC12:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2. And supressed altogether in the mroute output -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@TORC12:~# net show mroute |grep "27.0.0.13"|grep 100
27.0.0.13       239.1.1.100     none   uplink-1         none             0    --:--:--
root@TORC12:~#
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 09:16:15 -08:00
Anuradha Karuppiah
1b249e7097 pimd: update add_oif and del_oif debugs to print caller
These logs were printing file name which has little value (is always
pim_oil.c). Instead print the caller.

add_oif/del_oif are being called directly from one too many. Instead OIF
setup needs to be consolidated via the PIM state machine. These
debugs are expected to help in understanding what needs to be cleaned up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 08:47:33 -08:00
Donald Sharp
afb2f47031 pimd: Add pim_channel_oil_change_iif
Add a function that allows you to modify the channel oil's incoming
interface and to appropriately install/remove it from the kernel.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-18 07:54:04 -04:00
Donald Sharp
4bcf44412a
Merge pull request #4518 from sarav511/dr_lhr
pimd: fix DR at LHR scenario where non DR is connected to RP
2019-06-21 19:33:14 -04:00
Donald Sharp
8a3e7e9ed9 pimd: Add debugs for channel_oil creation and deletion
Add some debugs so we can see channel oil creation and deletion
events.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-14 19:22:43 -04:00
Donald Sharp
9bf5f19cae pimd: Display ifp name in pim_channel_oil_dump
The vifi being displayed is just confusing.  Display the
actual interface name being used in the mroute.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-14 19:01:46 -04:00
saravanank
50d06d9e56 pimd: fix DR at LHR scenario where non DR is connected to RP
In Scenario where receiver is present in a subnet where 2 or more pim mrouters.
When IGMP query received on a DR interface and RP is reachable through non DR.
Currently we are blocking to create upstream where iif == oif. So pim join
not generated towards RP. We have to allow the DR router in the network to create an upstream.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-06-12 19:07:13 -07:00
Quentin Young
d8b87afe7c lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument,
so const the hash input.

BGP does it in a couple places, those cast away the const. Not great but
not any worse than it was.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-14 21:23:08 +00:00
Anuradha Karuppiah
7d9733230b pimd: allow mroutes with IIF in the OIL
This is specifically needed to allow pim-evpn mroutes in the MLAG setup -
(36.0.0.11, 239.1.1.100)   Iif: peerlink.4094   Oifs: uplink-1, peerlink.4094

I could have gone the other way and disabled PIM_ENFORCE_LOOPFREE_MFC but
that opens the door too wide. Relaxing the checks for mlag-specific mroutes
seemed like the safer choice.

This commit provides the infrastructure to relax checks on a per-mroute
basis.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-04-20 08:33:21 -07:00
Sarita Patra
47e3ce59c4 pimd: Addressing the review comments
Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-03-18 20:22:04 -07:00
Sarita Patra
c3156184f9 pimd: Don't install dummy channel oil entry into Kernel
If the channel oil is dummy(channel_oil->is_valid != True),
then don't install entry into the kernel.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 21:30:22 -08:00
Sarita Patra
732c209c98 pimd: create dummy (*,G) upstream when RP not configured/reachable
In this commit, we are creating a dummy upstream & dummy channel_oil
for (*, G) when RP is not configured or not reachable.
Dummy upstream: <upstream_addr = INADDR_ANY, rpf = Unknown>
Dummy channel oil: <iif = MAXVIFS>

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 21:30:06 -08:00
Sarita Patra
d23756e938 pimd: Don't refersh the oif_creation timer if S,G already present
Issue: Shut the RP interface in the router RP. LHR will get to know
RP becomes not-reachable, so it send a prune towards the RP. On
receiving the prune, RP clear the (*, G) entry, but (S, G) should
not get removed if present.
Now no-shut the RP interface in the router RP. LHR will send a (*, G)
join towards the RP. On receiving join FRR create the (*, G) entry.
Along with this, it also add the interface(join received) in the OIL
of (S, G) and also refresh the (S, G) timer.

Fix: Dont refresh the timer for S, G or (*, G), if the flag for the
channel OIL is PIM_OIF_FLAG_PROTO_ANY.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-07 23:50:12 -08:00
Donald Sharp
74df8d6d9d *: Replace hash_cmp function return value to a bool
The ->hash_cmp and linked list ->cmp functions were sometimes
being used interchangeably and this really is not a good
thing.  So let's modify the hash_cmp function pointer to return
a boolean and convert everything to use the new syntax.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-19 13:14:45 -04:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
David Lamparter
a2dc7057e0 *: fix gcc-8 format-overflow warnings
e.g.
pimd/pim_oil.c: In function ‘pim_channel_oil_dump’:
pimd/pim_oil.c:51:19: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=]

Build on gcc-8.2.0 is warning-free after this patch.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-21 21:05:09 +02:00
Donald Sharp
2b57b94834 pimd: Remove unnecessary alloc failures
Remove from pim unnecessary alloc failure testing
as that alloc failure will cause an assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-08 12:09:21 -04:00
paco
1a36dd60fd
ospfd, pimd: redundant memset (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-18 18:01:59 +02:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Mladen Sablic
4d9ad5dcd0 pimd: Multicast traceroute client and router
This commit is the implementation of weak multicast traceroute.
It consists of IGMP module dealing with mtrace type IGMP messages
and client program mtrace/mtracebis for initiating mtrace queries.

Signed-off-by: Mladen Sablic <mladen.sablic@gmail.com>
2018-02-19 23:13:55 +01:00