version 1.1.1.1, 2012/02/21 17:26:11
|
version 1.1.1.3, 2016/11/02 10:09:10
|
Line 41
|
Line 41
|
#include "isisd/isis_misc.h" |
#include "isisd/isis_misc.h" |
#include "isisd/isis_constants.h" |
#include "isisd/isis_constants.h" |
|
|
extern struct isis *isis; |
|
extern struct thread_master *master; |
|
extern struct host host; |
extern struct host host; |
|
|
struct list *dyn_cache = NULL; |
struct list *dyn_cache = NULL; |
Line 51 static int dyn_cache_cleanup (struct thread *);
|
Line 49 static int dyn_cache_cleanup (struct thread *);
|
void |
void |
dyn_cache_init (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); |
THREAD_TIMER_ON (master, isis->t_dync_clean, dyn_cache_cleanup, NULL, 120); |
return; |
return; |
} |
} |
Line 67 dyn_cache_cleanup (struct thread *thread)
|
Line 66 dyn_cache_cleanup (struct thread *thread)
|
|
|
for (ALL_LIST_ELEMENTS (dyn_cache, node, nnode, dyn)) |
for (ALL_LIST_ELEMENTS (dyn_cache, node, nnode, dyn)) |
{ |
{ |
if ((now - dyn->refresh) < (MAX_AGE + 120)) | if ((now - dyn->refresh) < MAX_LSP_LIFETIME) |
continue; | continue; |
|
|
list_delete_node (dyn_cache, node); |
list_delete_node (dyn_cache, node); |
XFREE (MTYPE_ISIS_DYNHN, dyn); |
XFREE (MTYPE_ISIS_DYNHN, dyn); |
Line 79 dyn_cache_cleanup (struct thread *thread)
|
Line 78 dyn_cache_cleanup (struct thread *thread)
|
} |
} |
|
|
struct isis_dynhn * |
struct isis_dynhn * |
dynhn_find_by_id (u_char * id) | dynhn_find_by_id (const u_char * id) |
{ |
{ |
struct listnode *node = NULL; |
struct listnode *node = NULL; |
struct isis_dynhn *dyn = NULL; |
struct isis_dynhn *dyn = NULL; |
Line 91 dynhn_find_by_id (u_char * id)
|
Line 90 dynhn_find_by_id (u_char * id)
|
return NULL; |
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 |
void |
isis_dynhn_insert (u_char * id, struct hostname *hostname, int level) | isis_dynhn_insert (const u_char * id, struct hostname *hostname, int level) |
{ |
{ |
struct isis_dynhn *dyn; |
struct isis_dynhn *dyn; |
|
|
Line 119 isis_dynhn_insert (u_char * id, struct hostname *hostn
|
Line 131 isis_dynhn_insert (u_char * id, struct hostname *hostn
|
|
|
listnode_add (dyn_cache, dyn); |
listnode_add (dyn_cache, dyn); |
|
|
|
return; |
|
} |
|
|
|
void |
|
isis_dynhn_remove (const 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; |
return; |
} |
} |
|
|