]> git.puffer.fish Git - mirror/frr.git/commitdiff
pathd, tools: fix peer preference config
authorEmanuele Di Pascale <emanuele@voltanet.io>
Tue, 22 Dec 2020 16:00:39 +0000 (17:00 +0100)
committerEmanuele Di Pascale <emanuele@voltanet.io>
Sat, 9 Jan 2021 14:50:17 +0000 (15:50 +0100)
on one hand, the default value for a peer preference was always being
displayed, and on the other there was some code in frr-reload.py which
was attempting to add a default value to match this behavior, and which
was incorrectly overriding a specified preference. Fix this by removing
this code and making pathd behave like other daemons in this respect,
i.e. not displaying the default value.

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
pathd/path_pcep_cli.c
tools/frr-reload.py

index f80814f17c7528f75bb3b93e6ea24e235d34ac3c..1e373040960f0d0e3eb43ebbd85a4b69f13b9868 100644 (file)
@@ -1479,7 +1479,8 @@ int pcep_cli_pcc_config_write(struct vty *vty)
 
                csnprintfrr(buf, sizeof(buf), "    peer %s",
                            pce_opts->pce_name);
-               if (pce_opts->precedence > 0) {
+               if (pce_opts->precedence > 0
+                   && pce_opts->precedence != DEFAULT_PCE_PRECEDENCE) {
                        csnprintfrr(buf, sizeof(buf), " %s %d",
                                    PCEP_VTYSH_ARG_PRECEDENCE,
                                    pce_opts->precedence);
index 5ffa2430b7236c9ac7c887824ca4fd1098884365..e95f0529c505e97f365ea2584a45b4c38a1915aa 100755 (executable)
@@ -683,26 +683,6 @@ end
                 new_ctx = False
                 log.debug("LINE %-50s: entering new context, %-50s", line, ctx_keys)
 
-            elif (
-                line.startswith("peer ")
-                and len(ctx_keys) == 4
-                and ctx_keys[0].startswith("segment-routing")
-                and ctx_keys[1].startswith("traffic-eng")
-                and ctx_keys[2].startswith("pcep")
-                and ctx_keys[3].startswith("pcc")
-            ):
-                # If there is no precedence, we add the default one (255) so
-                # the line is not removed and added back
-                m = re.search('peer ([^ ]*)', line)
-                if (m != None):
-                    (name,) = m.groups()
-                    line = "peer %s precedence 255" % (name,)
-
-                current_context_lines.append(line)
-                log.debug(
-                    "LINE %-50s: append to current_context_lines, %-50s", line, ctx_keys
-                )
-
             elif (
                 line.startswith("address-family ")
                 or line.startswith("vnc defaults")
@@ -1508,7 +1488,7 @@ def compare_context_objects(newconf, running):
             elif (
                 len(running_ctx_keys) == 3
                 and running_ctx_keys[0].startswith('segment-routing')
-                and running_ctx_keys[2].startswith('pcep4')
+                and running_ctx_keys[2].startswith('pcep')
             ):
                 continue