mirror of https://gerrit.osmocom.org/libosmocore
vty: fix vty->index for implicit go_parent_node
After this patch, most vty_go_parent() functions are really obsolete, as originally intended: A vty_go_parent() is only needed if the program requires an action to run on VTY node exit. vty_transcript_test.vty shows the fixed behavior. For details, see preceding patch "vty: show bug in implicit go_parent_node" I2472daed7436a1947655b06d34eb217e595bc7f3 Change-Id: Id408c678d18ba19b1c1394c3fb657536153d2094
This commit is contained in:
parent
cc9b699931
commit
67d84d2131
|
@ -61,6 +61,7 @@ struct vty_parent_node {
|
|||
|
||||
/*! private data, specified by creator */
|
||||
void *priv;
|
||||
void *index;
|
||||
|
||||
/*! Node status of this vty */
|
||||
int node;
|
||||
|
|
|
@ -2438,6 +2438,7 @@ static bool vty_pop_parent(struct vty *vty)
|
|||
llist_del(&parent->entry);
|
||||
vty->node = parent->node;
|
||||
vty->priv = parent->priv;
|
||||
vty->index = parent->index;
|
||||
if (vty->indent)
|
||||
talloc_free(vty->indent);
|
||||
vty->indent = parent->indent;
|
||||
|
@ -2648,6 +2649,7 @@ cmd_execute_command_real(vector vline, struct vty *vty,
|
|||
struct vty_parent_node this_node = {
|
||||
.node = vty->node,
|
||||
.priv = vty->priv,
|
||||
.index = vty->index,
|
||||
.indent = vty->indent,
|
||||
};
|
||||
struct vty_parent_node *parent = vty_parent(vty);
|
||||
|
@ -2923,6 +2925,7 @@ int config_from_file(struct vty *vty, FILE * fp)
|
|||
this_node = (struct vty_parent_node){
|
||||
.node = vty->node,
|
||||
.priv = vty->priv,
|
||||
.index = vty->index,
|
||||
.indent = vty->indent,
|
||||
};
|
||||
|
||||
|
|
|
@ -191,12 +191,10 @@ vty_transcript_test(config-c)# state
|
|||
C
|
||||
vty_transcript_test(config-c)# exit
|
||||
vty_transcript_test(config-b)# state
|
||||
C
|
||||
vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B
|
||||
B
|
||||
vty_transcript_test(config-b)# exit
|
||||
vty_transcript_test(config-a)# state
|
||||
C
|
||||
vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A
|
||||
A
|
||||
vty_transcript_test(config-a)# nest B2
|
||||
vty_transcript_test(config-b)# state
|
||||
B2
|
||||
|
@ -205,9 +203,7 @@ vty_transcript_test(config-c)# state
|
|||
C2
|
||||
vty_transcript_test(config-c)# exit
|
||||
vty_transcript_test(config-b)# state
|
||||
C2
|
||||
vty_transcript_test(config-b)# ### ^ EXPECTED ERROR: this should say B2
|
||||
B2
|
||||
vty_transcript_test(config-b)# exit
|
||||
vty_transcript_test(config-a)# state
|
||||
C2
|
||||
vty_transcript_test(config-a)# ### ^ EXPECTED ERROR: this should say A
|
||||
A
|
||||
|
|
Loading…
Reference in New Issue