]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Add ability for upstream to know it's ifchannels
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 20 Apr 2017 11:48:27 +0000 (07:48 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 20 Apr 2017 19:59:12 +0000 (15:59 -0400)
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 <sharpd@cumulusnetworks.com>
pimd/pim_ifchannel.c
pimd/pim_upstream.c
pimd/pim_upstream.h

index 5afb8e7737acad6093ce81d7bd9aedc64bea9902..ab01c7f13ec70aa5ffbf967c56d937398fdb2095 100644 (file)
@@ -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;
 }
 
index b9db75f14847e3057a6466a6f0f4a935b3aba057..5f98348c3e082accf40e2ed83aa20b948e0a2ae3 100644 (file)
@@ -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);
 
index e74ee37a128939a0860383448e150f54f5272108..f1c8df35b1671dfa668c72108cd671f55bae1639 100644 (file)
@@ -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;