aboutsummaryrefslogtreecommitdiffstats
path: root/nsh-plugin/nsh
diff options
context:
space:
mode:
Diffstat (limited to 'nsh-plugin/nsh')
-rw-r--r--nsh-plugin/nsh/nsh.c8
-rw-r--r--nsh-plugin/nsh/nsh.h6
-rw-r--r--nsh-plugin/nsh/nsh_test.c36
3 files changed, 28 insertions, 22 deletions
diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c
index ba1e5f0..3c30af7 100644
--- a/nsh-plugin/nsh/nsh.c
+++ b/nsh-plugin/nsh/nsh.c
@@ -349,7 +349,13 @@ static void vl_api_nsh_add_del_map_t_handler
vl_api_nsh_add_del_map_reply_t * rmp;
nsh_main_t * nm = &nsh_main;
int rv;
- nsh_add_del_map_args_t *a = 0;
+ nsh_add_del_map_args_t _a, *a = &_a;
+
+ a->is_add = mp->is_add;
+ a->map.nsp_nsi = mp->nsp_nsi;
+ a->map.mapped_nsp_nsi = mp->mapped_nsp_nsi;
+ a->map.sw_if_index = mp->sw_if_index;
+ a->map.next_node = mp->next_node;
rv = nsh_add_del_map (a);
diff --git a/nsh-plugin/nsh/nsh.h b/nsh-plugin/nsh/nsh.h
index c574148..0dbc8c8 100644
--- a/nsh-plugin/nsh/nsh.h
+++ b/nsh-plugin/nsh/nsh.h
@@ -24,7 +24,7 @@ typedef struct {
/** Key for nsh_header_t entry: 24bit NSP 8bit NSI */
u32 nsp_nsi;
- /** Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI
+ /** Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI
* This may be ~0 if next action is to decap to NSH next protocol
* Note the following heuristic:
* if nsp_nsi == mapped_nsp_nsi then use-case is like SFC SFF
@@ -42,7 +42,7 @@ typedef struct {
typedef struct {
nsh_map_t map;
- u32 is_add;
+ u8 is_add;
} nsh_add_del_map_args_t;
typedef struct {
@@ -87,7 +87,7 @@ _(nsp_nsi) \
_(c1) \
_(c2) \
_(c3) \
-_(c4)
+_(c4)
/* TODO Temp killing tlvs as its causing pain - fix in NSH_SFC */
#define foreach_32bit_field \
_(nsp_nsi) \
diff --git a/nsh-plugin/nsh/nsh_test.c b/nsh-plugin/nsh/nsh_test.c
index 812b4ab..a2978d5 100644
--- a/nsh-plugin/nsh/nsh_test.c
+++ b/nsh-plugin/nsh/nsh_test.c
@@ -1,5 +1,5 @@
/*
- * nsh.c - skeleton vpp-api-test plug-in
+ * nsh.c - skeleton vpp-api-test plug-in
*
* Copyright (c) <current-year> <your-organization>
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,19 +28,19 @@ uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
/* define message structures */
#define vl_typedefs
-#include <nsh/nsh_all_api_h.h>
+#include <nsh/nsh_all_api_h.h>
#undef vl_typedefs
/* declare message handlers for each api */
#define vl_endianfun /* define message structures */
-#include <nsh/nsh_all_api_h.h>
+#include <nsh/nsh_all_api_h.h>
#undef vl_endianfun
/* instantiate all the print functions we know about */
#define vl_print(handle, ...)
#define vl_printfun
-#include <nsh/nsh_all_api_h.h>
+#include <nsh/nsh_all_api_h.h>
#undef vl_printfun
/* Get the API version number. */
@@ -77,7 +77,7 @@ _(nsh_add_del_map_reply) \
foreach_standard_reply_retval_handler;
#undef _
-/*
+/*
* Table of message reply handlers, must include boilerplate handlers
* we just generated
*/
@@ -176,7 +176,7 @@ static int api_nsh_add_del_entry (vat_main_t * vam)
nsi_set = 1;
else if (unformat (line_input, "tlv %x"))
vec_add1 (tlvs, tmp);
- else
+ else
return -99; // PARSE ERROR;
}
@@ -184,7 +184,7 @@ static int api_nsh_add_del_entry (vat_main_t * vam)
if (nsp_set == 0)
return -1; //TODO Error type for this cond: clib_error_return (0, "nsp not specified");
-
+
if (nsi_set == 0)
return -2; //TODO Error type for this cond:clib_error_return (0, "nsi not specified");
@@ -193,10 +193,10 @@ static int api_nsh_add_del_entry (vat_main_t * vam)
//TODO sort out TLVS and MD Type2 support
md_type = 1;
- length = 6;
+ length = 6;
nsp_nsi = (nsp<<8) | nsi;
-
+
/* Construct the API message */
M(NSH_ADD_DEL_ENTRY, nsh_add_del_entry);
mp->is_add = is_add;
@@ -244,8 +244,8 @@ static int api_nsh_add_del_map (vat_main_t * vam)
next_node = NSH_INPUT_NEXT_ENCAP_VXLANGPE;
else if (unformat (line_input, "encap-none"))
next_node = NSH_INPUT_NEXT_DROP; // Once moved to NSHSFC see nsh.h:foreach_nsh_input_next to handle this case
- else
- return -99; //TODO clib_error_return (0, "parse error: '%U'",
+ else
+ return -99; //TODO clib_error_return (0, "parse error: '%U'",
}
unformat_free (line_input);
@@ -260,7 +260,7 @@ static int api_nsh_add_del_map (vat_main_t * vam)
return -3; //TODO clib_error_return (0, "must specific action: [encap-gre-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-none]");
- M(NSH_ADD_DEL_ENTRY, nsh_add_del_entry);
+ M(NSH_ADD_DEL_MAP, nsh_add_del_map);
/* set args structure */
mp->is_add = is_add;
mp->nsp_nsi = (nsp<< NSH_NSP_SHIFT) | nsi;
@@ -276,7 +276,7 @@ static int api_nsh_add_del_map (vat_main_t * vam)
}
-/*
+/*
* List of messages that the api test plugin sends,
* and that the data plane plugin processes
*/
@@ -295,15 +295,15 @@ void vat_api_hookup (vat_main_t *vam)
vl_noop_handler, \
vl_api_##n##_t_endian, \
vl_api_##n##_t_print, \
- sizeof(vl_api_##n##_t), 1);
+ sizeof(vl_api_##n##_t), 1);
foreach_vpe_api_reply_msg;
#undef _
/* API messages we can send */
#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
foreach_vpe_api_msg;
-#undef _
-
+#undef _
+
/* Help strings */
#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
foreach_vpe_api_msg;
@@ -323,8 +323,8 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
if (sm->msg_id_base != (u16) ~0)
vat_api_hookup (vam);
-
+
vec_free(name);
-
+
return 0;
}