summaryrefslogtreecommitdiffstats
path: root/isisd/isis_dynhn.c
diff options
context:
space:
mode:
authorJosh Bailey <joshb@google.com>2012-03-24 16:35:20 +0100
committerAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-07 22:54:37 +0200
commit3f045a08812525505e165deea99a79447b44506b (patch)
treea5c944b0584e0e5a14908a2ac9476637e7c1d7e6 /isisd/isis_dynhn.c
parentzebra: tweak deletion of routes without nexthop addr (diff)
downloadfrr-3f045a08812525505e165deea99a79447b44506b.tar.xz
frr-3f045a08812525505e165deea99a79447b44506b.zip
isisd: add Google's changes to IS-IS
Diffstat (limited to 'isisd/isis_dynhn.c')
-rw-r--r--isisd/isis_dynhn.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c
index 0b758c856..ffb0d503f 100644
--- a/isisd/isis_dynhn.c
+++ b/isisd/isis_dynhn.c
@@ -41,8 +41,6 @@
#include "isisd/isis_misc.h"
#include "isisd/isis_constants.h"
-extern struct isis *isis;
-extern struct thread_master *master;
extern struct host host;
struct list *dyn_cache = NULL;
@@ -51,7 +49,8 @@ static int dyn_cache_cleanup (struct thread *);
void
dyn_cache_init (void)
{
- dyn_cache = list_new ();
+ if (dyn_cache == NULL)
+ dyn_cache = list_new ();
THREAD_TIMER_ON (master, isis->t_dync_clean, dyn_cache_cleanup, NULL, 120);
return;
}
@@ -67,8 +66,8 @@ dyn_cache_cleanup (struct thread *thread)
for (ALL_LIST_ELEMENTS (dyn_cache, node, nnode, dyn))
{
- if ((now - dyn->refresh) < (MAX_AGE + 120))
- continue;
+ if ((now - dyn->refresh) < MAX_LSP_LIFETIME)
+ continue;
list_delete_node (dyn_cache, node);
XFREE (MTYPE_ISIS_DYNHN, dyn);
@@ -91,6 +90,19 @@ dynhn_find_by_id (u_char * id)
return NULL;
}
+struct isis_dynhn *
+dynhn_find_by_name (const char *hostname)
+{
+ struct listnode *node = NULL;
+ struct isis_dynhn *dyn = NULL;
+
+ for (ALL_LIST_ELEMENTS_RO (dyn_cache, node, dyn))
+ if (strncmp ((char *)dyn->name.name, hostname, 255) == 0)
+ return dyn;
+
+ return NULL;
+}
+
void
isis_dynhn_insert (u_char * id, struct hostname *hostname, int level)
{
@@ -122,6 +134,19 @@ isis_dynhn_insert (u_char * id, struct hostname *hostname, int level)
return;
}
+void
+isis_dynhn_remove (u_char * id)
+{
+ struct isis_dynhn *dyn;
+
+ dyn = dynhn_find_by_id (id);
+ if (!dyn)
+ return;
+ listnode_delete (dyn_cache, dyn);
+ XFREE (MTYPE_ISIS_DYNHN, dyn);
+ return;
+}
+
/*
* Level System ID Dynamic Hostname (notag)
* 2 0000.0000.0001 foo-gw