Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
vlib: add description field in plugin registration
[vpp.git]
/
src
/
plugins
/
acl
/
acl_test.c
diff --git
a/src/plugins/acl/acl_test.c
b/src/plugins/acl/acl_test.c
index
5cacf71
..
23dc6bc
100644
(file)
--- a/
src/plugins/acl/acl_test.c
+++ b/
src/plugins/acl/acl_test.c
@@
-25,6
+25,8
@@
#include <vppinfra/error.h>
#include <vnet/ip/ip.h>
#include <arpa/inet.h>
#include <vppinfra/error.h>
#include <vnet/ip/ip.h>
#include <arpa/inet.h>
+
+#define __plugin_msg_base acl_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
#include <vlibapi/vat_helper_macros.h>
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
@@
-265,7
+267,7
@@
static int api_acl_plugin_get_version (vat_main_t * vam)
acl_test_main_t * sm = &acl_test_main;
vl_api_acl_plugin_get_version_t * mp;
u32 msg_size = sizeof(*mp);
acl_test_main_t * sm = &acl_test_main;
vl_api_acl_plugin_get_version_t * mp;
u32 msg_size = sizeof(*mp);
-
f64 timeou
t;
+
int re
t;
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
@@
-274,12
+276,11
@@
static int api_acl_plugin_get_version (vat_main_t * vam)
mp->client_index = vam->my_client_index;
/* send it... */
mp->client_index = vam->my_client_index;
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
-
- return 0;
+ W (ret);
+ return ret;
}
static int api_macip_acl_interface_get (vat_main_t * vam)
}
static int api_macip_acl_interface_get (vat_main_t * vam)
@@
-287,7
+288,7
@@
static int api_macip_acl_interface_get (vat_main_t * vam)
acl_test_main_t * sm = &acl_test_main;
vl_api_acl_plugin_get_version_t * mp;
u32 msg_size = sizeof(*mp);
acl_test_main_t * sm = &acl_test_main;
vl_api_acl_plugin_get_version_t * mp;
u32 msg_size = sizeof(*mp);
-
f64 timeou
t;
+
int re
t;
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
vam->result_ready = 0;
mp = vl_msg_api_alloc_as_if_client(msg_size);
@@
-296,12
+297,11
@@
static int api_macip_acl_interface_get (vat_main_t * vam)
mp->client_index = vam->my_client_index;
/* send it... */
mp->client_index = vam->my_client_index;
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
-
- return 0;
+ W (ret);
+ return ret;
}
#define vec_validate_acl_rules(v, idx) \
}
#define vec_validate_acl_rules(v, idx) \
@@
-319,7
+319,6
@@
static int api_acl_add_replace (vat_main_t * vam)
{
acl_test_main_t * sm = &acl_test_main;
unformat_input_t * i = vam->input;
{
acl_test_main_t * sm = &acl_test_main;
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_acl_add_replace_t * mp;
u32 acl_index = ~0;
u32 msg_size = sizeof (*mp); /* without the rules */
vl_api_acl_add_replace_t * mp;
u32 acl_index = ~0;
u32 msg_size = sizeof (*mp); /* without the rules */
@@
-336,6
+335,7
@@
static int api_acl_add_replace (vat_main_t * vam)
ip4_address_t src_v4address, dst_v4address;
ip6_address_t src_v6address, dst_v6address;
u8 *tag = 0;
ip4_address_t src_v4address, dst_v4address;
ip6_address_t src_v6address, dst_v6address;
u8 *tag = 0;
+ int ret;
if (!unformat (i, "%d", &acl_index)) {
/* Just assume -1 */
if (!unformat (i, "%d", &acl_index)) {
/* Just assume -1 */
@@
-477,18
+477,19
@@
static int api_acl_add_replace (vat_main_t * vam)
mp->count = htonl(n_rules);
/* send it... */
mp->count = htonl(n_rules);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_acl_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_acl_del_t * mp;
u32 acl_index = ~0;
vl_api_acl_del_t * mp;
u32 acl_index = ~0;
+ int ret;
if (!unformat (i, "%d", &acl_index)) {
errmsg ("missing acl index\n");
if (!unformat (i, "%d", &acl_index)) {
errmsg ("missing acl index\n");
@@
-496,22
+497,23
@@
static int api_acl_del (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M(ACL_DEL,
acl_del
);
+ M(ACL_DEL,
mp
);
mp->acl_index = ntohl(acl_index);
/* send it... */
mp->acl_index = ntohl(acl_index);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_macip_acl_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_macip_acl_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_acl_del_t * mp;
u32 acl_index = ~0;
vl_api_acl_del_t * mp;
u32 acl_index = ~0;
+ int ret;
if (!unformat (i, "%d", &acl_index)) {
errmsg ("missing acl index\n");
if (!unformat (i, "%d", &acl_index)) {
errmsg ("missing acl index\n");
@@
-519,25
+521,26
@@
static int api_macip_acl_del (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M(MACIP_ACL_DEL,
acl_del
);
+ M(MACIP_ACL_DEL,
mp
);
mp->acl_index = ntohl(acl_index);
/* send it... */
mp->acl_index = ntohl(acl_index);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_interface_add_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_acl_interface_add_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_acl_interface_add_del_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u8 is_input = 0;
u8 is_add = 0;
vl_api_acl_interface_add_del_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u8 is_input = 0;
u8 is_add = 0;
+ int ret;
// acl_interface_add_del <intfc> | sw_if_index <if-idx> acl_index <acl-idx> [out] [del]
// acl_interface_add_del <intfc> | sw_if_index <if-idx> acl_index <acl-idx> [out] [del]
@@
-583,27
+586,28
@@
static int api_acl_interface_add_del (vat_main_t * vam)
/* Construct the API message */
/* Construct the API message */
- M(ACL_INTERFACE_ADD_DEL,
acl_interface_add_del
);
+ M(ACL_INTERFACE_ADD_DEL,
mp
);
mp->acl_index = ntohl(acl_index);
mp->sw_if_index = ntohl(sw_if_index);
mp->is_add = is_add;
mp->is_input = is_input;
/* send it... */
mp->acl_index = ntohl(acl_index);
mp->sw_if_index = ntohl(sw_if_index);
mp->is_add = is_add;
mp->is_input = is_input;
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_macip_acl_interface_add_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_macip_acl_interface_add_del (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_macip_acl_interface_add_del_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u8 is_add = 0;
vl_api_macip_acl_interface_add_del_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u8 is_add = 0;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@
-634,28
+638,29
@@
static int api_macip_acl_interface_add_del (vat_main_t * vam)
/* Construct the API message */
/* Construct the API message */
- M(MACIP_ACL_INTERFACE_ADD_DEL, m
acip_acl_interface_add_del
);
+ M(MACIP_ACL_INTERFACE_ADD_DEL, m
p
);
mp->acl_index = ntohl(acl_index);
mp->sw_if_index = ntohl(sw_if_index);
mp->is_add = is_add;
/* send it... */
mp->acl_index = ntohl(acl_index);
mp->sw_if_index = ntohl(sw_if_index);
mp->is_add = is_add;
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_interface_set_acl_list (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_acl_interface_set_acl_list (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_acl_interface_set_acl_list_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u32 *inacls = 0;
u32 *outacls = 0;
u8 is_input = 0;
vl_api_acl_interface_set_acl_list_t * mp;
u32 sw_if_index = ~0;
u32 acl_index = ~0;
u32 *inacls = 0;
u32 *outacls = 0;
u8 is_input = 0;
+ int ret;
// acl_interface_set_acl_list <intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]
// acl_interface_set_acl_list <intfc> | sw_if_index <if-idx> input [acl-idx list] output [acl-idx list]
@@
-688,7
+693,7
@@
static int api_acl_interface_set_acl_list (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M2(ACL_INTERFACE_SET_ACL_LIST,
acl_interface_set_acl_list
, sizeof(u32) * (vec_len(inacls) + vec_len(outacls)));
+ M2(ACL_INTERFACE_SET_ACL_LIST,
mp
, sizeof(u32) * (vec_len(inacls) + vec_len(outacls)));
mp->sw_if_index = ntohl(sw_if_index);
mp->n_input = vec_len(inacls);
mp->count = vec_len(inacls) + vec_len(outacls);
mp->sw_if_index = ntohl(sw_if_index);
mp->n_input = vec_len(inacls);
mp->count = vec_len(inacls) + vec_len(outacls);
@@
-697,19
+702,20
@@
static int api_acl_interface_set_acl_list (vat_main_t * vam)
clib_memcpy(mp->acls, inacls, vec_len(inacls)*sizeof(u32));
/* send it... */
clib_memcpy(mp->acls, inacls, vec_len(inacls)*sizeof(u32));
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_interface_list_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_acl_interface_list_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
u32 sw_if_index = ~0;
vl_api_acl_interface_list_dump_t * mp;
u32 sw_if_index = ~0;
vl_api_acl_interface_list_dump_t * mp;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@
-722,22
+728,23
@@
static int api_acl_interface_list_dump (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M(ACL_INTERFACE_LIST_DUMP,
acl_interface_list_du
mp);
+ M(ACL_INTERFACE_LIST_DUMP, mp);
mp->sw_if_index = ntohl (sw_if_index);
/* send it... */
mp->sw_if_index = ntohl (sw_if_index);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_acl_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_acl_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
u32 acl_index = ~0;
vl_api_acl_dump_t * mp;
u32 acl_index = ~0;
vl_api_acl_dump_t * mp;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@
-748,22
+755,23
@@
static int api_acl_dump (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M(ACL_DUMP,
acl_du
mp);
+ M(ACL_DUMP, mp);
mp->acl_index = ntohl (acl_index);
/* send it... */
mp->acl_index = ntohl (acl_index);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
static int api_macip_acl_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
}
static int api_macip_acl_dump (vat_main_t * vam)
{
unformat_input_t * i = vam->input;
- f64 timeout;
u32 acl_index = ~0;
vl_api_acl_dump_t * mp;
u32 acl_index = ~0;
vl_api_acl_dump_t * mp;
+ int ret;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
@@
-774,14
+782,15
@@
static int api_macip_acl_dump (vat_main_t * vam)
}
/* Construct the API message */
}
/* Construct the API message */
- M(MACIP_ACL_DUMP, m
acip_acl_dum
p);
+ M(MACIP_ACL_DUMP, mp);
mp->acl_index = ntohl (acl_index);
/* send it... */
mp->acl_index = ntohl (acl_index);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
#define vec_validate_macip_acl_rules(v, idx) \
}
#define vec_validate_macip_acl_rules(v, idx) \
@@
-797,7
+806,6
@@
static int api_macip_acl_add (vat_main_t * vam)
{
acl_test_main_t * sm = &acl_test_main;
unformat_input_t * i = vam->input;
{
acl_test_main_t * sm = &acl_test_main;
unformat_input_t * i = vam->input;
- f64 timeout;
vl_api_macip_acl_add_t * mp;
u32 msg_size = sizeof (*mp); /* without the rules */
vl_api_macip_acl_add_t * mp;
u32 msg_size = sizeof (*mp); /* without the rules */
@@
-811,6
+819,7
@@
static int api_macip_acl_add (vat_main_t * vam)
u8 src_mac[6];
u8 *tag = 0;
u8 mac_mask_all_1[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
u8 src_mac[6];
u8 *tag = 0;
u8 mac_mask_all_1[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+ int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
@@
-910,10
+919,11
@@
static int api_macip_acl_add (vat_main_t * vam)
mp->count = htonl(n_rules);
/* send it... */
mp->count = htonl(n_rules);
/* send it... */
- S;
+ S
(mp)
;
/* Wait for a reply... */
/* Wait for a reply... */
- W;
+ W (ret);
+ return ret;
}
/*
}
/*