Commit Graph

106 Commits

Author SHA1 Message Date
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
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
Mobashshera Rasool
a23a485cbf pim6d, pimd: Discard (*,G) prune if WC bit is set but RPT bit is unset.
As per RFC 7761, Section 4.9.1
The RPT (or Rendezvous Point Tree) bit is a 1-bit value for use
with PIM Join/Prune messages (see Section 4.9.5.1). If the
WC bit is 1, the RPT bit MUST be 1.

ANVL conformance test case is trying to verify this and is failing.

Issue: #12354

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-11-21 22:00:10 -08:00
Mobashshera Rasool
c6950cb343 pim6d, pimd: Discard (*,G) join if WC bit is set but RPT bit is unset.
As per RFC 7761, Section 4.9.1
The RPT (or Rendezvous Point Tree) bit is a 1-bit value for use
with PIM Join/Prune messages (see Section 4.9.5.1). If the
WC bit is 1, the RPT bit MUST be 1.

ANVL conformance test case is trying to verify this and is failing.

Issue: #12354

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-11-21 21:57:39 -08:00
sarita patra
fc9f6f88e5 pimd: Handle rpf_addr in join/prune processing
Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:41:48 -07:00
sarita patra
b9695c6d04 pimd: Disable receiving join/prune on passive interface
Signed-off-by: sarita patra <saritap@vmware.com>
2022-05-12 23:51:21 -07:00
sarita patra
2287056228 pimd: Handling Join/Prune statistics for passive interface
Increment pim_ifstat_prune_send only when interface is
passive disabled.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-05-12 23:51:21 -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
David Lamparter
145e4c38b9 pim6d: include IPv6 pseudoheader in TX checksums
Lots of passing src/dst around, but it is what it is.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-28 14:13:23 +02:00
David Lamparter
042a754146 pim6d: encode PIM joins correctly
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-12 22:57:34 +01:00
Mobashshera Rasool
17280eee1f pimd: Handle pim join/prune recv flow for ipv6
Making the code changes to handle both ipv4 and ipv6 in the same code

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-02-28 10:36:04 -08:00
David Lamparter
da6bed2bbe pim6d: IPv6-adjust jp_agg->group
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +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
0d36009204 pim6d: more TLV parse/encode IPv6 preparation
More proliferation of pim_addr to work towards IPV6.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter
16763d77a3 pim6d: prepare IPv6 address encoding functions
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter
3ca68c9cf3 pimd: remove PIM_INADDR_IS[NOT]_ANY macros
These really don't serve much of a purpose, especially with how
inconsistently they're used.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:11:08 +01:00
David Lamparter
6d7bf748b6 pimd: fix %pI4 that needs to be %pPA
There's only 2 locations of this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:11:02 +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
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
38c848c9bd pimd: remove usage of inet_ntop
We should not be using inet_ntop. and should be using
the appropriate %pI4 instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-05 18:05:21 -04:00
Sai Gomathi
34abbcc4b1 pimd: modifications in PIM joins
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 :
===
When an interface receives the PIM (*,G)join with G as SSM group, then PIMd supposed to discard that join.
There is no need to maintain PIM state for this group.

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-10-26 07:35:55 -07: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
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
a5ca0ef54f
Merge pull request #5895 from patrasar/2404618
pimd: Clear (s,g,rpt) ifchannel on (*, G) prune received
2020-10-14 20:13:31 -04:00
Sarita Patra
fa8c500f54 pimd: Clear (s,g,rpt) ifchannel on (*, G) prune received
Issue: After SPT switchover, do shut and no-shut the received connected
interface, traffic stops.
                 R2
            |         |
            +         +
 Client-----R1--------R3----Source
R2 is RP.

Root cause:
Client is sending join for G and Source is sending traffic for G.
Before SPT switchover, traffic flows R3-R2-R1, after SPT switchover,
traffic flows R3-R1. Now Check in R2, there will be 2 ifchannel gets
created. first is (*, G) ifchannel which gets created because of (*, G)
join received from R1, second is (S, G) ifchannel which gets created
because of (s,g,rpt) prune received from R1
Shut the receiver connected interface on R1, R1 will send a (*, G) prune
towards RP (R2). On receiving (*, G) prune, R2 deletes the (*, G) ifchannel.
(s,g) ifchannel with flag (s,g,rpt) set will be timeout after the prune timer
expires. Before this timer expires, do noshut the received connected inrterface
on R1. R1 will send a (*,G) join to R2(RP), So oil will be updated in (*, G),
but wont get updated in (s,g) since the flag (s,g,rpt) is set. So traffic flow
stops.

Fix: When (*, G) ifchannel is getting deleted because of (*, G) prune
received, as (*,G) prune indicates that the router no longer wishes
to receive shared tree traffic, so clear (S,G,RPT) flag on all the child (S,G)
ifchannel, which was created because of (S,G,RPT) prune received

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-06-04 21:49:07 -07:00
saravanank
5c777da81f pimd: (*, G) Prune should be processed even if the RP in packet is not RP(G)
RCA: We are ignoring (*,G) prune when the RP in packet is not RP(G)

Fix:
According to RFC 4601 Section 4.5.2:
Received Prune(*,G) messages are processed even if the RP in the message does not match RP(G).

We have allowed starg prune to be processed in the scenario.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-17 02:32:21 -07:00
Donald Sharp
5e81f5dd1a *: Finish off the __PRETTY_FUNCTION__ to __func__
FINISH IT

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 09:23:22 -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
Jafar Al-Gharaibeh
94c1ae82da
Merge pull request #5355 from AnuradhaKaruppiah/pim-state-machine-fixes
PIM state machine fixes
2019-12-06 17:47:07 -06:00
Donald Sharp
b1945363fb pimd: Various buffer overflow reads and crashes
A variety of buffer overflow reads and crashes
that could occur if you fed bad info into pim.

1) When type is setup incorrectly we were printing the first 8 bytes
of the pim_parse_addr_source, but the min encoding length is
4 bytes.  As such we will read beyond end of buffer.

2) The RP(pim, grp) macro can return a NULL value
Do not automatically assume that we can deref
the data.

3) BSM parsing was not properly sanitizing data input from wire
and we could enter into situations where we would read beyond
the end of the buffer.  Prevent this from happening, we are
probably left in a bad way.

4) The received bit length cannot be greater than 32 bits,
refuse to allow it to happen.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-19 20:30:24 -05:00
Anuradha Karuppiah
94e3f3e56b pimd: OIF add with PROTO_PIM is not happening if join rxed in PP state
Dumps while in problem state -
============================
[from "show ip pim state"]
Active Source           Group            RPT  IIF               OIL
1      6.0.0.31         239.1.1.111      n    swp1              swp4( J * )
[from "show ip pim join"]
Interface        Address         Source          Group           State      Uptime   Expire Prune
swp3             6.0.0.22        6.0.0.31        239.1.1.111     JOIN       --:--:-- 03:11  --:--

You can see from the dumps that the pim downstream router has joined on
swp3 but that OIF has not been added to the OIL with flag
PIM_OIF_FLAG_PROTO_PIM. This is because the join was rxed while the
ifchannel was in a prune-pending state.

Relevant logs -
===============
[
PIM: recv_prune: prune (S,G)=(6.0.0.31,239.1.1.111) rpt=1 wc=0 upstream=6.0.0.22 holdtime=210 from 6.0.0.28 on swp3
PIM: pim_upstream_ref(pim_ifchannel_add): upstream (6.0.0.31,239.1.1.111) ref count 3 increment
PIM: pim_upstream_add(pim_ifchannel_add): (6.0.0.31,239.1.1.111), iif 6.0.0.26/0 (swp1) found: 1: ref_count: 3
PIM: pim_ifchannel_add: ifchannel (6.0.0.31,239.1.1.111) is created
PIM: pim_joinprune_recv: SGRpt flag is set, del inherit oif from up (6.0.0.31,239.1.1.111)
PIM: pim_mroute_add(pim_channel_del_oif), vrf default Added Route: (6.0.0.31,239.1.1.111) IIF: swp1, OIFS: swp4
PIM: pim_channel_del_oif(pim_joinprune_recv): (S,G)=(6.0.0.31,239.1.1.111): proto_mask=4 IIF:1 OIF=swp3 vif_index=3
PIM: recv_join: join (S,G)=(6.0.0.31,239.1.1.111) rpt=0 wc=0 upstream=6.0.0.22 holdtime=210 from 6.0.0.28 on swp3
PIM: PIM_IFCHANNEL(swp3): (6.0.0.31,239.1.1.111) is switching from SGRpt(PP) to JOIN
PIM: Sending Request for New Channel Oil Information(6.0.0.31,239.1.1.111) VIIF 1(default)
]

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
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
23fc858a5e pimd: debug igmp trace turns on non igmp debugs
When you turn on `debug igmp trace` we are seeing a bunch
of debugs associated with pim processing.  This is because we were
using PIM_DEBUG_TRACE which is both `debug igmp trace` and `debug pim trace`
when tracing igmp code it would be nice to only see igmp work.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-12 09:38:04 -05:00
Donald Sharp
fb9670aa53 pimd: Fix zlog_warn when we mean debug and vice versa
There are several places in the pim where we are mixing up
zlog_warn w/ zlog_debug and vice versa.  If we are protecting
a zlog_warn w/ a debug is it really a warn?  If we have an actual
error situation we should also warn about it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-08 10:36:02 -04:00
saravanank
d57a8bbf45 pimd: PIM Msg header includes N bit as defined by RFC
This commit includes parsing of Nbit and contructing pim hdr with Nbit
Adding Nbit to PIm hdr structure
Adding Scope zone bit and Bidir bit to Encoded IPv4 Group Address

Signed-off-by: Saravanan K <saravanank@vmware.com>
2019-05-14 21:40:50 -07:00
Sarita Patra
957d93eaf2 pimd: Handling Null incoming interface of dummy upstream
When FRR receives IGMP/PIM (*, G) join and RP is not configured or not
reachable, then we are creating a dummy upstream with incoming interface
as NULL and upstream address as INADDR_ANY.

Added upstream address and incoming interface validation where it is necessary,
before doing any operation on the upstream.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2019-02-24 21:26:58 -08:00
Quentin Young
b0f525a84c
pimd: add support for boundaries
Adds the ability to filter PIM Joins & IGMP reports on an interface.
Enabling a multicast boundary on an interface for a particular group
will prevent the interface from appearing in the group's OIL.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-26 13:00:52 -04:00
David Lamparter
a97986ffba *: fix compiler warnings
Specifically, gcc 4.2.1 on OpenBSD 6.0 warns about these;  they're bogus
(gcc 4.2, being rather old, isn't quite as "intelligent" as newer
versions; the newer ones apply more logic and less warnings.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-26 01:46:40 +02:00
Donald Sharp
c206937b91 pimd: Cleanup S,GRPt prune handling on Mroute Loss
1) Clean up display of S,GRPt prune state to be more meaningful
2) Upon receipt of a S,GRPt prune make sure we transition to
   the correct state
3) Upon loss of a S,GRPt prune make sure we transition to
   the correct state as well as immediately send a *,G
   join upstream to propagate the loss of the prune.
4) Removal of a weird S,G state being installed upon
   loss of a S,G RPt prune.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-24 10:01:50 -04:00
Donald Sharp
8e7a4c6e2b pimd: Lookup S,G ifchannel after we create it
There are situations where we receive a *,G with
a S,G,RPT Prune embedded where we do not actually
have any S,G yet(MSDP with multiple RP's with the
same address).  As such since we only need to
lookup the S,G ifchannel once, do it after
the recv_prune.

Ticket: CM-17230
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-03 18:24:28 -04:00
Donald Sharp
a57103e963 pimd: Cleanup some join debug messages
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:39 -04:00
Donald Sharp
fec883d95a pimd: pim_rp.c -> convert pimg to pim
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-24 13:51:35 -04:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00