mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 05:58:17 +00:00
pbrd: make vty match *
code more readable
Make the vty match src|dst|mark code a bit more readable in its conditonal logic. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
23e8679f0d
commit
5d0e49c4fc
@ -127,14 +127,16 @@ DEFPY(pbr_map_match_src, pbr_map_match_src_cmd,
|
|||||||
pbrms->family = prefix->family;
|
pbrms->family = prefix->family;
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
if (pbrms->src && prefix_same(pbrms->src, prefix))
|
if (pbrms->src) {
|
||||||
return CMD_SUCCESS;
|
if (prefix_same(pbrms->src, prefix))
|
||||||
else if (pbrms->src) {
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"A `match src-ip XX` command already exists, please remove that first\n");
|
"A `match src-ip XX` command already exists, please remove that first\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
} else
|
}
|
||||||
pbrms->src = prefix_new();
|
|
||||||
|
pbrms->src = prefix_new();
|
||||||
prefix_copy(pbrms->src, prefix);
|
prefix_copy(pbrms->src, prefix);
|
||||||
} else
|
} else
|
||||||
prefix_free(&pbrms->src);
|
prefix_free(&pbrms->src);
|
||||||
@ -157,14 +159,16 @@ DEFPY(pbr_map_match_dst, pbr_map_match_dst_cmd,
|
|||||||
pbrms->family = prefix->family;
|
pbrms->family = prefix->family;
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
if (pbrms->dst && prefix_same(pbrms->dst, prefix))
|
if (pbrms->dst) {
|
||||||
return CMD_SUCCESS;
|
if (prefix_same(pbrms->dst, prefix))
|
||||||
else if (pbrms->dst) {
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"A `match dst-ip XX` command already exists, please remove that first\n");
|
"A `match dst-ip XX` command already exists, please remove that first\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
} else
|
}
|
||||||
pbrms->dst = prefix_new();
|
|
||||||
|
pbrms->dst = prefix_new();
|
||||||
prefix_copy(pbrms->dst, prefix);
|
prefix_copy(pbrms->dst, prefix);
|
||||||
} else
|
} else
|
||||||
prefix_free(&pbrms->dst);
|
prefix_free(&pbrms->dst);
|
||||||
@ -189,17 +193,18 @@ DEFPY(pbr_map_match_mark, pbr_map_match_mark_cmd,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!no) {
|
if (!no) {
|
||||||
if (pbrms->mark && pbrms->mark == (uint32_t)mark)
|
if (pbrms->mark) {
|
||||||
return CMD_SUCCESS;
|
if (pbrms->mark == (uint32_t)mark)
|
||||||
else if (pbrms->mark) {
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
"A `match mark XX` command already exists, please remove that first\n");
|
"A `match mark XX` command already exists, please remove that first\n");
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
} else
|
}
|
||||||
pbrms->mark = (uint32_t)mark;
|
|
||||||
} else {
|
pbrms->mark = (uint32_t)mark;
|
||||||
|
} else
|
||||||
pbrms->mark = 0;
|
pbrms->mark = 0;
|
||||||
}
|
|
||||||
|
|
||||||
pbr_map_check(pbrms);
|
pbr_map_check(pbrms);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user