From f6438eb3b17bc7cac617480404b12d649fe11c66 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Fri, 18 Apr 2025 17:11:19 +0000 Subject: [PATCH] lib: Extend nexthop vty helper to display SRv6 encap behavior This commit extends the `show ip route` and `show ipv6 route` output to display the SRv6 encapsulation behavior associated with the SRv6 nexthop. ``` router# show ipv6 route Codes: K - kernel route, C - connected, L - local, S - static, R - RIPng, O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, f - OpenFabric, t - Table-Direct, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure IPv6 unicast VRF default: S>* 2001:db8:1:1::2/128 [1/0] is directly connected, sr0, seg6 fcbb:bbbb:7:8:fe00::, weight 1, 00:05:49 S>* 2001:db8:1:1::3/128 [1/0] is directly connected, sr0, seg6 fcbb:bbbb:7:8:fe00::, encap behavior H.Encaps.Red, weight 1, 00:05:49 ... ``` Signed-off-by: Carmine Scarpitta --- lib/nexthop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/nexthop.c b/lib/nexthop.c index 7526dd86f6..09ff295a98 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -1492,6 +1492,11 @@ void nexthop_vty_helper(struct vty *vty, const struct nexthop *nexthop, sizeof(struct in6_addr)); snprintf_seg6_segs(seg_buf, SRV6_SEG_STRLEN, &segs); vty_out(vty, ", seg6 %s", seg_buf); + if (nexthop->nh_srv6->seg6_segs->encap_behavior != + SRV6_HEADEND_BEHAVIOR_H_ENCAPS) + vty_out(vty, ", encap behavior %s", + srv6_headend_behavior2str( + nexthop->nh_srv6->seg6_segs->encap_behavior)); } } -- 2.39.5