acl-plugin: fix pretty-printing in "api trace custom-dump" (VPP-683)

Change-Id: Id15b401223aabe7dacb7566c871ebefc17fbb1fc
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
This commit is contained in:
Andrew Yourtchenko
2017-04-04 20:38:33 +00:00
committed by Damjan Marion
parent 517f72fe18
commit 7fd3f513c7
6 changed files with 391 additions and 317 deletions

View File

@ -22,6 +22,7 @@ acl_plugin_la_SOURCES = \
acl/l2sess.c \
acl/l2sess_node.c \
acl/l2sess.h \
acl/manual_fns.h \
acl/acl_plugin.api.h
API_FILES += acl/acl.api
@ -29,8 +30,9 @@ API_FILES += acl/acl.api
nobase_apiinclude_HEADERS += \
acl/acl_all_api_h.h \
acl/acl_msg_enum.h \
acl/manual_fns.h \
acl/acl.api.h
acl_test_plugin_la_SOURCES = acl/acl_test.c acl/acl_plugin.api.h
acl_test_plugin_la_SOURCES = acl/acl_test.c acl/acl_plugin.api.h acl/acl_all_api.h
# vi:syntax=automake

View File

@ -60,7 +60,7 @@ define acl_plugin_get_version_reply
@param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
*/
typeonly manual_print manual_endian define acl_rule
typeonly manual_print define acl_rule
{
u8 is_permit;
u8 is_ipv6;
@ -104,7 +104,7 @@ typeonly manual_print manual_endian define acl_rule
@param src_ip_prefix_len - Source prefix length
*/
typeonly manual_print manual_endian define macip_acl_rule
typeonly manual_print define macip_acl_rule
{
u8 is_permit;
u8 is_ipv6;
@ -161,7 +161,7 @@ define acl_add_replace_reply
@param acl_index - ACL index to delete
*/
define acl_del
manual_print define acl_del
{
u32 client_index;
u32 context;
@ -190,7 +190,7 @@ define acl_del_reply
@param acl_index - index of ACL for the operation
*/
define acl_interface_add_del
manual_print define acl_interface_add_del
{
u32 client_index;
u32 context;
@ -224,7 +224,7 @@ define acl_interface_add_del_reply
@param acls - vector of ACL indices
*/
manual_endian define acl_interface_set_acl_list
manual_print define acl_interface_set_acl_list
{
u32 client_index;
u32 context;
@ -266,7 +266,7 @@ define acl_dump
@param r - Array of rules within this ACL
*/
manual_print manual_endian define acl_details
manual_endian manual_print define acl_details
{
u32 context;
u32 acl_index;
@ -296,7 +296,7 @@ define acl_interface_list_dump
@param acls - the vector of ACL indices
*/
manual_endian define acl_interface_list_details
define acl_interface_list_details
{
u32 context;
u32 sw_if_index;
@ -313,7 +313,7 @@ manual_endian define acl_interface_list_details
@param r - vector of MACIP ACL rules
*/
manual_print manual_endian define macip_acl_add
manual_endian manual_print define macip_acl_add
{
u32 client_index;
u32 context;
@ -341,7 +341,7 @@ define macip_acl_add_reply
@param acl_index - MACIP ACL index to delete
*/
define macip_acl_del
manual_print define macip_acl_del
{
u32 client_index;
u32 context;
@ -367,7 +367,7 @@ define macip_acl_del_reply
@param acl_index - MACIP ACL index
*/
define macip_acl_interface_add_del
manual_print define macip_acl_interface_add_del
{
u32 client_index;
u32 context;
@ -409,7 +409,7 @@ define macip_acl_dump
@param r - rules comprising this ACL
*/
manual_print manual_endian define macip_acl_details
manual_endian manual_print define macip_acl_details
{
u32 context;
u32 acl_index;

View File

@ -1767,8 +1767,6 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
vl_msg_api_send_shmem (q, (u8 *) & rmp);
}
/* Set up the API message handling tables */
static clib_error_t *
acl_plugin_api_hookup (vlib_main_t * vm)

File diff suppressed because it is too large Load Diff

View File

@ -164,14 +164,14 @@ vl_api_acl_rule_t_pretty_format (u8 *out, vl_api_acl_rule_t * a)
inet_ntop(af, a->src_ip_addr, (void *)src, sizeof(src));
inet_ntop(af, a->dst_ip_addr, (void *)dst, sizeof(dst));
out = format(out, "%s action %d src %s/%d dst %s/%d proto %d sport %d-%d dport %d-%d tcpflags %d %d",
out = format(out, "%s action %d src %s/%d dst %s/%d proto %d sport %d-%d dport %d-%d tcpflags %d mask %d",
a->is_ipv6 ? "ipv6" : "ipv4", a->is_permit,
src, a->src_ip_prefix_len,
dst, a->dst_ip_prefix_len,
a->proto,
a->srcport_or_icmptype_first, a->srcport_or_icmptype_last,
a->dstport_or_icmpcode_first, a->dstport_or_icmpcode_last,
a->tcp_flags_mask, a->tcp_flags_value);
a->tcp_flags_value, a->tcp_flags_mask);
return(out);
}
@ -326,6 +326,7 @@ static int api_acl_add_replace (vat_main_t * vam)
vl_api_acl_rule_t *rules = 0;
int rule_idx = 0;
int n_rules = 0;
int n_rules_override = -1;
u32 proto = 0;
u32 port1 = 0;
u32 port2 = 0;
@ -363,6 +364,10 @@ static int api_acl_add_replace (vat_main_t * vam)
vec_validate_acl_rules(rules, rule_idx);
rules[rule_idx].is_permit = 1;
}
else if (unformat (i, "count %d", &n_rules_override))
{
/* we will use this later */
}
else if (unformat (i, "action %d", &action))
{
vec_validate_acl_rules(rules, rule_idx);
@ -430,6 +435,12 @@ static int api_acl_add_replace (vat_main_t * vam)
rules[rule_idx].tcp_flags_value = tcpflags;
rules[rule_idx].tcp_flags_mask = tcpmask;
}
else if (unformat (i, "tcpflags %d mask %d", &tcpflags, &tcpmask))
{
vec_validate_acl_rules(rules, rule_idx);
rules[rule_idx].tcp_flags_value = tcpflags;
rules[rule_idx].tcp_flags_mask = tcpmask;
}
else if (unformat (i, "proto %d", &proto))
{
vec_validate_acl_rules(rules, rule_idx);
@ -455,6 +466,9 @@ static int api_acl_add_replace (vat_main_t * vam)
else
n_rules = 0;
if (n_rules_override >= 0)
n_rules = n_rules_override;
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
@ -812,6 +826,7 @@ static int api_macip_acl_add (vat_main_t * vam)
vl_api_macip_acl_rule_t *rules = 0;
int rule_idx = 0;
int n_rules = 0;
int n_rules_override = -1;
u32 src_prefix_length = 0;
u32 action = 0;
ip4_address_t src_v4address;
@ -843,6 +858,10 @@ static int api_macip_acl_add (vat_main_t * vam)
vec_validate_macip_acl_rules(rules, rule_idx);
rules[rule_idx].is_permit = 0;
}
else if (unformat (i, "count %d", &n_rules_override))
{
/* we will use this later */
}
else if (unformat (i, "action %d", &action))
{
vec_validate_macip_acl_rules(rules, rule_idx);
@ -856,6 +875,10 @@ static int api_macip_acl_add (vat_main_t * vam)
rules[rule_idx].src_ip_prefix_len = src_prefix_length;
rules[rule_idx].is_ipv6 = 0;
}
else if (unformat (i, "src"))
{
/* Everything in MACIP is "source" but allow this verbosity */
}
else if (unformat (i, "ip %U/%d",
unformat_ip6_address, &src_v6address, &src_prefix_length))
{
@ -897,6 +920,9 @@ static int api_macip_acl_add (vat_main_t * vam)
else
n_rules = 0;
if (n_rules_override >= 0)
n_rules = n_rules_override;
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);

File diff suppressed because it is too large Load Diff