mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:09:17 +00:00
lib: use qobj for vty->index context position
Prepares the library CLI functions for concurrent config access. Note the vty->index pointer is still kept functional for the daemons to use. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
0878c8d423
commit
be301cc256
12
lib/if.c
12
lib/if.c
@ -683,12 +683,11 @@ DEFUN (interface_desc,
|
||||
"Interface specific description\n"
|
||||
"Characters describing this interface\n")
|
||||
{
|
||||
struct interface *ifp;
|
||||
VTY_DECLVAR_CONTEXT (interface, ifp);
|
||||
|
||||
if (argc == 0)
|
||||
return CMD_SUCCESS;
|
||||
|
||||
ifp = vty->index;
|
||||
if (ifp->desc)
|
||||
XFREE (MTYPE_TMP, ifp->desc);
|
||||
ifp->desc = argv_concat(argv, argc, 0);
|
||||
@ -702,9 +701,8 @@ DEFUN (no_interface_desc,
|
||||
NO_STR
|
||||
"Interface specific description\n")
|
||||
{
|
||||
struct interface *ifp;
|
||||
VTY_DECLVAR_CONTEXT (interface, ifp);
|
||||
|
||||
ifp = vty->index;
|
||||
if (ifp->desc)
|
||||
XFREE (MTYPE_TMP, ifp->desc);
|
||||
ifp->desc = NULL;
|
||||
@ -788,8 +786,7 @@ DEFUN (interface,
|
||||
vty_out (vty, "%% interface %s not in %s%s", argv[0], argv[1], VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
vty->index = ifp;
|
||||
vty->node = INTERFACE_NODE;
|
||||
VTY_PUSH_CONTEXT_COMPAT (INTERFACE_NODE, ifp);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -862,8 +859,7 @@ DEFUN (vrf,
|
||||
|
||||
vrfp = vrf_get (VRF_UNKNOWN, argv[0]);
|
||||
|
||||
vty->index = vrfp;
|
||||
vty->node = VRF_NODE;
|
||||
VTY_PUSH_CONTEXT_COMPAT (VRF_NODE, vrfp);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -250,8 +250,7 @@ DEFUN (key_chain,
|
||||
struct keychain *keychain;
|
||||
|
||||
keychain = keychain_get (argv[0]);
|
||||
vty->index = keychain;
|
||||
vty->node = KEYCHAIN_NODE;
|
||||
VTY_PUSH_CONTEXT_COMPAT (KEYCHAIN_NODE, keychain);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -285,12 +284,10 @@ DEFUN (key,
|
||||
"Configure a key\n"
|
||||
"Key identifier number\n")
|
||||
{
|
||||
struct keychain *keychain;
|
||||
VTY_DECLVAR_CONTEXT (keychain, keychain);
|
||||
struct key *key;
|
||||
u_int32_t index;
|
||||
|
||||
keychain = vty->index;
|
||||
|
||||
VTY_GET_INTEGER ("key identifier", index, argv[0]);
|
||||
key = key_get (keychain, index);
|
||||
vty->index_sub = key;
|
||||
@ -306,12 +303,10 @@ DEFUN (no_key,
|
||||
"Delete a key\n"
|
||||
"Key identifier number\n")
|
||||
{
|
||||
struct keychain *keychain;
|
||||
VTY_DECLVAR_CONTEXT (keychain, keychain);
|
||||
struct key *key;
|
||||
u_int32_t index;
|
||||
|
||||
keychain = vty->index;
|
||||
|
||||
VTY_GET_INTEGER ("key identifier", index, argv[0]);
|
||||
key = key_lookup (keychain, index);
|
||||
if (! key)
|
||||
|
@ -1450,8 +1450,7 @@ DEFUN (route_map,
|
||||
map = route_map_get (argv[0]);
|
||||
index = route_map_index_get (map, permit, pref);
|
||||
|
||||
vty->index = index;
|
||||
vty->node = RMAP_NODE;
|
||||
VTY_PUSH_CONTEXT_COMPAT (RMAP_NODE, index);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1552,9 +1551,7 @@ DEFUN (rmap_onmatch_next,
|
||||
"Exit policy on matches\n"
|
||||
"Next clause\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
|
||||
index = vty->index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
if (index)
|
||||
{
|
||||
@ -1577,9 +1574,7 @@ DEFUN (no_rmap_onmatch_next,
|
||||
"Exit policy on matches\n"
|
||||
"Next clause\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
|
||||
index = vty->index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
if (index)
|
||||
index->exitpolicy = RMAP_EXIT;
|
||||
@ -1594,7 +1589,7 @@ DEFUN (rmap_onmatch_goto,
|
||||
"Goto Clause number\n"
|
||||
"Number\n")
|
||||
{
|
||||
struct route_map_index *index = vty->index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
int d = 0;
|
||||
|
||||
if (index)
|
||||
@ -1635,9 +1630,7 @@ DEFUN (no_rmap_onmatch_goto,
|
||||
"Exit policy on matches\n"
|
||||
"Goto Clause number\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
|
||||
index = vty->index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
if (index)
|
||||
index->exitpolicy = RMAP_EXIT;
|
||||
@ -1696,9 +1689,8 @@ DEFUN (rmap_call,
|
||||
"Jump to another Route-Map after match+set\n"
|
||||
"Target route-map name\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
index = vty->index;
|
||||
if (index)
|
||||
{
|
||||
if (index->nextrm)
|
||||
@ -1724,9 +1716,7 @@ DEFUN (no_rmap_call,
|
||||
NO_STR
|
||||
"Jump to another Route-Map after match+set\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
|
||||
index = vty->index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
if (index->nextrm)
|
||||
{
|
||||
@ -1746,9 +1736,8 @@ DEFUN (rmap_description,
|
||||
"Route-map comment\n"
|
||||
"Comment describing this route-map rule\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
index = vty->index;
|
||||
if (index)
|
||||
{
|
||||
if (index->description)
|
||||
@ -1764,9 +1753,8 @@ DEFUN (no_rmap_description,
|
||||
NO_STR
|
||||
"Route-map comment\n")
|
||||
{
|
||||
struct route_map_index *index;
|
||||
struct route_map_index *index = VTY_GET_CONTEXT (route_map_index);
|
||||
|
||||
index = vty->index;
|
||||
if (index)
|
||||
{
|
||||
if (index->description)
|
||||
|
Loading…
Reference in New Issue
Block a user