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);
}
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);
}
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);
}
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);
}
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);
}
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();
__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 *) =
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;
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;
}
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));
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);
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);
}
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);
}
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);
}
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);
}