fib: format function for adjacency flags
Type: improvement
Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ib01ed3231321f0f38c4b1deb885c4cf718cc0147
diff --git a/src/vnet/adj/rewrite.c b/src/vnet/adj/rewrite.c
index fc2df9a..5b9ec09 100644
--- a/src/vnet/adj/rewrite.c
+++ b/src/vnet/adj/rewrite.c
@@ -41,6 +41,21 @@
#include <vnet/ip/lookup.h>
u8 *
+format_vnet_rewrite_flags (u8 *s, va_list *ap)
+{
+ vnet_rewrite_flags_t f = va_arg (*ap, int);
+
+ if (f & VNET_REWRITE_HAS_FEATURES)
+ s = format (s, "features ");
+ if (f & VNET_REWRITE_FIXUP_IP4_O_4)
+ s = format (s, "fixup-ip4o4 ");
+ if (f & VNET_REWRITE_FIXUP_FLOW_HASH)
+ s = format (s, "fixup-flow-hash ");
+
+ return (s);
+}
+
+u8 *
format_vnet_rewrite (u8 * s, va_list * args)
{
vnet_rewrite_header_t *rw = va_arg (*args, vnet_rewrite_header_t *);
@@ -61,6 +76,7 @@
}
s = format (s, " mtu:%d next:%d", rw->max_l3_packet_bytes, rw->next_index);
+ s = format (s, " flags:[%U]", format_vnet_rewrite_flags, rw->flags);
/* Format rewrite string. */
if (rw->data_bytes > 0)
diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h
index 496bb14..4234986 100644
--- a/src/vnet/adj/rewrite.h
+++ b/src/vnet/adj/rewrite.h
@@ -67,6 +67,8 @@
VNET_REWRITE_FIXUP_FLOW_HASH = (1 << 2),
} __attribute__ ((packed)) vnet_rewrite_flags_t;
+extern u8 *format_vnet_rewrite_flags (u8 *s, va_list *ap);
+
typedef struct vnet_rewrite_header_t_
{
/* Interface to mark re-written packets with. */