aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-03-12 04:34:53 -0700
committerNeale Ranns <nranns@cisco.com>2019-03-12 15:45:25 +0000
commitfa0ac2c5668cb8f387a8e16dcf8d2d7154a09fe2 (patch)
treef44fa8ddfe3cf5a706e583904f75f9ef02d281aa /src/plugins/gbp/gbp_api.c
parentda7f7b6164e976a97ff0afb13f488c60461402bc (diff)
GBP: contracts API fixed length of allowed ethertypes
VAPI does not handle two VLAs in one struct. Change-Id: I259c998bef4398ead2bbb9e788350d50c2f05694 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_api.c')
-rw-r--r--src/plugins/gbp/gbp_api.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 3f35555efd1..8878119d766 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -931,8 +931,7 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
u16 *allowed_ethertypes;
index_t *rules;
int ii, rv = 0;
- u8 *data, n_et;
- u16 *et;
+ u8 n_et;
if (mp->is_add)
{
@@ -944,19 +943,15 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
allowed_ethertypes = NULL;
/*
- * move past the variable legnth array of rules to get to the
* allowed ether types
*/
- data = (((u8 *) & mp->contract.n_ether_types) +
- (sizeof (mp->contract.rules[0]) * mp->contract.n_rules));
- n_et = *data;
- et = (u16 *) (++data);
+ n_et = mp->contract.n_ether_types;
vec_validate (allowed_ethertypes, n_et - 1);
for (ii = 0; ii < n_et; ii++)
{
/* leave the ether types in network order */
- allowed_ethertypes[ii] = et[ii];
+ allowed_ethertypes[ii] = mp->contract.allowed_ethertypes[ii];
}
rv = gbp_contract_update (ntohs (mp->contract.sclass),