diff --git a/lib/srv6.h b/lib/srv6.h index 03ada7fcfc..f25c5cfcaa 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -335,24 +335,23 @@ static inline const char *srv6_sid_ctx2str(char *str, size_t size, break; case ZEBRA_SEG6_LOCAL_ACTION_END: - len += snprintf(str + len, size - len, " USP"); + snprintf(str + len, size - len, " USP"); break; case ZEBRA_SEG6_LOCAL_ACTION_END_X: case ZEBRA_SEG6_LOCAL_ACTION_END_DX6: - len += snprintfrr(str + len, size - len, " nh6 %pI6", &ctx->nh6); + snprintfrr(str + len, size - len, " nh6 %pI6", &ctx->nh6); break; case ZEBRA_SEG6_LOCAL_ACTION_END_DX4: - len += snprintfrr(str + len, size - len, " nh4 %pI4", &ctx->nh4); + snprintfrr(str + len, size - len, " nh4 %pI4", &ctx->nh4); break; case ZEBRA_SEG6_LOCAL_ACTION_END_T: case ZEBRA_SEG6_LOCAL_ACTION_END_DT6: case ZEBRA_SEG6_LOCAL_ACTION_END_DT4: case ZEBRA_SEG6_LOCAL_ACTION_END_DT46: - len += snprintf(str + len, size - len, " vrf_id %u", - ctx->vrf_id); + snprintf(str + len, size - len, " vrf_id %u", ctx->vrf_id); break; case ZEBRA_SEG6_LOCAL_ACTION_END_DX2: @@ -364,7 +363,7 @@ static inline const char *srv6_sid_ctx2str(char *str, size_t size, case ZEBRA_SEG6_LOCAL_ACTION_END_AM: case ZEBRA_SEG6_LOCAL_ACTION_END_BPF: default: - len += snprintf(str + len, size - len, " unknown(%s)", __func__); + snprintf(str + len, size - len, " unknown(%s)", __func__); } return str; diff --git a/zebra/zebra_srv6_vty.c b/zebra/zebra_srv6_vty.c index c664a9c69f..5a80524149 100644 --- a/zebra/zebra_srv6_vty.c +++ b/zebra/zebra_srv6_vty.c @@ -969,7 +969,7 @@ static int zebra_sr_config(struct vty *vty) &srv6->encap_src_addr); } } - if (zebra_srv6_is_enable()) { + if (srv6 && zebra_srv6_is_enable()) { vty_out(vty, " locators\n"); for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) { inet_ntop(AF_INET6, &locator->prefix.prefix,