summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-11-07 10:01:50 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-21 20:26:14 -0500
commit340bce7d3574f2f892334b7beb10bb1c282c5ce6 (patch)
tree63db327ea43a53ee8b41196dabed68a244bf7f49
parent8711a53dbcb643caf2faf4c4691dd787470969d9 (diff)
pimd: Allow further refinement of pim join order
When a 'show ip pim join' is issued and we have (S,G,rpt) being sent back up to us. We need to order correctly for this situation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--pimd/pim_iface.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 5e2fc19f2e..599b18ddce 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -76,17 +76,34 @@ static void *if_list_clean(struct pim_interface *pim_ifp)
static int
pim_ifchannel_compare (struct pim_ifchannel *ch1, struct pim_ifchannel *ch2)
{
- if (ntohl(ch1->sg.grp.s_addr) < ntohl(ch2->sg.grp.s_addr))
- return -1;
+ struct pim_interface *pim_ifp1;
+ struct pim_interface *pim_ifp2;
- if (ntohl(ch1->sg.grp.s_addr) > ntohl(ch2->sg.grp.s_addr))
- return 1;
+ if (ntohl(ch1->sg.grp.s_addr) < ntohl(ch2->sg.grp.s_addr))
+ return -1;
+
+ if (ntohl(ch1->sg.grp.s_addr) > ntohl(ch2->sg.grp.s_addr))
+ return 1;
+
+ if (ntohl(ch1->sg.src.s_addr) < ntohl(ch2->sg.src.s_addr))
+ return -1;
+
+ if (ntohl(ch1->sg.src.s_addr) > ntohl(ch2->sg.src.s_addr))
+ return 1;
- if (ntohl(ch1->sg.src.s_addr) < ntohl(ch2->sg.src.s_addr))
- return -1;
+ pim_ifp1 = ch1->interface->info;
+ pim_ifp2 = ch2->interface->info;
+ if (ntohl(pim_ifp1->primary_address.s_addr) < ntohl(pim_ifp2->primary_address.s_addr))
+ return -1;
+
+ if (ntohl(pim_ifp1->primary_address.s_addr) > ntohl(pim_ifp2->primary_address.s_addr))
+ return 1;
+
+ if (pim_ifp1->mroute_vif_index < pim_ifp2->mroute_vif_index)
+ return -1;
- if (ntohl(ch1->sg.src.s_addr) > ntohl(ch2->sg.src.s_addr))
- return 1;
+ if (pim_ifp1->mroute_vif_index > pim_ifp2->mroute_vif_index)
+ return 1;
return 0;
}