mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 12:37:10 +00:00
ripngd: move "ripng_offset_list_master" to the ripng structure
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
56bf1cb2c3
commit
26c6be9314
@ -33,8 +33,6 @@
|
||||
|
||||
#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)
|
||||
|
||||
@ -48,14 +46,14 @@ struct ripng_offset_list *ripng_offset_list_new(const char *ifname)
|
||||
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))
|
||||
@ -69,7 +67,8 @@ struct ripng_offset_list *ripng_offset_list_lookup(const char *ifname)
|
||||
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;
|
||||
}
|
||||
@ -153,26 +152,7 @@ int ripng_offset_list_apply_out(struct prefix_ipv6 *p, struct interface *ifp,
|
||||
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;
|
||||
}
|
||||
|
@ -1811,6 +1811,11 @@ int ripng_create(int socket)
|
||||
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(
|
||||
@ -2471,7 +2476,7 @@ void ripng_clean()
|
||||
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();
|
||||
|
||||
@ -2583,7 +2588,6 @@ void ripng_init()
|
||||
|
||||
/* 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);
|
||||
|
@ -120,6 +120,9 @@ struct ripng {
|
||||
/* 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;
|
||||
@ -387,8 +390,8 @@ extern int ripng_offset_list_apply_in(struct prefix_ipv6 *, struct interface *,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user