mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:03:07 +00:00
pbrd: convert gotos in set vrf command to returns
We were doing a bunch of gotos in the set vrf configcode. The code got complex enough that just returning is easier to read. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
9bf1b0f74a
commit
f3f2c78add
@ -423,7 +423,6 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
|
|||||||
"Use the interface's VRF for lookup\n")
|
"Use the interface's VRF for lookup\n")
|
||||||
{
|
{
|
||||||
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
|
struct pbr_map_sequence *pbrms = VTY_GET_CONTEXT(pbr_map_sequence);
|
||||||
int ret = CMD_SUCCESS;
|
|
||||||
|
|
||||||
if (no) {
|
if (no) {
|
||||||
pbr_map_delete_vrf(pbrms);
|
pbr_map_delete_vrf(pbrms);
|
||||||
@ -434,14 +433,13 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
|
|||||||
pbrms->vrf_lookup = false;
|
pbrms->vrf_lookup = false;
|
||||||
pbrms->vrf_unchanged = false;
|
pbrms->vrf_unchanged = false;
|
||||||
|
|
||||||
goto done;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pbrms->nhgrp_name || pbrms->nhg) {
|
if (pbrms->nhgrp_name || pbrms->nhg) {
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"A `set nexthop/nexthop-group XX` command already exits, please remove that first\n");
|
"A `set nexthop/nexthop-group XX` command already exits, please remove that first\n");
|
||||||
ret = CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -459,11 +457,11 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
|
|||||||
!= 0)
|
!= 0)
|
||||||
goto vrf_exists;
|
goto vrf_exists;
|
||||||
|
|
||||||
goto done;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
} else if (!vrf_name && pbrms->vrf_unchanged) {
|
} else if (!vrf_name && pbrms->vrf_unchanged) {
|
||||||
/* Unchanged specified and unchanged already exists */
|
/* Unchanged specified and unchanged already exists */
|
||||||
goto done;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
} else if (vrf_name && pbrms->vrf_unchanged) {
|
} else if (vrf_name && pbrms->vrf_unchanged) {
|
||||||
/* New vrf specified and unchanged is already set */
|
/* New vrf specified and unchanged is already set */
|
||||||
@ -479,8 +477,7 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
|
|||||||
if (!pbr_vrf_lookup_by_name(vrf_name)) {
|
if (!pbr_vrf_lookup_by_name(vrf_name)) {
|
||||||
vty_out(vty, "Specified: %s is non-existent\n",
|
vty_out(vty, "Specified: %s is non-existent\n",
|
||||||
vrf_name);
|
vrf_name);
|
||||||
ret = CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pbrms->vrf_lookup = true;
|
pbrms->vrf_lookup = true;
|
||||||
@ -490,13 +487,11 @@ DEFPY(pbr_map_vrf, pbr_map_vrf_cmd,
|
|||||||
|
|
||||||
pbr_map_check(pbrms);
|
pbr_map_check(pbrms);
|
||||||
|
|
||||||
done:
|
return CMD_SUCCESS;
|
||||||
return ret;
|
|
||||||
|
|
||||||
vrf_exists:
|
vrf_exists:
|
||||||
vty_out(vty, SET_VRF_EXISTS_STR);
|
vty_out(vty, SET_VRF_EXISTS_STR);
|
||||||
ret = CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (pbr_policy,
|
DEFPY (pbr_policy,
|
||||||
|
Loading…
Reference in New Issue
Block a user