Commit Graph

220 Commits

Author SHA1 Message Date
Donald Sharp
cfbf74a9a1
Merge pull request #10088 from opensourcerouting/pim-forward-stop
pimd: fix stale forwarding entries left around after join goes away
2021-11-22 08:30:18 -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
Igor Ryzhov
4bb0e8f0c0 pimd: use correct VRF when processing interface address add
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-16 18:09:09 +03:00
Russ White
e27eaa0d9f
Merge pull request #9900 from SaiGomathiN/sai-pimjoin
pimd: Change in PIM join and mroute
2021-11-05 15:17:01 -04:00
Sai Gomathi
c29fec4d3a pimd: modification in mroute
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-26 07:36:24 -07:00
David Lamparter
a243d1db93 *: convert zclient callbacks to table
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-10-20 13:28:46 +02:00
David Lamparter
5421bf8f1d pimd: fuse source_new() and add_source_by_addr()
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-27 10:46:53 +02:00
David Lamparter
a1a4295ade pimd: reformat after dropping indent levels
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-27 10:46:53 +02:00
David Lamparter
dda4d23cca pimd: IGMP memberships are not querier specific
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-08-27 10:42:53 +02: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
Mark Stapp
ee2bbf7ce2 pimd: replace inet_ntoa
Replace all use of inet_ntoa, using %pI4 or inet_ntoa instead

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-22 10:13:56 -04:00
Donatas Abraitis
2dbe669bdf :* Convert prefix2str to %pFX
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-10-22 09:07:41 +03:00
Donald Sharp
ac6ebcb0db pimd: Allow mlag to create ifchannel
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-06-02 21:57:41 -04:00
Sarita Patra
9443810eef pimd: fix OIL not removed after IGMP prune
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-16 21:54:34 -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
Anuradha Karuppiah
448139e704 pimd: stop overloading SRC_IGMP upstream for vxlan local membership
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-14 09:18:30 -08:00
Anuradha Karuppiah
05ca004b80 pim: DF election for tunnel termination mroutes in an anycast-VTEP setup
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-02-14 09:18:30 -08: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
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
Mark Stapp
07e123defc
Merge pull request #5328 from satheeshkarra/pim_mlag
pimd, lib, zebra : PIM MLAG Support
2019-11-22 08:51:47 -05:00
Anuradha Karuppiah
c5cdf06960 pimd: jp-agg list update debug logs
Added event logs around add/del of upstream entries into the nbr's
jp-agg list. This is to help debug a problem with stale (deleted)
upstream entries being present in the list causing pimd to crash on
the periodic processing.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-11-15 14:16:08 -08:00
Anuradha Karuppiah
db431af290 pimd: handle RPF resolution while in joined state
If an dummy upstream entry (no RPF nbr) which is already in a JOINED
state is resolved we were not triggering an immediate join via the
per-interface upstream switch list.

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
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
Jafar Al-Gharaibeh
48cb555d4e
Merge pull request #5276 from donaldsharp/pim_double
pimd: No need to add then remove the oif if not DR
2019-11-14 09:38:44 -06:00
Satheesh Kumar K
46c2687c72 pimd, lib: adding support for MLAG Message processing at PIM
This includes:
1. Defining message formats
2. Stream Decoding after receiving the message at PIM
3. Handling MLAG UP & Down Notifications

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-11-13 20:43:15 -08:00
Satheesh Kumar K
36b5b98fef pimd : Add support for MLAG Register & Un-register
when ever a FRR Client wants to send any data to another node
using MLAG Channel, uses below mechanisam.

1. sends  a MLAG Registration to zebra with interested messages that
   it is intended to receive from peer.
2. In response to this request, Zebra opens communication channel with
   MLAG. and also in Rx. diretion zebra forwards only those messages which
   client shown interest during registration
3. when client is no-longer interested in communicating with MLAG, client
   posts De-register to Zebra
4. if this is the last client which is interested for MLAG Communication,
   zebra closes the channel.

why PIM Needs MLAG Communication
================================
1. In general on LAN Networks elecetd DR will send the Join towards
   Multicast RP in case of a LHR and Register in case of FHR.
2. But in case DR Goes down, traffic will be re-converged only after
   the New DR is elected, but this can take time based on Hold Timer to
   detect the DR down.
3. this can be optimised by using MLAG Mecganisam.
4. and also Traffic can be forwarded more efficiently by knowing the cost
   towards RP using MLAG

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-11-13 19:46:52 -08:00
Donald Sharp
8e389ea9e8 pimd: No need to add then remove the oif if not DR
When adding an OIF to the OIL, if we are not the DR
there is no need to install it then remove it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-04 10:55:52 -05:00
Donald Sharp
721c08573a *: Convert connected_free to a double pointer
Set the connected pointer to set the pointer to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Quentin Young
6a597223d3 Revert "Merge pull request #4885 from satheeshkarra/pim_mlag"
This reverts commit d563896dad, reversing
changes made to 09ea1a4038.
2019-10-14 17:15:09 +00:00
Jafar Al-Gharaibeh
d563896dad
Merge pull request #4885 from satheeshkarra/pim_mlag
pimd, lib, Zebra: PIM MLAG Support
2019-10-14 01:07:24 -05:00
Russ White
9898a2fb34
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-30 07:46:19 -04:00
Donald Sharp
24cbd13098 pimd: up->channel_oil cannot be NULL
When we create the up data structure we create the channel_oil
as well.  As such it is impossible to get into this code
so it can be removed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-25 09:26:24 -04:00
Satheesh Kumar K
5fdca4ded5 pimd, lib: adding support for MLAG Message processing at PIM
This includes:
1. Defining message formats
2. Stream Decoding after receiving the message at PIM
3. Handling MLAG UP & Down Notifications

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-24 01:35:09 -07:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ddbf3e6060 *: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Satheesh Kumar K
4bf3dda597 pimd : Add support for MLAG Register & Un-register
when ever a FRR Client wants to send any data to another node
using MLAG Channel, uses below mechanisam.

1. sends  a MLAG Registration to zebra with interested messages that
   it is intended to receive from peer.
2. In response to this request, Zebra opens communication channel with
   MLAG. and also in Rx. diretion zebra forwards only those messages which
   client shown interest during registration
3. when client is no-longer interested in communicating with MLAG, client
   posts De-register to Zebra
4. if this is the last client which is interested for MLAG Communication,
   zebra closes the channel.

why PIM Needs MLAG Communication
================================
1. In general on LAN Networks elecetd DR will send the Join towards
   Multicast RP in case of a LHR and Register in case of FHR.
2. But in case DR Goes down, traffic will be re-converged only after
   the New DR is elected, but this can take time based on Hold Timer to
   detect the DR down.
3. this can be optimised by using MLAG Mecganisam.
4. and also Traffic can be forwarded more efficiently by knowing the cost
   towards RP using MLAG

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2019-09-16 20:11:01 -07:00
Donald Sharp
46dd6edb06 pimd: pim_upstream *always* creates a channel_oil
Modify code base so that pim_upstream *always* creates a channel_oil
and as such we do not need to create it later or play other games.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-18 07:56:37 -04: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
Anuradha Karuppiah
ecbbc3a750 pimd, zebra: request for replay of SG entries on startup
zvni setup in zebra is controlled via bgpd i.e. advertise_all_vni
from bgpd triggers this setup. As a part of zvni creation we may need
to setup BUM mcast SG entries which are propagated to pimd for MDT setup.

Now pimd may not be present at the time of zvni creation or may restart
post zvni creation so we need a mechanism to replay (on pimd startup) and
to cleanup (on pimd stop). This is addressed via zebra_vxlan_sg_replay and
zebra_evpn_pim_cfg_clean_up.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-07-03 10:11:53 -07:00
Rafael Zalamena
9b2d87406a
Merge pull request #4525 from donaldsharp/some_cleanups
Some cleanups
2019-06-25 16:06:57 -03:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp
a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -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
11884868d4 pimd: ALLOC functions cannot fail.
There is no need to check for ALLOC function failures
in the code base.  If we cannot get more memory we
assert.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-19 19:07:12 -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