]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Add the ability to lookup neighbor on a interface
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 7 Sep 2016 19:34:29 +0000 (15:34 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:08 +0000 (20:26 -0500)
On a specified interface return the single
neighbor on that interface.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_neighbor.c
pimd/pim_neighbor.h

index 61e19d80056b08916e1b78965b390a209781b837..ba2fc753b3b7fbcca0046e109c485ccbeba08b41 100644 (file)
@@ -403,6 +403,22 @@ struct pim_neighbor *pim_neighbor_find(struct interface *ifp,
   return 0;
 }
 
+/*
+ * Find the *one* interface out
+ * this interface.  If more than
+ * one return NULL
+ */
+struct pim_neighbor *
+pim_neighbor_find_if (struct interface *ifp)
+{
+  struct pim_interface *pim_ifp = ifp->info;
+
+  if (pim_ifp->pim_neighbor_list->count != 1)
+    return NULL;
+
+  return listnode_head (pim_ifp->pim_neighbor_list);
+}
+
 struct pim_neighbor *pim_neighbor_add(struct interface *ifp,
                                      struct in_addr source_addr,
                                      pim_hello_options hello_options,
index 4bf78d063ea8e3c2944b3fa66ab8dddc6fccf5c0..3f5a121d4c3f461c5969d37db59831668da9d19d 100644 (file)
@@ -48,6 +48,8 @@ void pim_neighbor_free(struct pim_neighbor *neigh);
 struct pim_neighbor *pim_neighbor_find(struct interface *ifp,
                                       struct in_addr source_addr);
 
+struct pim_neighbor *pim_neighbor_find_if (struct interface *ifp);
+
 
 #define PIM_NEIGHBOR_SEND_DELAY 0
 #define PIM_NEIGHBOR_SEND_NOW   1