-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting the default VNI instead of saying a VNI like this doesn't exist for 'no vni <VNI>' vtysh command #17952
Comments
After some more digging - those are the logs we should focus on:
So the vni_mapping_cmd: DEFPY_YANG (vni_mapping,
vni_mapping_cmd,
"[no] vni ![" CMD_VNI_RANGE "[prefix-routes-only$filter]]",
NO_STR
"VNI corresponding to tenant VRF\n"
"VNI-ID\n"
"prefix-routes-only\n")
{
if (!no)
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id", NB_OP_MODIFY,
vni_str);
else
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/l3vni-id", NB_OP_DESTROY,
NULL);
if (filter)
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/prefix-only",
NB_OP_MODIFY, "true");
else
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/prefix-only",
NB_OP_DESTROY, NULL);
if (vty->node == CONFIG_NODE)
return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']",
VRF_DEFAULT_NAME);
return nb_cli_apply_changes(vty, NULL);
} Passes /* If the value is not set, get the default if it exists. */
value = change->value;
if (value == NULL)
value = yang_snode_get_default(nb_node->snode);
data = yang_data_new(xpath, value); To get the default value of l3vni_id, which is '1' for my config that has I'm not familiar with NB etc., but I think there should be a guard against something like that, either in the vni_mapping_cmd itself or the vni_str should be passed to NB_OP_DESTROY and later on it should be checked. That was the case earlier on, but was deleted here: with the description: "zebra: fix vni NB conversion
But i think it can happen, right - just like with this very simple reproduction? Or am i missing something? Could you take a look @idryzhov? Thanks in advance! |
I'd say there's no uniform rule for things like this in FRR - in many cases we don't check the values on "no" commands, but there are cases where we check. If necessary, the check can be added. It should be done inside the CLI handler, by checking the value of existing field in |
Description
Version
How to reproduce
vtysh -c 'show run'| grep vni
no vni 2
or some other number aside from the one actually therevtysh -c 'show run' | grep vni
Expected behavior
If the VNI doesn't exist it's just returns an error.
Similar to how it looked in FRR-8.4.2:
Actual behavior
It deletes the default VNI instead.
Additional context
Seems to be the result of the frr10 change to the new northbound interface removing this guards here:
https://github.com/FRRouting/frr/pull/15181/files#diff-4a26c99e786bb1ba28c15d6f0330985b4f71bbe6f36ec74215ca6221895827b3L2780-L2856
Which was guarding this kind of behavior before. But it still should be picked up by the lines here:
But it seems it does not for some reason. I will keep on debugging this.
Checklist
The text was updated successfully, but these errors were encountered: