mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 03:53:38 +00:00
pimd: sort qpim_channel_oil_list and qpim_upstream_list
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows "show ip mroute" and "show ip pim upstream" to display the groups in order.
This commit is contained in:
parent
98906696cf
commit
0d4f730c58
@ -77,7 +77,7 @@ pim_add_channel_oil (struct prefix_sg *sg,
|
|||||||
c_oil->oil_ref_count = 1;
|
c_oil->oil_ref_count = 1;
|
||||||
c_oil->installed = 0;
|
c_oil->installed = 0;
|
||||||
|
|
||||||
listnode_add(qpim_channel_oil_list, c_oil);
|
listnode_add_sort(qpim_channel_oil_list, c_oil);
|
||||||
|
|
||||||
return c_oil;
|
return c_oil;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
listnode_add(qpim_upstream_list, up);
|
listnode_add_sort(qpim_upstream_list, up);
|
||||||
|
|
||||||
return up;
|
return up;
|
||||||
}
|
}
|
||||||
|
38
pimd/pimd.c
38
pimd/pimd.c
@ -98,6 +98,42 @@ static void pim_free()
|
|||||||
pim_route_map_terminate();
|
pim_route_map_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
pim_channel_oil_compare (struct channel_oil *c1, struct channel_oil *c2)
|
||||||
|
{
|
||||||
|
if (ntohl(c1->oil.mfcc_mcastgrp.s_addr) < ntohl(c2->oil.mfcc_mcastgrp.s_addr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (ntohl(c1->oil.mfcc_mcastgrp.s_addr) > ntohl(c2->oil.mfcc_mcastgrp.s_addr))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (ntohl(c1->oil.mfcc_origin.s_addr) < ntohl(c2->oil.mfcc_origin.s_addr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (ntohl(c1->oil.mfcc_origin.s_addr) > ntohl(c2->oil.mfcc_origin.s_addr))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
pim_upstream_compare (struct pim_upstream *up1, struct pim_upstream *up2)
|
||||||
|
{
|
||||||
|
if (ntohl(up1->sg.grp.s_addr) < ntohl(up2->sg.grp.s_addr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (ntohl(up1->sg.grp.s_addr) > ntohl(up2->sg.grp.s_addr))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (ntohl(up1->sg.src.s_addr) < ntohl(up2->sg.src.s_addr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (ntohl(up1->sg.src.s_addr) > ntohl(up2->sg.src.s_addr))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void pim_init()
|
void pim_init()
|
||||||
{
|
{
|
||||||
srandom(time(NULL));
|
srandom(time(NULL));
|
||||||
@ -121,6 +157,7 @@ void pim_init()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qpim_channel_oil_list->del = (void (*)(void *)) pim_channel_oil_free;
|
qpim_channel_oil_list->del = (void (*)(void *)) pim_channel_oil_free;
|
||||||
|
qpim_channel_oil_list->cmp = (int (*)(void *, void *)) pim_channel_oil_compare;
|
||||||
|
|
||||||
qpim_upstream_list = list_new();
|
qpim_upstream_list = list_new();
|
||||||
if (!qpim_upstream_list) {
|
if (!qpim_upstream_list) {
|
||||||
@ -130,6 +167,7 @@ void pim_init()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qpim_upstream_list->del = (void (*)(void *)) pim_upstream_free;
|
qpim_upstream_list->del = (void (*)(void *)) pim_upstream_free;
|
||||||
|
qpim_upstream_list->cmp = (int (*)(void *, void *)) pim_upstream_compare;
|
||||||
|
|
||||||
qpim_static_route_list = list_new();
|
qpim_static_route_list = list_new();
|
||||||
if (!qpim_static_route_list) {
|
if (!qpim_static_route_list) {
|
||||||
|
Loading…
Reference in New Issue
Block a user