diff options
author | Dave Barach <dave@barachs.net> | 2017-02-22 12:44:56 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-02-23 09:42:01 +0000 |
commit | 4a3f69c17f26e9790db26d0910befe36b5e9f85f (patch) | |
tree | fdc0a151366ca9d289b0cb6a1452aa582db907fd | |
parent | 22dc9df3a8d6669a769b15a90d6ccb911cf49edc (diff) |
Fix vpp built-in version of api_unformat_sw_if_index(...)
Change-Id: I103fe19a1ecbaf3746ec6b957fa1010458cc9fae
Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r-- | src/vat/api_format.c | 50 | ||||
-rw-r--r-- | src/vnet/classify/vnet_classify.c | 4 | ||||
-rw-r--r-- | src/vnet/classify/vnet_classify.h | 1 |
3 files changed, 36 insertions, 19 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 039fca06..226e129e 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -112,6 +112,7 @@ errmsg (char *fmt, ...) vec_free (s); } +#if VPP_API_TEST_BUILTIN == 0 static uword api_unformat_sw_if_index (unformat_input_t * input, va_list * args) { @@ -130,7 +131,6 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args) return 1; } -#if VPP_API_TEST_BUILTIN == 0 /* Parse an IP4 address %d.%d.%d.%d. */ uword unformat_ip4_address (unformat_input_t * input, va_list * args) @@ -387,6 +387,21 @@ unformat_ikev2_id_type (unformat_input_t * input, va_list * args) return 0; return 1; } +#else /* VPP_API_TEST_BUILTIN == 1 */ +static uword +api_unformat_sw_if_index (unformat_input_t * input, va_list * args) +{ + vat_main_t *vam __attribute__ ((unused)) = va_arg (*args, vat_main_t *); + vnet_main_t *vnm = vnet_get_main (); + u32 *result = va_arg (*args, u32 *); + u32 sw_if_index; + + if (!unformat (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) + return 0; + + *result = sw_if_index; + return 1; +} #endif /* VPP_API_TEST_BUILTIN */ static uword @@ -511,6 +526,7 @@ static const char *mfib_flag_long_names[] = MFIB_ENTRY_NAMES_LONG; static const char *mfib_itf_flag_long_names[] = MFIB_ITF_NAMES_LONG; static const char *mfib_itf_flag_names[] = MFIB_ITF_NAMES_SHORT; +#if (VPP_API_TEST_BUILTIN==0) uword unformat_mfib_itf_flags (unformat_input_t * input, va_list * args) { @@ -553,7 +569,6 @@ unformat_mfib_entry_flags (unformat_input_t * input, va_list * args) return (old == *eflags ? 0 : 1); } -#if (VPP_API_TEST_BUILTIN==0) u8 * format_ip4_address (u8 * s, va_list * args) { @@ -8724,6 +8739,12 @@ _(ttl) \ _(protocol) \ _(checksum) +typedef struct +{ + u16 src_port, dst_port; +} tcpudp_header_t; + +#if VPP_API_TEST_BUILTIN == 0 uword unformat_tcp_mask (unformat_input_t * input, va_list * args) { @@ -8806,11 +8827,6 @@ unformat_udp_mask (unformat_input_t * input, va_list * args) return 1; } -typedef struct -{ - u16 src_port, dst_port; -} tcpudp_header_t; - uword unformat_l4_mask (unformat_input_t * input, va_list * args) { @@ -9204,6 +9220,7 @@ unformat_classify_mask (unformat_input_t * input, va_list * args) return 0; } +#endif /* VPP_API_TEST_BUILTIN */ #define foreach_l2_next \ _(drop, DROP) \ @@ -9242,7 +9259,7 @@ _(local, LOCAL) \ _(rewrite, REWRITE) uword -unformat_ip_next_index (unformat_input_t * input, va_list * args) +api_unformat_ip_next_index (unformat_input_t * input, va_list * args) { u32 *miss_next_indexp = va_arg (*args, u32 *); u32 next_index = 0; @@ -9270,7 +9287,7 @@ out: _(deny, DENY) uword -unformat_acl_next_index (unformat_input_t * input, va_list * args) +api_unformat_acl_next_index (unformat_input_t * input, va_list * args) { u32 *miss_next_indexp = va_arg (*args, u32 *); u32 next_index = 0; @@ -9358,13 +9375,13 @@ api_classify_add_del_table (vat_main_t * vam) ; else if (unformat (i, "next-table %d", &next_table_index)) ; - else if (unformat (i, "miss-next %U", unformat_ip_next_index, + else if (unformat (i, "miss-next %U", api_unformat_ip_next_index, &miss_next_index)) ; else if (unformat (i, "l2-miss-next %U", unformat_l2_next_index, &miss_next_index)) ; - else if (unformat (i, "acl-miss-next %U", unformat_acl_next_index, + else if (unformat (i, "acl-miss-next %U", api_unformat_acl_next_index, &miss_next_index)) ; else if (unformat (i, "current-data-flag %d", ¤t_data_flag)) @@ -9421,6 +9438,7 @@ api_classify_add_del_table (vat_main_t * vam) return ret; } +#if VPP_API_TEST_BUILTIN == 0 uword unformat_l4_match (unformat_input_t * input, va_list * args) { @@ -9785,10 +9803,10 @@ unformat_l2_match (unformat_input_t * input, va_list * args) *matchp = match; return 1; } - +#endif uword -unformat_classify_match (unformat_input_t * input, va_list * args) +api_unformat_classify_match (unformat_input_t * input, va_list * args) { u8 **matchp = va_arg (*args, u8 **); u32 skip_n_vectors = va_arg (*args, u32); @@ -9884,13 +9902,13 @@ api_classify_add_del_session (vat_main_t * vam) { if (unformat (i, "del")) is_add = 0; - else if (unformat (i, "hit-next %U", unformat_ip_next_index, + else if (unformat (i, "hit-next %U", api_unformat_ip_next_index, &hit_next_index)) ; else if (unformat (i, "l2-hit-next %U", unformat_l2_next_index, &hit_next_index)) ; - else if (unformat (i, "acl-hit-next %U", unformat_acl_next_index, + else if (unformat (i, "acl-hit-next %U", api_unformat_acl_next_index, &hit_next_index)) ; else if (unformat (i, "policer-hit-next %d", &hit_next_index)) @@ -9903,7 +9921,7 @@ api_classify_add_del_session (vat_main_t * vam) ; else if (unformat (i, "match_n %d", &match_n_vectors)) ; - else if (unformat (i, "match %U", unformat_classify_match, + else if (unformat (i, "match %U", api_unformat_classify_match, &match, skip_n_vectors, match_n_vectors)) ; else if (unformat (i, "advance %d", &advance)) diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c index ce38f9f1..6093e2ac 100644 --- a/src/vnet/classify/vnet_classify.c +++ b/src/vnet/classify/vnet_classify.c @@ -1093,8 +1093,6 @@ uword unformat_l2_mask (unformat_input_t * input, va_list * args) uword unformat_classify_mask (unformat_input_t * input, va_list * args) { - vnet_classify_main_t * CLIB_UNUSED(cm) - = va_arg (*args, vnet_classify_main_t *); u8 ** maskp = va_arg (*args, u8 **); u32 * skipp = va_arg (*args, u32 *); u32 * matchp = va_arg (*args, u32 *); @@ -1417,7 +1415,7 @@ classify_table_command_fn (vlib_main_t * vm, else if (unformat (input, "table %d", &table_index)) ; else if (unformat (input, "mask %U", unformat_classify_mask, - cm, &mask, &skip, &match)) + &mask, &skip, &match)) ; else if (unformat (input, "memory-size %uM", &tmp)) memory_size = tmp<<20; diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h index d0b896ed..2c966632 100644 --- a/src/vnet/classify/vnet_classify.h +++ b/src/vnet/classify/vnet_classify.h @@ -502,6 +502,7 @@ unformat_function_t unformat_ip_next_index; unformat_function_t unformat_ip4_match; unformat_function_t unformat_ip6_match; unformat_function_t unformat_l3_match; +unformat_function_t unformat_l4_match; unformat_function_t unformat_vlan_tag; unformat_function_t unformat_l2_match; unformat_function_t unformat_classify_match; |