]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: display seg6local only when specified
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 12 Apr 2023 09:04:25 +0000 (11:04 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 14 Apr 2023 16:04:01 +0000 (18:04 +0200)
Srv6 routes which configure encap method, may not have
seg6local instructions. Generally speaking, seg6local
attributes that are not specified should not be dumped.

Before:
> B>* 10.200.0.0/24 [20/0] via fd00:125::2, ntfp2 (vrf default), label 16, seg6local unspec unknown(seg6local_context2str), seg6 2001:db8:1:1:1::, weight 1, 0\
0:00:17

After:
> B>* 10.200.0.0/24 [20/0] via fd00:125::2, ntfp2 (vrf default), label 16, seg6 2001:db8:1:1:1::, weight 1, 00:00:17

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
zebra/zebra_rnh.c

index 3bbcd38d1cfe9479293c92bfbc6f3b5b206e67df..5e9995ddf3e72f5efb2aebee0d3a14a7b7b2bbb2 100644 (file)
@@ -1532,10 +1532,12 @@ void show_route_nexthop_helper(struct vty *vty, const struct route_entry *re,
                seg6local_context2str(buf, sizeof(buf),
                                      &nexthop->nh_srv6->seg6local_ctx,
                                      nexthop->nh_srv6->seg6local_action);
-               vty_out(vty, ", seg6local %s %s",
-                       seg6local_action2str(
-                               nexthop->nh_srv6->seg6local_action),
-                       buf);
+               if (nexthop->nh_srv6->seg6local_action !=
+                   ZEBRA_SEG6_LOCAL_ACTION_UNSPEC)
+                       vty_out(vty, ", seg6local %s %s",
+                               seg6local_action2str(
+                                       nexthop->nh_srv6->seg6local_action),
+                               buf);
                vty_out(vty, ", seg6 %pI6", &nexthop->nh_srv6->seg6_segs);
        }