]> git.proxmox.com Git - mirror_frr.git/commitdiff
isisd: show non-zero algos in "show isis route prefix-sid" (1/2)
authorLouis Scalbert <louis.scalbert@6wind.com>
Mon, 12 Sep 2022 12:57:51 +0000 (14:57 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Tue, 18 Apr 2023 09:33:15 +0000 (11:33 +0200)
Change the indentation to facilitate the reading of next commit.
No change on code.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
isisd/isis_spf.c

index faaf8d94d34fc4cd4b99a04b837b2a9e79269fc5..9560e0c67a073089d05afd1c02bee4738ee4037f 100644 (file)
@@ -2355,87 +2355,87 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix,
        char buf_prefix[BUFSIZ];
 
        (void)prefix2str(prefix, buf_prefix, sizeof(buf_prefix));
-       for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) {
-               struct interface *ifp;
-               char buf_iface[BUFSIZ];
-               char buf_nhop[BUFSIZ];
-
-               if (!no_adjacencies) {
-                       inet_ntop(nexthop->family, &nexthop->ip, buf_nhop,
-                                 sizeof(buf_nhop));
-                       ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT);
-                       if (ifp)
-                               strlcpy(buf_iface, ifp->name,
-                                       sizeof(buf_iface));
-                       else
-                               snprintf(buf_iface, sizeof(buf_iface),
-                                        "ifindex %u", nexthop->ifindex);
-               } else {
-                       strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid),
-                               sizeof(buf_nhop));
-                       strlcpy(buf_iface, "-", sizeof(buf_iface));
-               }
-
-               if (prefix_sid) {
-                       char buf_sid[BUFSIZ] = {};
-                       char buf_lblop[BUFSIZ] = {};
-
-                       if (nexthop->sr.present) {
-                               snprintf(buf_sid, sizeof(buf_sid), "%u",
-                                        nexthop->sr.sid.value);
-                               sr_op2str(
-                                       buf_lblop, sizeof(buf_lblop),
-                                       rinfo->sr_algo[SR_ALGORITHM_SPF].label,
-                                       nexthop->sr.label);
+               for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) {
+                       struct interface *ifp;
+                       char buf_iface[BUFSIZ];
+                       char buf_nhop[BUFSIZ];
+
+                       if (!no_adjacencies) {
+                               inet_ntop(nexthop->family, &nexthop->ip, buf_nhop,
+                                         sizeof(buf_nhop));
+                               ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT);
+                               if (ifp)
+                                       strlcpy(buf_iface, ifp->name,
+                                               sizeof(buf_iface));
+                               else
+                                       snprintf(buf_iface, sizeof(buf_iface),
+                                                "ifindex %u", nexthop->ifindex);
                        } else {
-                               strlcpy(buf_sid, "-", sizeof(buf_sid));
-                               strlcpy(buf_lblop, "-", sizeof(buf_lblop));
+                               strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid),
+                                       sizeof(buf_nhop));
+                               strlcpy(buf_iface, "-", sizeof(buf_iface));
                        }
 
-                       if (first) {
-                               ttable_add_row(tt, "%s|%u|%s|%s|%s|%s",
-                                              buf_prefix, rinfo->cost,
-                                              buf_iface, buf_nhop, buf_sid,
-                                              buf_lblop);
-                               first = false;
-                       } else
-                               ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface,
-                                              buf_nhop, buf_sid, buf_lblop);
-               } else {
-                       char buf_labels[BUFSIZ] = {};
-
-                       if (nexthop->label_stack) {
-                               for (int i = 0;
-                                    i < nexthop->label_stack->num_labels;
-                                    i++) {
-                                       char buf_label[BUFSIZ];
-
-                                       label2str(
-                                               nexthop->label_stack->label[i],
-                                               0, buf_label,
-                                               sizeof(buf_label));
-                                       if (i != 0)
-                                               strlcat(buf_labels, "/",
-                                                       sizeof(buf_labels));
-                                       strlcat(buf_labels, buf_label,
-                                               sizeof(buf_labels));
+                       if (prefix_sid) {
+                               char buf_sid[BUFSIZ] = {};
+                               char buf_lblop[BUFSIZ] = {};
+
+                               if (nexthop->sr.present) {
+                                       snprintf(buf_sid, sizeof(buf_sid), "%u",
+                                                nexthop->sr.sid.value);
+                                       sr_op2str(
+                                               buf_lblop, sizeof(buf_lblop),
+                                               rinfo->sr_algo[SR_ALGORITHM_SPF].label,
+                                               nexthop->sr.label);
+                               } else {
+                                       strlcpy(buf_sid, "-", sizeof(buf_sid));
+                                       strlcpy(buf_lblop, "-", sizeof(buf_lblop));
                                }
-                       } else if (nexthop->sr.present)
-                               label2str(nexthop->sr.label, 0, buf_labels,
-                                         sizeof(buf_labels));
-                       else
-                               strlcpy(buf_labels, "-", sizeof(buf_labels));
-
-                       if (first) {
-                               ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix,
-                                              rinfo->cost, buf_iface, buf_nhop,
-                                              buf_labels);
-                               first = false;
-                       } else
-                               ttable_add_row(tt, "||%s|%s|%s", buf_iface,
-                                              buf_nhop, buf_labels);
+
+                               if (first) {
+                                       ttable_add_row(tt, "%s|%u|%s|%s|%s|%s",
+                                                          buf_prefix, rinfo->cost,
+                                                          buf_iface, buf_nhop, buf_sid,
+                                                          buf_lblop);
+                                       first = false;
+                               } else
+                                       ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface,
+                                                          buf_nhop, buf_sid, buf_lblop);
+                       } else {
+                               char buf_labels[BUFSIZ] = {};
+
+                               if (nexthop->label_stack) {
+                                       for (int i = 0;
+                                                i < nexthop->label_stack->num_labels;
+                                                i++) {
+                                               char buf_label[BUFSIZ];
+
+                                               label2str(
+                                                       nexthop->label_stack->label[i],
+                                                       0, buf_label,
+                                                       sizeof(buf_label));
+                                               if (i != 0)
+                                                       strlcat(buf_labels, "/",
+                                                               sizeof(buf_labels));
+                                               strlcat(buf_labels, buf_label,
+                                                       sizeof(buf_labels));
+                                       }
+                               } else if (nexthop->sr.present)
+                                       label2str(nexthop->sr.label, 0, buf_labels,
+                                                 sizeof(buf_labels));
+                               else
+                                       strlcpy(buf_labels, "-", sizeof(buf_labels));
+
+                               if (first) {
+                                       ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix,
+                                                          rinfo->cost, buf_iface, buf_nhop,
+                                                          buf_labels);
+                                       first = false;
+                               } else
+                                       ttable_add_row(tt, "||%s|%s|%s", buf_iface,
+                                                          buf_nhop, buf_labels);
+                       }
                }
-       }
        if (list_isempty(rinfo->nexthops)) {
                if (prefix_sid) {
                        char buf_sid[BUFSIZ] = {};