]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/nhrp_nhs.c
Merge pull request #384 from donaldsharp/dr2
[mirror_frr.git] / nhrpd / nhrp_nhs.c
index 10245d308a509845e71c1b2433f99f22c105977c..555c0d1de1fdd8fe72e78aed3d0a4c5f4ddd8320 100644 (file)
@@ -18,19 +18,6 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server")
 DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries")
 
 static int nhrp_nhs_resolve(struct thread *t);
-
-struct nhrp_registration {
-       struct list_head reglist_entry;
-       struct thread *t_register;
-       struct nhrp_nhs *nhs;
-       struct nhrp_reqid reqid;
-       unsigned int timeout;
-       unsigned mark : 1;
-       union sockunion proto_addr;
-       struct nhrp_peer *peer;
-       struct notifier_block peer_notifier;
-};
-
 static int nhrp_reg_send_req(struct thread *t);
 
 static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
@@ -370,3 +357,18 @@ void nhrp_nhs_terminate(void)
                }
        }
 }
+
+void nhrp_nhs_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_nhs *, struct nhrp_registration *, void *), void *ctx)
+{
+       struct nhrp_interface *nifp = ifp->info;
+       struct nhrp_nhs *nhs;
+       struct nhrp_registration *reg;
+
+       list_for_each_entry(nhs, &nifp->afi[afi].nhslist_head, nhslist_entry) {
+               if (!list_empty(&nhs->reglist_head)) {
+                       list_for_each_entry(reg, &nhs->reglist_head, reglist_entry)
+                               cb(nhs, reg, ctx);
+               } else
+                       cb(nhs, 0, ctx);
+       }
+}