Commit Graph

217 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
4f830a0799 *: Convert thread_timer_remain_XXX to event_timer_remain_XXX
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
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
50b8574d54 pimd: Handling SGRPT prune received
Topology:
========
Receiver----R1----(ens192)R2(ens224)----R3----R4----Source
              --------------------------
R1=LHR
R2=RP
R4=FHR

Problem:
=======
1. Direct  connected link between R1 and R3 is down initially.
2. So traffic flow path is R4<->R3<->R2<->R1<->Receiver.
3. Mroutes are properly created on all the nodes.
4. Up the direct connected link between R1 and R3.
5. Traffic flows in both the paths.
   R4<->R3<->R2<->R1<->Receiver
   R4<->R3<->R1<->Receiver
6. Duplicate traffic received at the receiver.

Root Cause:
==========
Initially when the direct connected link between R1 and R3 is
down, traffic flows via RP(R2). So in RP (S,G) installed with
IIF as ens224 and OIF as ens192 (reference = 2) with mask
PIM_OIF_FLAG_PROTO_STAR and PIM_OIF_FLAG_PROTO_PIM.

Now when the direct link between R1 and R3 is Up, LHR(R1) sends
SGRPT prune. After prune received, RP(R2) will remove OIF ens224
with mask PIM_OIF_FLAG_PROTO_STAR.
Since OIF ens224 is still present with mask PIM_OIF_FLAG_PROTO_PIM,
RP(R2) will not send prune towards R3.
So traffic continues to flow in the path R4<->R3<->R2<->R1<->Receiver.

Fix:
====
When SGRpt prune received, remove OIF irrespective of the OIF is
installed with mask "PIM_OIF_FLAG_PROTO_STAR" or "PIM_OIF_FLAG_PROTO_PIM".
Once OIF is removed, RP sends prune towards R3.

Issue: #11347

Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-12-15 04:02:23 -08: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
29b458ef1f pimd: ch->upstream cannot be NULL
in pim_ifchannel.c there exists several spots where
the ch->upstream is assumed to be NULL.  This is not
possible.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-15 15:45:05 -04:00
sarita patra
8d61ad0f17 pimd: Handle rpf_addr in pim_ifchannel code
Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:41:48 -07:00
David Lamparter
993e3d8e13 pimd: un-dependency-hell pim_instance.h
This is causing build issues on BSD by including (transitively)
`linux/mroute6.h` - try to address by disentangling the headers a bunch.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 15:10:57 +02: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
David Lamparter
b6fcc0b7a6 pimd: remove useless PIM_IF_* macros
The only function these macros have is to make the code confusing.
"PIM_IF_DO_PIM" sounds like it triggers some action, but it doesn't.

Replace with "bool" fields in struct pim_interface.

(Note: PIM_IF_*_IGMP_LISTEN_ALLROUTERS was always set, without any way
to unset it.  It is completely removed now and always enabled.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-04 14:11:29 +02:00
David Lamparter
41490e0ede pim6d: fix some format strings for IPv6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-11 13:43:19 +01: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
Christian Hopps
7bf63db79b
Merge pull request #10632 from donaldsharp/thread_return_null
*: Change thread->func to return void instead of int
2022-02-24 01:43:48 -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
anlan_cs
de674e9fc2 pimd: cosmetic change
Remove one empty line. And correct one word.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-02-21 21:33:04 +08: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
2b844385dc pim6d: IPv6-adjust pim_ifchannel_*
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter
efd66f7bad pim6d: IPv6-adjust assert-related addrs
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
8e8be741b5 pimd: replace pim_inet4_dump with %pPAs
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-17 14:10:57 +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
Sai Gomathi
b850813975 pimd: removing no caller functions
Removing the no caller function declarations and definitions
in pimd directory.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-11-25 20:42:54 -08:00
David Lamparter
5e0105ff80 pimd: fix event order for forward_stop()
`pim_ifchannel_ifjoin_switch()` changes flags that `pim_forward_stop()`
looks at.  This leads to data flow continuing until we have some reason
to sync state again.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17 16:47:28 +01: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
Jafar Al-Gharaibeh
36e83b73de
Merge pull request #9083 from mobash-rasool/pim-upst-3
pimd: In Prune Pending state, the holdtime change is not taking effect
2021-10-26 23:17:56 -05:00
github login name
660b044294 pimd: pim_ifchannel_local_membership_add should not inherit if (S,G) rpf unresolved
Problem:
S,G entry has iif = oif in FHR is LHR case.

Setup:-

R11-----R2----R4

R11 :- FHR and LHR
R2 :- RP
R4 :- LHR

Issue :-

1) shut mapped interface in R11
2) wait for 5 min
3) do FRR restart
5) No shut of mapped interface

OIL is added for local interface also where OIL is same as IIF
and duplicate traffic observed on R4 receives in Ixia

RCA:
pim_ifchannel_local_membership_add adds inherited oif from starg when iif for
SG is unavailable.
When  rpf for that SG resolves to this inherited oif from starg, iif is also in oif.
This results in dup traffic.

Fix:
If iif is not available, do not inherit from starg.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-19 03:57:25 -07:00
github login name
b206dc5566 pimd: In Prune Pending state, the holdtime change is not taking effect
Problem Statement:
In Prune pending state, when Join is received, and there is hold timer change
the Expiry timer is not getting updated with new Hold timer.

Root Cause:
When thread_add_timer function is called and the thread is already in the list
the thread api just returns, it does not modify the timer value.
So when we want to change the timer, we need to first call THREAD_OFF and then
call thread_add_timer.
The Expiry timer thread is not cancelled in PIM_IFJOIN_PRUNE_PENDING state,
therefore the timer change is not taking effect.

Fix:
Call THREAD_OFF in that flow.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-19 01:01:21 -07: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
Donald Sharp
48c320d2f1 pimd: Use __func__ instead of __PRETTY_FUNCTION__
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 12:04:57 -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
saravanank
d0c866d0d8 pimd: SGRpt prune received during prune didn't override holdtime
RCA: There were 2 problems.
1. SGRpt prune expiry didn't create S,G entry with none oil when no other
interfaces were part of the oil.
2. When restarting the timer with new hold value, comparision was missing and
old timer was not stopping.

Fix:
SGRpt Prune pending expiry will put SG entry with none oil if no other

Signed-off-by: Saravanan K <saravanank@vmware.com>

interfaces present. If present we will be deleting the inherited oif from oil.
Deleting the oif in that scenario will take care of changing mroute.
When alone interface expires in SGRpt prune pending state, we shall detect by
checking installed flag. if not installed, install mroute.
2021-01-28 07:14:48 +00:00
Mobashshera Rasool
9046b17006 pimd: when node changes from non-DR to DR S,G entry not created
1. When a node changes from non-DR to DR in the given topology,
the node was receiving both PIM Join as well as IGMP join.
Since it was already receiving PIM Join previously, ifchannel was
already present. Hence when it becomes DR, the IGMP source flag is not
set due to issue in the code. Hence it never creates S,G entry thinking
that it is not DR.

2. When pim join expires, the pim flag is not reset when ifchannel is not
deleted.

Issue: #7752

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2020-12-17 13:14:29 +00:00
vdhingra
99f9518b4a pimd: (*,G) Prune processing doesn't remove SGRpt ifchannel
problem :
=========
When (*,G) prune received where we have SGRpt state,
ifchannel goes to NO_INFO state and doesn't get removed.

Root cause :
============
During the processing of (*,G) prune, we are not removing the
ifchannel on PruneTmp or PrunePendingTmp state.

Fix :
=====
In that scenario, stop joinExpiry timer and delete the ifchannel.

issue #7347

Co-authored-by: Saravanan K <saravanank@vmware.com>
Signed-off-by: vishaldhingra <vdhingra@vmware.com>
2020-11-02 01:06:59 -08:00
Donald Sharp
f000b7c144
Merge pull request #6016 from sarav511/ppend
pimd: Handling prune received during join state and join received during prune pending
2020-10-14 20:27:17 -04:00
David Lamparter
3efd0893d0 *: un-split strings across lines
Remove mid-string line breaks, cf. workflow doc:

  .. [#tool_style_conflicts] For example, lines over 80 characters are allowed
     for text strings to make it possible to search the code for them: please
     see `Linux kernel style (breaking long lines and strings)
     <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_
     and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_.

Scripted commit, idempotent to running:
```
python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'`
```

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-14 10:37:25 +02:00
Donald Sharp
737d73e519
Merge pull request #6056 from sarav511/jpexp
pimd: Prune->noinfo state has to put off join expiry timer and delete ifchannel
2020-05-21 08:08:29 -04:00
saravanank
265aabf85e pimd: Prune->noinfo state has to put off join expiry timer and delete ifchannel
Problem:
When the ifchannel is in SGRpt prune, if we receive a join, we go into no info
state but mroute still present with none oil

Join Prune Expiry timer on the ifchannel was still running when
Prune pending expired. This causes ifchannel not to be deleted and hence mroute.

Fix:
Stop expiry timer when we move into NOINFO state and delete the ifchannel.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-19 18:41:46 -07:00
saravanank
877ebdf025 pimd: PIM not processing (*,G) joins sent during Prune-Pending State
RCA: starg join fell in to SGRpt join check and was treated as SGRpt join
so ifchannel state machine moved from prunepending to noinfo.

Fix: Check if it is starg join and process

Signed-off-by: Saravanan K <sarav511@vmware.com>
2020-03-19 02:35:48 -07:00