On 10/4/21 7:06 AM, Justin Iurman wrote:
quoted hunk ↗ jump to hunk
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 218d5086..3641f9ef 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -210,16 +210,54 @@ static void print_encap_rpl(FILE *fp, struct rtattr *encap)
print_rpl_srh(fp, srh);
}
+static const char *ioam6_mode_types[] = {
I think you want to declare this of size IOAM6_IPTUNNEL_MODE_MAX + 1
+ [IOAM6_IPTUNNEL_MODE_INLINE] = "inline",
+ [IOAM6_IPTUNNEL_MODE_ENCAP] = "encap",
+ [IOAM6_IPTUNNEL_MODE_AUTO] = "auto",
+};
+
+static const char *format_ioam6mode_type(int mode)
+{
+ if (mode < IOAM6_IPTUNNEL_MODE_MIN ||
+ mode > IOAM6_IPTUNNEL_MODE_MAX ||
+ !ioam6_mode_types[mode])
otherwise this check is not sufficient.
+ return "<unknown>";
+
+ return ioam6_mode_types[mode];
+}
+