Commit Graph

316 Commits

Author SHA1 Message Date
Donald Sharp
24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp
cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
Sarita Patra
d77da853f0 pimd, pim6d: Fix join prune handling
When upstream RPF address is secondary address, and
neighborship is built with primary address,
then pim_neighbor_find() fails.

Verify the upstream  RPF address is present in the
neighbor primary and secondary address list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-24 04:40:38 -08: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
David Lamparter
ab2f9e89b4 pimd: consistently ignore prefix list mask len
... the prefix length wasn't ignored as expected.  Both S and G are
always /32.  But expecting "le 32" in prefix-list config is unexpected &
counterintuitive.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-11-04 17:17:39 +01:00
Donald Sharp
d139e9e842 pimd: Remove pim_br vestiges
If PIM had received a register packet with the Border Router
bit set, pimd would have crashed.  Since I wrote this code
in 2015 and really have pretty much no memory of this and
no-one has ever reported this crash, let's just remove this
code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-27 15:51:47 -04:00
Donald Sharp
e89de02895 pimd: pim_upstream_add up must exist
When calling pim_upstream_add, the lookup for upstream
or the creation of the upstream cannot fail.  As such
up is never NULL.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-15 15:45:05 -04:00
Jafar Al-Gharaibeh
6286ce45bc
Merge pull request #11536 from mobash-rasool/temp1
pimd: During prune pending, behave as NOINFO state (conformance issue)
2022-07-14 12:24:35 -05:00
Mobashshera Rasool
8d0f0b02f3 pimd: During prune pending, behave as NOINFO state
Fixed ANVL Conformance PIM-SM 16.3 test case.

When (S,G,rpt) prune is received, we were installing
the mroute immediately with none as OIF.
This leads to dropping the (S,G) traffic during prune
pending time as well.

Also we should not install the mroute if there is no
change in the rpf update.

These 2 things lead to the failure of the test case.

Fixed it by blocking the installation in this scenario.
When prune pending timer pops, it will take care of
installing the mroute with  none as OIF.

Fixes: #11535

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-06 05:18:38 -07:00
sarita patra
e6e5300636 pim6d: Pass pim_addr for pim_nht callbacks.
For pim callbacks, we pass pim_addr as value, not pointer.
So making it consistent for pim_nht callbacks.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:56:43 -07:00
sarita patra
028583e9e0 pim6d: Adjust rpf_addr in pim_upstream
In this PR, we are handling the pim_upstream
after rpf_addr modified from prefix to pim_addr.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:41:47 -07:00
Mobashshera Rasool
30247bd637 pimd: Avoid reading freed memory.
If the upstream is freed in pim_upstream_del, then trying to
call pim_upstream_timers_stop will lead to accessing freed memory.

Fix:
Stop the timer only if upstream is not deleted.

Co-authored-by: Sarita Patra <saritap@vmware.com>
Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-06-24 03:50:45 -07:00
David Lamparter
d1b7dfbe08
Merge pull request #10712 from patrasar/pim_nexthop_prefix_to_pimaddr 2022-04-26 15:39:36 +02:00
Donald Sharp
dc7be57dfc
Merge pull request #10853 from plsaranya/pim_assert_fixes
pimd: assert fixes
2022-04-20 07:57:40 -04:00
Abhishek N R
80a82b567f pimd: Changing PIM_OIF_FLAG_PROTO_IGMP to PIM_OIF_FLAG_PROTO_GM
Modified marco name so that it can be reused in mld.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-04-13 01:19:03 -07:00
sarita patra
d8a2f46667 pim6d: Handle mrib_nexthop_addr in pim_upstream
Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-06 22:37:58 -07:00
Donald Sharp
07b12758be pimd, zebra: Fix spelling of fowarding
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-02 07:46:19 -04:00
plsaranya
db89f2a3eb pimd: Assert fixes
Problem:
PIM assert is not triggered even after receiving WRONGVIF notification because of Could_assert flag not set.
CouldAssert(S,G,I) =
        SPTbit(S,G)==TRUE
        AND (RPF_interface(S) != I)
        AND (I in ( ( joins(*,G) (-) prunes(S,G,rpt) )
                    (+) ( pim_include(*,G) (-) pim_exclude(S,G) )
                    (-) lost_assert(*,G)
                    (+) joins(S,G) (+) pim_include(S,G) ) )
Once SPTbit is set, Could_assert has to be reevaluated

Signed-off-by: plsaranya <Saranya_Panjarathina@dell.com>
2022-03-25 19:48:54 +05:30
Donatas Abraitis
baa57b7282
Merge pull request #10583 from donaldsharp/pim_upstream_timers
pimd: Ensure timers are stopped on instance shutdown
2022-03-15 14:35:30 +02:00
sarita patra
fd3af22930 pim6d: Handling IPV6 in pim_upstream
Signed-off-by: sarita patra <saritap@vmware.com>
2022-02-28 11:10:00 -08:00
Donald Sharp
3bf65aa1ae
Merge pull request #10400 from opensourcerouting/pim6-compilefix
pim6d: get running with ipv6 types throughout
2022-02-26 08:03:06 -05:00
Donald Sharp
cc9f21da22 *: Change thread->func to return void instead of int
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-23 19:56:04 -05:00
Donald Sharp
ccaa4cced2 pimd: Ensure timers are stopped on instance shutdown
The pim_upstream data structure has a ref count that is
not properly being incremented/decremented and when an
instance is removed this is causing crashes because timers
are still popping afterwords on data structures that are
now freed.

Since getting the ref count code is extremely hard and
we know that this crash is happening, add a bit of code
to prevent the timers from popping at all when we go
through and free up other data structures that we
are pointing at.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-17 07:52:33 -05: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
101b31041a pim6d: IPv6-adjust upstream_rpf_genid_changed
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16 16:32:26 +01:00
David Lamparter
01adb431d3 pim6d: IPv6-adjust pim_upstream addr
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter
9bb93fa04e pim6d: IPv6-adjust neigh->source_addr
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter
c631920c15 pim6d: IPv6-adjust various pim_sgaddr uses
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-02-14 06:45:03 +01:00
David Lamparter
bca160c6af pimd: add PIMADDR_ANY & tackle assignments
Need a separate constant that is IPv6 when needed.  Also assign the
whole struct rather than just s_addr.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:09:01 +01:00
David Lamparter
62f59b58ba pimd: deploy pim_sgaddr_* helpers
Use _cmp/_hash/_match helpers for operations on pim_sgaddr to prepare
IPv6 support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:08:58 +01:00
David Lamparter
032a741219 pimd: move & deploy pim_addr_cmp() helper
Comparing `s_addr` isn't cutting it for IPv6 support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:08:29 +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
9bace5c2d3 pimd: remove pim_str_sg_set()
... and replace with `%pSG` printfrr specifier.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:00:04 +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
Donald Sharp
e5b5ea92c5
Merge pull request #9906 from patrasar/2553196
pimd: During Joined -> NotJoined, upstream should send prune nomatter
2021-11-24 12:33:44 -05:00
sarita patra
0a4497f14a pimd: During Joined -> NotJoined, upstream should send prune nomatter
RCA: When upstream transition from Joined to NotJoined due to SGRpt
prune, then only SGRpt prune was sent and SG Prune is missed.

Fix: Send SG Prune towards source as well as SGRpt prune towards RP.

Signed-off-by: sarita patra <saritap@vmware.com>
2021-11-24 04:30:10 -08:00
Donald Sharp
f1189d7374
Merge pull request #9919 from mobash-rasool/pim-upst-3
pimd: STAR inherited Flag not properly set in certain scenarios
2021-11-22 14:42:56 -05:00
David Lamparter
86696f7bbe pimd: remove some constant parameters
ch_del is always true for all callers of ifjoin_to_noinfo.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 16:46:05 +01:00
David Lamparter
4efdb9c628 pimd: clean up BSR NHT & fix parallel links
The Bootstrap message RX path needs a RPF check for the BSR address,
and this is implemented both incorrectly as well as quite ugly.

Clean up and fix case when we have multiple interfaces to the same LAN
and/or ECMP nexthops (both would cause message duplication, the former
can even cause BSM forwarding loops.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 11:17:44 +01:00
Donald Sharp
e1d1b1dec7 pimd: Remove default from enum based switch
enum based switches should never use default.  It makes
it very hard to fix and find issues when the enum is
changed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-10 17:35:22 -05:00
Mobashshera Rasool
5428f5ac64 pimd: STAR inherited Flag not properly set in certain scenarios
Problem Statement:
==================
Mroutes are not recovered after shut/no shut of DUT to RP links

One interface is not added in OIL List in intermediate router,
hence traffic never received at LHR and mroutes not created for (S,G).

Root Cause Analysis:
====================
Generally (*,G) PIM Join is received first and then (S,G) joins are received.
This issue occurs when (S,G) join comes first and then the (*,G) Join.
When (S,G) PIM Join is received, ifchannel is created and channel_oil
OIF flag is set to PIM_OIF_FLAG_PROTO_PIM. Now when (*,G) join is received
the flag PIM_OIF_FLAG_PROTO_STAR is not inherited due to wrong check present in
function pim_upstream_inherited_olist_decide.

Fix:
===================
When (*,G) PIM Join is received, it should always add PIM_OIF_FLAG_PROTO_STAR
flag for all the (S,G) channel oils no matter what order the (*,G) or (S,G)
is received.

Fixes: #9918

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-10-29 02:57:34 -07:00
Christian Hopps
e8b7548c0d pimd: fix register suppress timer code
Signed-off-by: Christian Hopps <chopps@labn.net>
2021-08-19 00:28:35 -04:00
Donatas Abraitis
936fbaef47 *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLEN
Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 17:44:09 +03:00
Don Slice
3f1f8641fa pimd: adjust rp_keep_alive_time when register_suppress_time is changed
The router->register_suppress_time is used to derive the
rp_keep_alive_time, but when the suppress time was changed, pim was
not recalculating the rp_keep_alive_time and left it at the old value.
This fix applies the changes when a new suppress_time is entered
(or removed.)

Signed-off-by: Don Slice <dslice@nvidia.com>
2021-05-05 09:02:28 -04:00
Mobashshera Rasool
195427c8fd pimd: SPT-bit is not set to false as per RFC section in one flow
1. As per RFC 4601 Sec 4.5.7:
* JoinDesired(S,G) -> False, set SPTbit to false.

2. Change the debug type.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-01-11 05:23:41 +00:00
Mark Stapp
5047884528 *: unify thread/event cancel macros
Replace all lib/thread cancel macros, use thread_cancel()
everywhere. Only the THREAD_OFF macro and thread_cancel() api are
supported. Also adjust thread_cancel_async() to NULL caller's pointer (if
present).

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23 12:16:52 -04:00