Skip to content

Commit

Permalink
zebra: fix dump SR-TE information if available
Browse files Browse the repository at this point in the history
The SR-TE color of nexthop should be displayed in all situations.

Fixes: 553c804 ("zebra: fix JSON fields for 'show ip/ipv6 nht'")

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed May 15, 2024
1 parent 05b6cfc commit 4648225
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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",
Expand Down

0 comments on commit 4648225

Please sign in to comment.