summaryrefslogtreecommitdiffstats
path: root/src/vnet/tunnel
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/tunnel')
-rw-r--r--src/vnet/tunnel/tunnel.c14
-rw-r--r--src/vnet/tunnel/tunnel.h5
-rw-r--r--src/vnet/tunnel/tunnel_types.api2
3 files changed, 18 insertions, 3 deletions
diff --git a/src/vnet/tunnel/tunnel.c b/src/vnet/tunnel/tunnel.c
index 83b1046b526..96d7fd12b52 100644
--- a/src/vnet/tunnel/tunnel.c
+++ b/src/vnet/tunnel/tunnel.c
@@ -34,6 +34,20 @@ format_tunnel_mode (u8 * s, va_list * args)
return (s);
}
+uword
+unformat_tunnel_mode (unformat_input_t * input, va_list * args)
+{
+ tunnel_mode_t *m = va_arg (*args, tunnel_mode_t *);
+
+ if (unformat (input, "p2p"))
+ *m = TUNNEL_MODE_P2P;
+ else if (unformat (input, "p2mp") || unformat (input, "mp"))
+ *m = TUNNEL_MODE_MP;
+ else
+ return 0;
+ return 1;
+}
+
u8 *
format_tunnel_encap_decap_flags (u8 * s, va_list * args)
{
diff --git a/src/vnet/tunnel/tunnel.h b/src/vnet/tunnel/tunnel.h
index e3390f5a165..f23a3d41924 100644
--- a/src/vnet/tunnel/tunnel.h
+++ b/src/vnet/tunnel/tunnel.h
@@ -20,7 +20,7 @@
#include <vlib/vlib.h>
-#define foreach_tunnel_mode \
+#define foreach_tunnel_mode \
_(P2P, "point-to-point") \
_(MP, "multi-point") \
@@ -32,11 +32,12 @@ typedef enum tunnel_mode_t_
} __clib_packed tunnel_mode_t;
extern u8 *format_tunnel_mode (u8 * s, va_list * args);
+extern uword unformat_tunnel_mode (unformat_input_t * input, va_list * args);
/**
* Keep these idenitical to those in ipip.api
*/
-#define forech_tunnel_encap_decap_flag \
+#define forech_tunnel_encap_decap_flag \
_(NONE, "none", 0x0) \
_(ENCAP_COPY_DF, "encap-copy-df", 0x1) \
_(ENCAP_SET_DF, "encap-set-df", 0x2) \
diff --git a/src/vnet/tunnel/tunnel_types.api b/src/vnet/tunnel/tunnel_types.api
index 103948d08c7..98354890016 100644
--- a/src/vnet/tunnel/tunnel_types.api
+++ b/src/vnet/tunnel/tunnel_types.api
@@ -38,7 +38,7 @@ enum tunnel_encap_decap_flags : u8
enum tunnel_mode : u8
{
/** point-to-point */
- TUNNEL_API_MODE_P2P,
+ TUNNEL_API_MODE_P2P = 0,
/** multi-point */
TUNNEL_API_MODE_MP,
};