summaryrefslogtreecommitdiff
path: root/lib/nexthop.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2024-05-15 15:36:04 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2024-05-15 15:45:33 +0200
commit4648225b539d0b2c40d55ceb4aae76a9ee92f7dd (patch)
tree06b0d5d8165c3cdbab29da58f1f73286eeeb5479 /lib/nexthop.c
parent05b6cfc71a2516c721c40d2dd92bd8e1934c3df0 (diff)
zebra: fix dump SR-TE information if available
The SR-TE color of nexthop should be displayed in all situations. Fixes: 553c8048460a ("zebra: fix JSON fields for 'show ip/ipv6 nht'") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r--lib/nexthop.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c
index 533641222b..26c338256f 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -1371,7 +1371,6 @@ void nexthop_vty_helper(struct vty *vty, const struct nexthop *nexthop,
char seg_buf[SRV6_SEG_STRLEN];
struct seg6_segs segs;
uint8_t i;
- bool src_p = false;
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
@@ -1433,19 +1432,10 @@ void nexthop_vty_helper(struct vty *vty, const struct nexthop *nexthop,
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
- if (nexthop->rmap_src.ipv4.s_addr) {
+ if (nexthop->rmap_src.ipv4.s_addr)
vty_out(vty, ", rmapsrc %pI4", &nexthop->rmap_src.ipv4);
- src_p = true;
- } else if (nexthop->src.ipv4.s_addr) {
+ else if (nexthop->src.ipv4.s_addr)
vty_out(vty, ", src %pI4", &nexthop->src.ipv4);
- src_p = true;
- }
- if (src_p) {
- /* SR-TE information */
- if (nexthop->srte_color)
- vty_out(vty, ", SR-TE color %u",
- nexthop->srte_color);
- }
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
@@ -1462,6 +1452,10 @@ void nexthop_vty_helper(struct vty *vty, const struct nexthop *nexthop,
break;
}
+ /* SR-TE information */
+ if (nexthop->srte_color)
+ vty_out(vty, ", SR-TE color %u", nexthop->srte_color);
+
/* Label information */
if (nexthop->nh_label && nexthop->nh_label->num_labels) {
vty_out(vty, ", label %s",