diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-16 12:56:59 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-16 18:59:44 -0400 | 
| commit | 06e12762c21bce1586f7dbea2cae05e8345d1b7b (patch) | |
| tree | 29300d0a748020546667db21f8a619b64d492c8a /pimd/pim_jp_agg.c | |
| parent | cb35003fdca20dfd12e260891acc8d0ceef5c03e (diff) | |
pimd: Add code to catch J/P Agg list issues
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_jp_agg.c')
| -rw-r--r-- | pimd/pim_jp_agg.c | 69 | 
1 files changed, 69 insertions, 0 deletions
diff --git a/pimd/pim_jp_agg.c b/pimd/pim_jp_agg.c index 4c1c0c7de1..eb13ebf31b 100644 --- a/pimd/pim_jp_agg.c +++ b/pimd/pim_jp_agg.c @@ -22,6 +22,8 @@  #include "linklist.h"  #include "log.h" +#include "vrf.h" +#include "if.h"  #include "pimd.h"  #include "pim_msg.h" @@ -181,6 +183,73 @@ pim_jp_agg_remove_group (struct list *group, struct pim_upstream *up)      }  } +int +pim_jp_agg_is_in_list (struct list *group, struct pim_upstream *up) +{ +  struct listnode *node, *nnode; +  struct pim_jp_agg_group *jag = NULL; +  struct pim_jp_sources *js = NULL; + +  for (ALL_LIST_ELEMENTS (group, node, nnode, jag)) +    { +      if (jag->group.s_addr == up->sg.grp.s_addr) +        break; +    } + +  if (!jag) +    return 0; + +  for (ALL_LIST_ELEMENTS(jag->sources, node, nnode, js)) +    { +      if (js->up == up) +        return 1; +    } + +  return 0; + } + +//#define PIM_JP_AGG_DEBUG 1 +/* + * For the given upstream, check all the neighbor + * jp_agg lists and ensure that it is not + * in another list + * + * *IF* ignore is true we can skip + * up->rpf.source_nexthop.interface particular interface for checking + * + * This is a debugging function, Probably + * can be safely compiled out in real + * builds + */ +void +pim_jp_agg_upstream_verification (struct pim_upstream *up, bool ignore) +{ +#ifdef PIM_JP_AGG_DEBUG +  struct listnode *node; +  struct interface *ifp; + +  for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) +    { +      struct pim_interface *pim_ifp = ifp->info; +      struct listnode *nnode; + +      if (ignore && ifp == up->rpf.source_nexthop.interface) +        continue; + +      if (pim_ifp) +        { +          struct pim_neighbor *neigh; +          for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, nnode, neigh)) +            { +              assert (!pim_jp_agg_is_in_list(neigh->upstream_jp_agg, up)); +            } +        } +    } +#else +  return; +#endif +} +  void  pim_jp_agg_add_group (struct list *group, struct pim_upstream *up, bool is_join)  {  | 
