summaryrefslogtreecommitdiff
path: root/lib/vrf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vrf.c')
-rw-r--r--lib/vrf.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 42debe5f1f..d5cff4e2e5 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -377,6 +377,28 @@ vrf_bitmap_check (vrf_bitmap_t bmap, vrf_id_t vrf_id)
VRF_BITMAP_FLAG (offset)) ? 1 : 0;
}
+static void
+vrf_autocomplete (vector comps, struct cmd_token *token)
+{
+ struct vrf *vrf = NULL;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ {
+ if (vrf->vrf_id != 0)
+ vector_set (comps, XSTRDUP (MTYPE_COMPLETION, vrf->name));
+ }
+}
+
+static const struct cmd_variable_handler vrf_var_handlers[] = {
+ {
+ .varname = "vrf",
+ .completions = vrf_autocomplete,
+ },
+ {
+ .completions = NULL
+ },
+};
+
/* Initialize VRF module. */
void
vrf_init (int (*create)(struct vrf *),
@@ -408,6 +430,8 @@ vrf_init (int (*create)(struct vrf *),
zlog_err ("vrf_init: failed to enable the default VRF!");
exit (1);
}
+
+ cmd_variable_handler_register (vrf_var_handlers);
}
/* Terminate VRF module. */