summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--babeld/babeld.c9
-rw-r--r--eigrpd/eigrp_routemap.c6
-rw-r--r--lib/distribute.c30
-rw-r--r--lib/distribute.h8
-rw-r--r--ripd/rip_cli.c4
-rw-r--r--ripngd/ripng_cli.c5
6 files changed, 35 insertions, 27 deletions
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 41fac6251..797d12478 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -710,7 +710,7 @@ DEFUN (babel_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_parser(prefix, true, argv[2 + prefix]->text,
+ return distribute_list_parser(NULL, prefix, true, argv[2 + prefix]->text,
argv[1 + prefix]->arg, ifname);
}
@@ -731,7 +731,7 @@ DEFUN (babel_no_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_no_parser(vty, prefix, true,
+ return distribute_list_no_parser(NULL, vty, prefix, true,
argv[3 + prefix]->text,
argv[2 + prefix]->arg, ifname);
}
@@ -753,7 +753,8 @@ DEFUN (babel_ipv6_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_parser(prefix, false, argv[3 + prefix]->text,
+ return distribute_list_parser(NULL, prefix, false,
+ argv[3 + prefix]->text,
argv[2 + prefix]->arg, ifname);
}
@@ -775,7 +776,7 @@ DEFUN (babel_no_ipv6_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_no_parser(vty, prefix, false,
+ return distribute_list_no_parser(NULL, vty, prefix, false,
argv[4 + prefix]->text,
argv[3 + prefix]->arg, ifname);
}
diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c
index 84f27d016..5a1634592 100644
--- a/eigrpd/eigrp_routemap.c
+++ b/eigrpd/eigrp_routemap.c
@@ -1123,7 +1123,7 @@ DEFUN (eigrp_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_parser(prefix, true, argv[2 + prefix]->text,
+ return distribute_list_parser(NULL, prefix, true, argv[2 + prefix]->text,
argv[1 + prefix]->arg, ifname);
}
@@ -1144,14 +1144,14 @@ DEFUN (eigrp_no_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_no_parser(vty, prefix, true,
+ return distribute_list_no_parser(NULL, vty, prefix, true,
argv[3 + prefix]->text,
argv[2 + prefix]->arg, ifname);
}
/* Route-map init */
-void eigrp_route_map_init()
+void eigrp_route_map_init(void)
{
route_map_init();
route_map_init_vty();
diff --git a/lib/distribute.c b/lib/distribute.c
index 719bac4fa..8d1fca9a9 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -244,11 +244,13 @@ static enum distribute_type distribute_direction(const char *dir, bool v4)
__builtin_unreachable();
}
-int distribute_list_parser(bool prefix, bool v4, const char *dir,
- const char *list, const char *ifname)
+int distribute_list_parser(struct distribute_ctx *ctx, bool prefix, bool v4,
+ const char *dir, const char *list, const char *ifname)
{
enum distribute_type type = distribute_direction(dir, v4);
- struct distribute_ctx *ctx = listnode_head(dist_ctx_list);
+
+ if (!ctx)
+ ctx = listnode_head(dist_ctx_list);
void (*distfn)(struct distribute_ctx *, const char *,
enum distribute_type, const char *) =
@@ -259,14 +261,17 @@ int distribute_list_parser(bool prefix, bool v4, const char *dir,
return CMD_SUCCESS;
}
-int distribute_list_no_parser(struct vty *vty, bool prefix, bool v4,
- const char *dir, const char *list,
- const char *ifname)
+
+int distribute_list_no_parser(struct distribute_ctx *ctx, struct vty *vty,
+ bool prefix, bool v4, const char *dir,
+ const char *list, const char *ifname)
{
enum distribute_type type = distribute_direction(dir, v4);
- struct distribute_ctx *ctx = listnode_head(dist_ctx_list);
int ret;
+ if (!ctx)
+ ctx = listnode_head(dist_ctx_list);
+
int (*distfn)(struct distribute_ctx *, const char *,
enum distribute_type, const char *) =
prefix ? &distribute_list_prefix_unset : &distribute_list_unset;
@@ -451,8 +456,7 @@ int config_write_distribute(struct vty *vty,
int group_distribute_list_create_helper(
struct nb_cb_create_args *args, struct distribute_ctx *ctx)
{
- /* The code currently doesn't require this as it uses a global */
- /* nb_running_set_entry(args->dnode, ctx); */
+ nb_running_set_entry(args->dnode, ctx);
return NB_OK;
}
@@ -469,23 +473,23 @@ int group_distribute_list_destroy(struct nb_cb_destroy_args *args)
static int distribute_list_leaf_update(const struct lyd_node *dnode,
int ip_version, bool no)
{
+ struct distribute_ctx *ctx;
struct lyd_node *dir_node = lyd_parent(dnode);
struct lyd_node_inner *list_node = dir_node->parent;
struct lyd_node *intf_key = list_node->child;
bool ipv4 = ip_version == 4 ? true : false;
bool prefix;
- /* The code currently doesn't require this as it uses a global */
- /* ctx = nb_running_get_entry_non_rec(&list_node->node, NULL, false); */
+ ctx = nb_running_get_entry_non_rec(&list_node->node, NULL, false);
prefix = dnode->schema->name[0] == 'p' ? true : false;
if (no)
- distribute_list_no_parser(NULL, prefix, ipv4,
+ distribute_list_no_parser(ctx, NULL, prefix, ipv4,
dir_node->schema->name,
lyd_get_value(dnode),
lyd_get_value(intf_key));
else
- distribute_list_parser(prefix, ipv4,
+ distribute_list_parser(ctx, prefix, ipv4,
dir_node->schema->name,
lyd_get_value(dnode),
lyd_get_value(intf_key));
diff --git a/lib/distribute.h b/lib/distribute.h
index 6fe890c04..a0bc34898 100644
--- a/lib/distribute.h
+++ b/lib/distribute.h
@@ -70,9 +70,11 @@ extern enum filter_type distribute_apply_in(struct interface *,
extern enum filter_type distribute_apply_out(struct interface *,
struct prefix *);
-extern int distribute_list_parser(bool prefix, bool v4, const char *dir,
- const char *list, const char *ifname);
-extern int distribute_list_no_parser(struct vty *vty, bool prefix, bool v4,
+extern int distribute_list_parser(struct distribute_ctx *ctx, bool prefix,
+ bool v4, const char *dir, const char *list,
+ const char *ifname);
+extern int distribute_list_no_parser(struct distribute_ctx *ctx,
+ struct vty *vty, bool prefix, bool v4,
const char *dir, const char *list,
const char *ifname);
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index d545e692c..a4d306a4d 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -1144,7 +1144,7 @@ DEFUN (rip_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_parser(prefix, true, argv[2 + prefix]->text,
+ return distribute_list_parser(NULL, prefix, true, argv[2 + prefix]->text,
argv[1 + prefix]->arg, ifname);
}
@@ -1165,7 +1165,7 @@ DEFUN (rip_no_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_no_parser(vty, prefix, true,
+ return distribute_list_no_parser(NULL, vty, prefix, true,
argv[3 + prefix]->text,
argv[2 + prefix]->arg, ifname);
}
diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c
index 88b9354d9..c5ffefe96 100644
--- a/ripngd/ripng_cli.c
+++ b/ripngd/ripng_cli.c
@@ -533,7 +533,8 @@ DEFUN (ripng_ipv6_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_parser(prefix, false, argv[3 + prefix]->text,
+ return distribute_list_parser(NULL, prefix, false,
+ argv[3 + prefix]->text,
argv[2 + prefix]->arg, ifname);
}
@@ -555,7 +556,7 @@ DEFUN (ripng_no_ipv6_distribute_list,
if (argv[argc - 1]->type == VARIABLE_TKN)
ifname = argv[argc - 1]->arg;
- return distribute_list_no_parser(vty, prefix, false,
+ return distribute_list_no_parser(NULL, vty, prefix, false,
argv[4 + prefix]->text,
argv[3 + prefix]->arg, ifname);
}