From 2a28f7a0b9e7d73df353ff296e7990ced524e223 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 20 Apr 2017 07:48:27 -0400 Subject: [PATCH] pimd: Add ability for upstream to know it's ifchannels Add a list structure to track the ifchannels associated with a particular upstream. We are not doing anything with this particular knowledge yet but it will be come useful in the near future. Ticket: CM-15629 Signed-off-by: Donald Sharp --- pimd/pim_ifchannel.c | 4 ++++ pimd/pim_upstream.c | 5 +++++ pimd/pim_upstream.h | 1 + 3 files changed, 10 insertions(+) diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 5afb8e7737..ab01c7f13e 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -175,6 +175,8 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch) if (ch->sources) list_delete (ch->sources); + listnode_delete(ch->upstream->ifchannels, ch); + if (ch->ifjoin_state != PIM_IFJOIN_NOINFO) { pim_upstream_update_join_desired(ch->upstream); } @@ -569,6 +571,8 @@ pim_ifchannel_add(struct interface *ifp, ch = hash_get (pim_ifp->pim_ifchannel_hash, ch, hash_alloc_intern); listnode_add_sort(pim_ifchannel_list, ch); + listnode_add_sort(up->ifchannels, ch); + return ch; } diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b9db75f148..5f98348c3e 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -214,6 +214,8 @@ pim_upstream_del(struct pim_upstream *up, const char *name) } up->sources = NULL; + list_delete (up->ifchannels); + /* notice that listnode_delete() can't be moved into pim_upstream_free() because the later is @@ -673,6 +675,9 @@ pim_upstream_new (struct prefix_sg *sg, up->rpf.rpf_addr.family = AF_INET; up->rpf.rpf_addr.u.prefix4.s_addr = PIM_NET_INADDR_ANY; + up->ifchannels = list_new(); + up->ifchannels->cmp = (int (*)(void *, void *))pim_ifchannel_compare; + if (up->sg.src.s_addr != INADDR_ANY) wheel_add_item (pim_upstream_sg_wheel, up); diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h index e74ee37a12..f1c8df35b1 100644 --- a/pimd/pim_upstream.h +++ b/pimd/pim_upstream.h @@ -100,6 +100,7 @@ struct pim_upstream { uint32_t flags; struct channel_oil *channel_oil; struct list *sources; + struct list *ifchannels; enum pim_upstream_state join_state; enum pim_reg_state reg_state; -- 2.39.5