Commit Graph

1573 Commits

Author SHA1 Message Date
Donatas Abraitis
2a7280e2e5
Merge pull request #5882 from patrasar/2386429
pimd: fix pim interface traffic & pim rp-info json command
2020-03-18 11:26:44 +02:00
Russ White
09c04bc490
Merge pull request #5849 from donaldsharp/pim_register_prefix_list
Pim register prefix list
2020-03-17 14:57:10 -04:00
Donald Sharp
7967afda07
Merge pull request #5880 from patrasar/2371558
pimd: fix OIL not removed after IGMP prune
2020-03-17 13:40:53 -04:00
Donald Sharp
fc74cbe76c
Merge pull request #5940 from patrasar/214257
pimd: add flags in show ip mroute command
2020-03-17 06:38: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
Sarita Patra
a7a5472ef2 pimd: fix pim interface traffic & pim rp-info json command
Issue 1: "show ip pim interface traffic" not show prune TX/RX
Rootcause : not added the variable in the json
Fix : add prune TX/RX in show ip pim interface traffic json

Issue 2: "show ip pim rp-info" not shows the key iAmRp when it is false
Rootcause: Only display the key when the value is true.
Fix: add iAmRp as false in show ip pim rp-info json

Issue 3: "show ip pim rp-info" not showing outbound interface if it is empty
Rootcause: Only display when there is any OIL

Fix: When RP is not reachable then, the outbound interface is Unknown
The command "show ip pim rp-info json" not displaying the outbound
interafce if it is unknown

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-16 21:44:38 -07:00
Sarita Patra
6a42461973 pimd: add flags in show ip mroute command
S - Sparse Mode
C - indicates there is a member of the group directly connected to the router.
R -set on an (S, G) by the receipt of an (S, G) RP bit prune message.
F -This indicates that this router is a FHR and send register messages to RP to inform RP of this active source
P - OIL list is NULL. That means the router will send a prune.
T - At least one packet received via SPT.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-16 21:38:56 -07:00
Donald Sharp
443b06182f
Merge pull request #6005 from sarav511/bsr_json
pimd: show ip pim bsr json output - removing vtysh caption
2020-03-16 08:24:44 -04:00
Donald Sharp
c7fb94afa6
Merge pull request #6007 from sarav511/unlck
pimd: moving the route_unlock_node outside debug function
2020-03-16 08:24:10 -04:00
Donald Sharp
b4b58058c2
Merge pull request #5941 from patrasar/217793
pimd: Don't refresh mroute_creation for kernel-installed mroute
2020-03-16 08:14:28 -04:00
saravanank
260c92c867 pimd: moving the route_unlock_node outside debug function
Problem: Route node is not de referenced after search when pim debug events are
not enabled when pim_rp_find_match_group is called. So this memory will not get
released when route node is deleted after hitting this path.

RCA: Dereferencing is done inside debug condition.

Fix: Moving outside debug condition

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-15 19:36:33 -07:00
saravanank
36afe48622 pimd: show ip pim bsr json output - removing vtysh caption
Root cause: The header display is put in common outside the vtysh/json if-else.
Fix: Brought inside vtysh condition.

Signed-off-by: Saravanan K <saravanank@vmware.com>
2020-03-15 18:58:53 -07:00
Sri Mohana Singamsetty
9766604161
Merge pull request #5827 from donaldsharp/missed_upstreaming
Missed upstreaming
2020-03-12 09:27:26 -07:00
Sarita Patra
fe75a058eb pimd: Don't refresh mroute_creation for kernel-installed mroute
Issue: When any interface is getting added/deleted in the outgoing
interface list, it calls pim_mroute_add() which is updating the
mroute_creation time without checking if the mroute is already
installed in the kernel.

Fix: Check if mroute is already installed, then dont refresh the
mroute_creation timer.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-11 23:33:06 -07:00
Donatas Abraitis
fcf6ec4cb4
Merge pull request #5877 from donaldsharp/pim_shutdown_cleanup
Pim shutdown cleanup
2020-03-10 17:05:12 +02:00
Donald Sharp
6d7c0df5b4 pimd: ifchannel deletion should tell you the interface
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-10 09:59:56 -04:00
Russ White
7f6c322d50
Merge pull request #5839 from donaldsharp/upstream_merge
Upstream merge of missed MLAG code
2020-03-09 15:34:18 -04:00
Donald Sharp
5cb1323595
Merge pull request #5942 from patrasar/2438087
pimd: Display mroute uptime per (s,g) entry
2020-03-09 08:47:10 -04:00
Sarita Patra
dfd12d0255 pimd: Display mroute uptime per (s,g) entry
Issue: show ip mroute displays the mroute uptime (time when
mroute installed into the kernel) per oif.
This is confusing.

Fix: Display mroute uptime per (s,g) mroute entry.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-09 00:30:34 -07:00
Donald Sharp
a9c5346c29
Merge pull request #5937 from ton31337/fix/sizeof
*: Replace `sizeof something` to sizeof(something)
2020-03-08 20:01:10 -04:00
Donatas Abraitis
0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Donald Sharp
b7e40944a2 pimd: Prevent use after free from pim_mlag_up_peer_deref
There exists a chain of events where calling pim_mlag_up_peer_deref
can free the up pointer.  Prevent a use after free by returning
the up pointer as needed and checking to make sure we are
ok.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:37:17 -05:00
Donald Sharp
7a11dc746f pimd: Remove possibility of trying to send Register when no RPF
On shutdown processing we may have gotten a interface down event
which might clear the rpf interface and we might trigger a
work queue item on the vxlan_sg to send a NULL register.

Ensure that we cannot attempt to do the impossible.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:34:11 -05:00
Donald Sharp
3c582f627a pimd: When shutting down stop the vxlan worker thread
Upon shutdown stop the vxlan worker thread.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:34:11 -05:00
Donald Sharp
514bda4715 pimd: Upon vrf deletion actually clean up memory
VRF deletion events here calling hash_clean() with
nothing to clean up the vxlan_sg's associated with it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:33:27 -05:00
Donald Sharp
f4e74bd038 pimd: Add ip pim register-accept-list PLIST command
When pim receives a register packet, we will apply the
received source to the prefix list.  If accepted normal
processing continues.  If denied we will send a register
stop message to the source.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:27:01 -05:00
Donald Sharp
2ca35b6437 pimd: Add a pim pointer to register_recv
We already use the pim pointer a bunch off of pim_ifp->pim
just add another pim variable to allow us to shorten code
a bit.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:26:59 -05:00
Donald Sharp
1c4e26bc06 pimd: Rename the PIM_SPT_PLIST_NAME to PIM_PLIST_NAME
The memory type PIM_SPT_PLIST_NAME is specific to
SPT but we are going to store more prefix-list names
in pim, make it generic to allow for less confusion
in the future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:24:21 -05:00
Donald Sharp
d2ee562542 pimd: the spt infinity prefix-list memory was not being freed
On shutdown the string storing the prefix-list was not being
properly freed.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:23:16 -05:00
Anuradha Karuppiah
ea6d91c86b pimd: re-eval flow activity on kat expiry
When the (S,G) KAT expires we need to poll for activity before dropping the
entry as traffic may have been forwarded by the dataplane since the last
periodic poll cycle.

This only works if traffic is being forwarded by the kernel i.e. if the
entries were HW accelerated via an ASIC we may still miss out on last
minute activity on the mroute in the HW.

Ticket: CM-26871

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-06 16:18:44 -05:00
Anuradha Karuppiah
07f4bac3ac pimd: mute termination device on the origination mroute on type mods
An mroute can transition from non-origination to a vxlan origination
mroute. In that case we need to re-evaluate if the interfaces in the
OIL need to be muted; pimreg and termination device need to be muted (if
they were previously un-muted).

Dump in a problem state:
=======================
root@TORC11:~# net show pim state
Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G), V -> VxLAN, M -> Muted
Active Source           Group            RPT  IIF               OIL
1      *                239.1.1.100      y    uplink-1          pimreg(I    ), ipmr-lo( J   )
1      36.0.0.11        239.1.1.100      n    peerlink-3.4094   ipmr-lo(   * ), uplink-1( J   ), uplink-2( J   ), peerlink-3.4094(  V  )

PS: ipmr-lo should have M set in (36.0.0.11,239.1.1.100)

Ticket: CM-26747

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-06 16:13:40 -05:00
Donald Sharp
4d114ab9f9 pimd: Allow LHR in a AA situation to join upstream
Add a special catch to the test for pim_macro_chisin_pim_include
to allow the LHR to signal interest in joining upstream.
This will allow both the DR and non DR of the ActiveActive
situation to draw traffic to itself.

The non-DR will continue to not forward traffic.

Ticket: CM-26610
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:13:28 -05:00
Anuradha Karuppiah
0f31a82a11 pimd: fix problem with oif being re-added during ifchannel del
Series of events leading to the problem -
1. (S,G) has been pruned on the rp on downlink-1
2. a (*,G) join is rxed on downlink-1 without the source S. This
results in the (S,G,rpt) prune state being cleared on downlink-1.
As a part of the clear the ifchannel associated with downlink-1
is deleted.
3. The ifchannel_delete handling is expected to add downlink-1
as an inherited OIF to the channel OIL (which it does). However
it is also added in as an immediate OIF (accidentally) as the
ifchannel is still present (in the process of being deleted).

To avoid the problem defer pim_upstream_update_join_desired
evaluation until after the channel is deleted.

Relevant debug logs -
PIM: pim_ifchannel_delete: ifchannel entry (27.0.0.15,239.1.1.106)(downlink-1) del start
PIM: pim_channel_add_oif(pim_ifchannel_delete): (S,G)=(27.0.0.15,239.1.1.106): proto_mask=4 OIF=downlink-1 vif_index=7: DONE
PIM: pimd/pim_oil.c pim_channel_del_oif: no existing protocol mask 2(4) for requested OIF downlink-1 (vif_index=7, min_ttl=1) for channel (S,G)=(27.0.0.15,239.1.1.106)
PIM: pim_upstream_switch: PIM_UPSTREAM_(27.0.0.15,239.1.1.106): (S,G) old: NotJoined new: Joined
PIM: pim_channel_add_oif(pim_upstream_inherited_olist_decide): (S,G)=(27.0.0.15,239.1.1.106): proto_mask=2 OIF=downlink-1 vif_index=7 added to 0x6  >>>>>>>>>>>>>>>>>>
PIM: pim_upstream_del(pim_ifchannel_delete): Delete (27.0.0.15,239.1.1.106)[default] ref count: 2 , flags: 81 c_oil ref count 1 (Pre decrement)
PIM: pim_ifchannel_delete: ifchannel entry (27.0.0.15,239.1.1.106)(downlink-1) del end

Ticket: CM-26732

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-06 16:13:27 -05: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
Satheesh Kumar K
83f8a12b8e lib, pimd, zebra: Provide some insurance against reading bad stream data
This patch does two things:

1) Ensure the decoding of stream data between pim <-> zebra is properly
decoded and we don't read beyond the end of the stream.

2) In zebra when we are freeing memory alloced ensure that we
actually have memory to delete before we do so.

Ticket: CM-27055
Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:03:59 -05:00
Satheesh Kumar K
22c35834ea pimd: Use PIM EVPN MLAG Infra for syncing PIM MLAG Entries
Initially, MLAG Sync is happened at pim_ifchannel, this is mainly to
support even config mismatches(missing configuration of dual active).
But this causes more syncs for each entry.

and also it is not In-line with PIM EVPN. to avoid that moving to
pm_upstream based syncing.

Signed-off-by: Satheesh Kumar K <sathk@cumulusnetworks.com>
2020-03-06 16:03:36 -05:00
Anuradha Karuppiah
ec85b101e6 pimd: run DF election only on (*, G) termination mroutes
(S,G) entries that inherit ipmr-lo into the OIL also inherit
the DF role from the parent (*, G) entry.

This change is done primarily to simplify the sync process and
to prevent the MLAG peers from having to track (S, G) activity etc.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-03-06 16:03:28 -05:00
Donald Sharp
aeb672466f pimd: Skip nexthop lookup for register source in some cases
There exists the possibility that a RP exists as a anycast
pair for a lan segment.  As such one side may receive
the register and properly handle the registration mechanics.
The one that does not receive the register packets will still
get S,G state and WRVIFWHOLE upcalls across the lan.  In
this case notice that we have not received the Registration
packets and prevent nexthop lookups.

Ticket: CM-27466
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:03:20 -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
Donald Sharp
a054f6d73e pimd: There is nothing to do with a WRVIFWHOLE for iifp of pimreg
When the WRVIFWHOLE callback is made with a iifp of the pimreg
device we *know* that the packet is a PIM Register packet
( see net/ipv4/ipmr.c for kernel behavior ).  As such
we know that we will shortly read the pim register packet
and handle it through those mechanics.  There is nothing
to do here so we can move along.

Ticket: CM-27729
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:02:43 -05:00
Donald Sharp
9dc1cb0424 pimd: Put subdir.am into alphabetical order
The subdir.am had lost alphabetical order.  Put this back
for easy finding in the future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-06 16:02:06 -05: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
Donatas Abraitis
286bbbecb0 pimd: Convert pim_upstream_evaluate_join_desired type to bool
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 17:13:01 +02:00
Donatas Abraitis
f06c4576b7 *: Return bool type for bool functions
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 15:05:22 +02:00
Donald Sharp
d87d4e5e0f
Merge pull request #5894 from patrasar/2399927
pimd: Update pim register stop statistics
2020-03-03 21:20:25 -05:00
Donald Sharp
08c50c3032
Merge pull request #5896 from patrasar/2409015
pimd: neighbor needed true in pim nexthop lookup
2020-03-03 21:13:27 -05:00
Russ White
30ac36dbfc
Merge pull request #5897 from patrasar/2415676
pimd: fix crash seen while executing igmp related configuration
2020-03-03 09:35:43 -05:00
Sarita Patra
4f007a5a03 pimd: fix crash seen while executing igmp related configuration
Issue 1:
1. Enable pim on an interface.
2. Configure query-interval or query max response time,
which results in pimd crash.

Root cause:
1. When pim is enabled on an interface, it creates a igmp socket
with querier_timer and other_querier time as NULL.
2. When query-interval/max_response_time is configured, it call the
function igmp_sock_query_reschedule() to reshedule the query. This
function check either of querier_timer or other_querier timer should
be running. Since in this case both are NULL, it results in crash.

Issue 2:
1. Enable pim on an interface.
2. Execute no ip igmp query-interval or query max response time,
which results in pimd crash.

Root cause:
1. When pim is enabled on an interface, it creates a pim interface
with querier_timer and other_querier time as NULL.
2. When no ip igmp query-interval/max_response_time is executed, it will
check either of querier_timer or other_querier timer should be running.
Since in this case both are NULL, it results in crash.

Fix:
When pim is enabled on an interface, it creates a igmp socket with
mtrace_only as true. So add a check if mtrace_only is true, then don't
reshedule the query.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-03 03:35:43 -08:00
Sarita Patra
3d68661d7b pimd: neighbor needed true in pim nexthop lookup
Issue:
Client---LHR---RP
1. Add kernel route for RP on LHR. Client send join
2. (*,G) will be get created in LHR and RP.
3. Kill the FRR on all the nodes
4. Start FRR only on LHR node
5. In LHR, (*, G) will be created with iif as unknown.

Root cause:
In the step 4, When LHR will receive igmp join, it will call
the function pim_ecmp_fib_lookup_if_vif_index which will look
for nexthop to RP with neighbor needed as false. So RPF lookup will
be true as the route is present in the kernel. It will create a
(*, G) channel_oil with incoming interface as the RPF interface
towards RP and install the (*,G) mroute in kernel.
Along with this (*,G) upstream gets craeted, which call the function
pim_rpf_update, which will look for the nexthop to RP with neighbor
needed as true. As the frr is not running in RP, no neighbor is present
on the nexthop interface. Due to which this will fail and will update
the channel_oil incoming interface as MAXVIFS(32).

Fix:
pim_ecmp_fib_lookup_if_vif_index() call the function pim_ecmp_nexthop_lookup
with neighbor_needed as true.

Signed-off-by: Sarita Patra <saritap@vmware.com>
2020-03-03 03:31:22 -08:00