]> git.proxmox.com Git - mirror_frr.git/commitdiff
pbrd: don't silently fail on atomic match MARK change attempts
authorStephen Worley <sworley@cumulusnetworks.com>
Mon, 25 Nov 2019 20:16:35 +0000 (15:16 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Tue, 3 Dec 2019 20:56:00 +0000 (15:56 -0500)
Also don't silently fail when we attempt to atomically change
a match MARK to a new one.

We would overwrite the frist one but never actually install it.

Change it to explicitly fail if a config is already present for
now.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
pbrd/pbr_vty.c

index 5bc94a2b336826f43e56a29e7c580b1f5be6be03..24d3c0fd13d8cf339a4b6c5df404ad55facd5276 100644 (file)
@@ -189,9 +189,14 @@ DEFPY(pbr_map_match_mark, pbr_map_match_mark_cmd,
 #endif
 
        if (!no) {
-               if (pbrms->mark == (uint32_t) mark)
+               if (pbrms->mark && pbrms->mark == (uint32_t)mark)
                        return CMD_SUCCESS;
-               pbrms->mark = (uint32_t) mark;
+               else if (pbrms->mark) {
+                       vty_out(vty,
+                               "A `match mark XX` command already exists, please remove that first\n");
+                       return CMD_WARNING_CONFIG_FAILED;
+               } else
+                       pbrms->mark = (uint32_t)mark;
        } else {
                pbrms->mark = 0;
        }