Skip to content

Commit

Permalink
pim, pimv6: Removing upstreams and mroutes when "no ip pim"/"no ipv6 …
Browse files Browse the repository at this point in the history
…pim" configs applied in receiver connected interface

When the (no ip pim/no ipv6 pim) pim/pimv6 configuration is removed from the receiver-connected interface in LHR,
we observe inconsistent behavior in following scenarios.

1) When there is no pim/pimv6 configuration at the beginning and the traffic is initiated,
no multicast routes are formed, and there is no available upstream
frr# show ip pim upstream
 Iif  Source  Group  State  Uptime  JoinTimer  RSTimer  KATimer  RefCnt

frr# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
 Source  Group  Flags  Proto  Input  Output  TTL  Uptime

2) When the traffic is flowing and we remove the pim/pimv6 config in between,
the (*,G) upstream transitions into the NotJ state, yet the mroutes remain intact.

frr# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit set
 Source  Group      Flags  Proto  Input   Output  TTL  Uptime
 *       226.1.1.1  SC     IGMP   ens224  pimreg  1    00:00:56
                           IGMP           ens192  1

frr# show ip pim upstream
 Iif     Source  Group      State  Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  *       226.1.1.1  NotJ   00:00:13  00:00:55   --:--:--  --:--:--  1

Hence, to make the behaviour consistent, we remove both the upstream entries for (*,G)
and the corresponding mroutes using the 'pim_igmp_if_reset' API call when dealing with the receiver-connected interface.
The 'pim_ifchannel_local_membership_del' is returned when no ip pim/pimv6 config is applied due to 'pim_ifp->pim_enable' check.
Therefore, removing this check in order to proceed with the deletion when the pim/pimv6 configurations are removed

Signed-off-by: Sai Gomathi N <[email protected]>
  • Loading branch information
SaiGomathiN committed Oct 11, 2023
1 parent 688224a commit b04f762
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions pimd/pim6_mld.c
Original file line number Diff line number Diff line change
Expand Up @@ -2151,6 +2151,15 @@ static void gm_start(struct interface *ifp)
}
}

void pim_gm_if_reset(struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
struct gm_if *gm_ifp = pim_ifp->mld;

if (gm_ifp)
gm_group_delete(gm_ifp);
}

void gm_group_delete(struct gm_if *gm_ifp)
{
struct gm_sg *sg;
Expand Down
1 change: 1 addition & 0 deletions pimd/pim6_mld.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ struct gm_if {
#if PIM_IPV == 6
extern void gm_ifp_update(struct interface *ifp);
extern void gm_ifp_teardown(struct interface *ifp);
extern void pim_gm_if_reset(struct interface *ifp);
extern void gm_group_delete(struct gm_if *gm_ifp);
#else
static inline void gm_ifp_update(struct interface *ifp)
Expand Down
2 changes: 0 additions & 2 deletions pimd/pim_ifchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,6 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg)
pim_ifp = ifp->info;
if (!pim_ifp)
return;
if (!pim_ifp->pim_enable)
return;

orig = ch = pim_ifchannel_find(ifp, sg);
if (!ch)
Expand Down
6 changes: 6 additions & 0 deletions pimd/pim_pim.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "pim_register.h"
#include "pim_errors.h"
#include "pim_bsm.h"
#include "pim6_mld.h"
#include <lib/lib_errors.h>

static void on_pim_hello_send(struct event *t);
Expand Down Expand Up @@ -102,6 +103,8 @@ static void sock_close(struct interface *ifp)

void pim_sock_delete(struct interface *ifp, const char *delete_message)
{
struct pim_interface *pim_ifp = ifp->info;

zlog_info("PIM INTERFACE DOWN: on interface %s: %s", ifp->name,
delete_message);

Expand All @@ -124,6 +127,9 @@ void pim_sock_delete(struct interface *ifp, const char *delete_message)
pim_neighbor_delete_all(ifp, delete_message);

sock_close(ifp);

if (pim_ifp->gm_enable)
pim_gm_if_reset(ifp);
}

/* For now check dst address for hello, assrt and join/prune is all pim rtr */
Expand Down

0 comments on commit b04f762

Please sign in to comment.