summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/neighbors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/normal/neighbors.c')
-rw-r--r--src/ipcpd/normal/neighbors.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ipcpd/normal/neighbors.c b/src/ipcpd/normal/neighbors.c
index f52a2319..0dbc22f2 100644
--- a/src/ipcpd/normal/neighbors.c
+++ b/src/ipcpd/normal/neighbors.c
@@ -177,6 +177,28 @@ int nbs_del(struct nbs * nbs,
return -1;
}
+bool nbs_has(struct nbs * nbs,
+ uint64_t addr)
+{
+ struct list_head * p = NULL;
+
+ assert(nbs);
+
+ pthread_mutex_lock(&nbs->list_lock);
+
+ list_for_each(p, &nbs->list) {
+ struct nb * e = list_entry(p, struct nb, next);
+ if (e->conn.conn_info.addr == addr) {
+ pthread_mutex_unlock(&nbs->list_lock);
+ return true;
+ }
+ }
+
+ pthread_mutex_unlock(&nbs->list_lock);
+
+ return false;
+}
+
int nbs_reg_notifier(struct nbs * nbs,
struct nb_notifier * notify)
{