pimd: Further work to fix rpf lookups and nbrs

When we do a RPF lookup return a path that we have
neighbors for in those cases where we need to have
a neighbor to pass along the SG state via a pim
join/prune message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-09-15 16:50:08 -04:00
parent a6dc7de682
commit 4a40c37aa4
8 changed files with 25 additions and 18 deletions

View File

@ -150,7 +150,7 @@ static int dispatch_assert(struct interface *ifp,
memset (&sg, 0, sizeof (struct prefix_sg));
sg.src = source_addr;
sg.grp = group_addr;
ch = pim_ifchannel_add(ifp, &sg);
ch = pim_ifchannel_add(ifp, &sg, 0);
if (!ch) {
zlog_warn("%s: (S,G)=%s failure creating channel on interface %s",
__PRETTY_FUNCTION__,

View File

@ -39,6 +39,7 @@
#include "pim_rpf.h"
#include "pim_macro.h"
#include "pim_oil.h"
#include "pim_upstream.h"
/*
* A (*,G) or a (*,*) is going away
@ -366,7 +367,7 @@ pim_ifchannel_find_parent (struct interface *ifp,
struct pim_ifchannel *
pim_ifchannel_add(struct interface *ifp,
struct prefix_sg *sg)
struct prefix_sg *sg, int flags)
{
struct pim_interface *pim_ifp;
struct pim_ifchannel *ch;
@ -379,7 +380,7 @@ pim_ifchannel_add(struct interface *ifp,
pim_ifp = ifp->info;
zassert(pim_ifp);
up = pim_upstream_add(sg, NULL);
up = pim_upstream_add(sg, NULL, flags);
if (!up) {
zlog_err("%s: could not attach upstream (S,G)=%s on interface %s",
__PRETTY_FUNCTION__,
@ -615,7 +616,7 @@ void pim_ifchannel_join_add(struct interface *ifp,
return;
}
ch = pim_ifchannel_add(ifp, sg);
ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_PIM);
if (!ch)
return;
@ -715,7 +716,7 @@ void pim_ifchannel_prune(struct interface *ifp,
return;
}
ch = pim_ifchannel_add(ifp, sg);
ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_PIM);
if (!ch)
return;
@ -772,7 +773,7 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
if (!PIM_IF_TEST_PIM(pim_ifp->options))
return;
ch = pim_ifchannel_add(ifp, sg);
ch = pim_ifchannel_add(ifp, sg, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP);
if (!ch) {
return;
}

View File

@ -105,7 +105,7 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp);
struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
struct prefix_sg *sg);
struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
struct prefix_sg *sg);
struct prefix_sg *sg, int flags);
void pim_ifchannel_join_add(struct interface *ifp,
struct in_addr neigh_addr,
struct in_addr upstream,

View File

@ -136,7 +136,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
return 0;
}
up = pim_upstream_add (&sg, ifp);
up = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR);
if (!up) {
if (PIM_DEBUG_MROUTE) {
zlog_debug("%s: Failure to add upstream information for %s",
@ -363,7 +363,7 @@ pim_mroute_msg_wrvifwhole (int fd, struct interface *ifp, const char *buf)
pim_mroute_add (oil);
if (pim_if_connected_to_source (ifp, sg.src))
{
up = pim_upstream_add (&sg, ifp);
up = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_FHR);
if (!up)
{
if (PIM_DEBUG_MROUTE)

View File

@ -333,7 +333,7 @@ pim_register_recv (struct interface *ifp,
*/
if (!upstream)
{
upstream = pim_upstream_add (&sg, ifp);
upstream = pim_upstream_add (&sg, ifp, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM);
if (!upstream)
{
zlog_warn ("Failure to create upstream state");

View File

@ -46,7 +46,6 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
int found = 0;
int i = 0;
neighbor_needed = 0;
memset (nexthop_tab, 0, sizeof (struct pim_zlookup_nexthop) * MULTIPATH_NUM);
num_ifindex = zclient_lookup_nexthop(nexthop_tab,
MULTIPATH_NUM,
@ -87,7 +86,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
ifp->name, first_ifindex, addr_str);
}
if (neighbor_needed)
if (neighbor_needed && !pim_if_connected_to_source (ifp, addr))
{
struct pim_neighbor *nbr;
@ -148,7 +147,9 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct in_addr *old_
save_rpf_addr = rpf->rpf_addr; /* detect change in RPF'(S,G) */
if (pim_nexthop_lookup(&rpf->source_nexthop,
up->upstream_addr, !PIM_UPSTREAM_FLAG_TEST_FHR (up->flags))) {
up->upstream_addr,
!PIM_UPSTREAM_FLAG_TEST_FHR (up->flags) &&
!PIM_UPSTREAM_FLAG_TEST_SRC_IGMP (up->flags))) {
return PIM_RPF_FAILURE;
}

View File

@ -468,7 +468,8 @@ pim_upstream_switch(struct pim_upstream *up,
}
static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
struct interface *incoming)
struct interface *incoming,
int flags)
{
struct pim_upstream *up;
enum pim_rpf_result rpf_result;
@ -492,7 +493,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
up->parent = pim_upstream_find_parent (sg);
pim_upstream_find_new_children (up);
up->flags = 0;
up->flags = flags;
up->ref_count = 1;
up->t_join_timer = NULL;
up->t_ka_timer = NULL;
@ -512,6 +513,9 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
rpf_result = pim_rpf_update(up, NULL);
if (rpf_result == PIM_RPF_FAILURE) {
if (PIM_DEBUG_PIM_TRACE)
zlog_debug ("%s: Attempting to create upstream(%s), Unable to RPF for source", __PRETTY_FUNCTION__,
pim_str_sg_dump (&up->sg));
XFREE(MTYPE_PIM_UPSTREAM, up);
return NULL;
}
@ -557,7 +561,8 @@ struct pim_upstream *pim_upstream_find(struct prefix_sg *sg)
}
struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
struct interface *incoming)
struct interface *incoming,
int flags)
{
struct pim_upstream *up;
@ -566,7 +571,7 @@ struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
++up->ref_count;
}
else {
up = pim_upstream_new(sg, incoming);
up = pim_upstream_new(sg, incoming, flags);
}
return up;

View File

@ -113,7 +113,7 @@ void pim_upstream_delete(struct pim_upstream *up);
struct pim_upstream *pim_upstream_find (struct prefix_sg *sg);
struct pim_upstream *pim_upstream_find_non_any (struct prefix_sg *sg);
struct pim_upstream *pim_upstream_add (struct prefix_sg *sg,
struct interface *ifp);
struct interface *ifp, int);
void pim_upstream_del(struct pim_upstream *up);
int pim_upstream_evaluate_join_desired(struct pim_upstream *up);