Thread (7 messages) flat view 7 messages, 2 authors, 2021-10-05

Re: [PATCH iproute2-next 1/2] Add support for IOAM encap modes

From: David Ahern <hidden>
Date: 2021-10-05 14:14:06

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];
+}
+
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help