#include "ripngd/ripngd.h"
-static struct list *ripng_offset_list_master;
-
#define OFFSET_LIST_IN_NAME(O) ((O)->direct[RIPNG_OFFSET_LIST_IN].alist_name)
#define OFFSET_LIST_IN_METRIC(O) ((O)->direct[RIPNG_OFFSET_LIST_IN].metric)
new = XCALLOC(MTYPE_RIPNG_OFFSET_LIST,
sizeof(struct ripng_offset_list));
new->ifname = strdup(ifname);
- listnode_add_sort(ripng_offset_list_master, new);
+ listnode_add_sort(ripng->offset_list_master, new);
return new;
}
void ripng_offset_list_del(struct ripng_offset_list *offset)
{
- listnode_delete(ripng_offset_list_master, offset);
+ listnode_delete(ripng->offset_list_master, offset);
if (OFFSET_LIST_IN_NAME(offset))
free(OFFSET_LIST_IN_NAME(offset));
if (OFFSET_LIST_OUT_NAME(offset))
struct ripng_offset_list *offset;
struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS(ripng_offset_list_master, node, nnode, offset)) {
+ for (ALL_LIST_ELEMENTS(ripng->offset_list_master, node, nnode,
+ offset)) {
if (strcmp(offset->ifname, ifname) == 0)
return offset;
}
return 0;
}
-static int offset_list_cmp(struct ripng_offset_list *o1,
- struct ripng_offset_list *o2)
+int offset_list_cmp(struct ripng_offset_list *o1, struct ripng_offset_list *o2)
{
return strcmp(o1->ifname, o2->ifname);
}
-
-void ripng_offset_init(void)
-{
- ripng_offset_list_master = list_new();
- ripng_offset_list_master->cmp =
- (int (*)(void *, void *))offset_list_cmp;
- ripng_offset_list_master->del = (void (*)(void *))ripng_offset_list_del;
-}
-
-void ripng_offset_clean(void)
-{
- list_delete(&ripng_offset_list_master);
-
- ripng_offset_list_master = list_new();
- ripng_offset_list_master->cmp =
- (int (*)(void *, void *))offset_list_cmp;
- ripng_offset_list_master->del = (void (*)(void *))ripng_offset_list_del;
-}
ripng->enable_if = vector_init(1);
ripng->enable_network = agg_table_init();
ripng->passive_interface = vector_init(1);
+ ripng->offset_list_master = list_new();
+ ripng->offset_list_master->cmp =
+ (int (*)(void *, void *))offset_list_cmp;
+ ripng->offset_list_master->del =
+ (void (*)(void *))ripng_offset_list_del;
/* Distribute list install. */
ripng->distribute_ctx = distribute_list_ctx_create(
vector_free(ripng->enable_if);
agg_table_finish(ripng->enable_network);
vector_free(ripng->passive_interface);
- ripng_offset_clean();
+ list_delete(&ripng->offset_list_master);
ripng_interface_clean();
ripng_redistribute_clean();
/* Route-map for interface. */
ripng_route_map_init();
- ripng_offset_init();
route_map_add_hook(ripng_routemap_update);
route_map_delete_hook(ripng_routemap_update);
/* Vector to store passive-interface name. */
vector passive_interface;
+ /* RIPng offset-lists. */
+ struct list *offset_list_master;
+
/* RIPng threads. */
struct thread *t_read;
struct thread *t_write;
uint8_t *);
extern int ripng_offset_list_apply_out(struct prefix_ipv6 *, struct interface *,
uint8_t *);
-extern void ripng_offset_init(void);
-extern void ripng_offset_clean(void);
+extern int offset_list_cmp(struct ripng_offset_list *o1,
+ struct ripng_offset_list *o2);
extern int ripng_route_rte(struct ripng_info *rinfo);
extern struct ripng_info *ripng_info_new(void);