aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-12-20 12:03:59 -0800
committerNeale Ranns <nranns@cisco.com>2018-12-21 18:12:25 +0000
commit1c17e2ecac42e001ce905418463edcb26fe58b01 (patch)
treea1c5c69e868d28eb3f3b338db4cde65eff7b2534 /src/plugins/gbp/gbp_api.c
parentfc7344f9beffe506085730e8e03f7c8771deb3a6 (diff)
GBP: add allowed ethertypes to contracts
Change-Id: I74782d3b9b71a071bb500c34866a017b8ee15767 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.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 74355d1c033..8ea5a0e6d0a 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -924,8 +924,11 @@ static void
vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
{
vl_api_gbp_contract_add_del_reply_t *rmp;
+ u16 *allowed_ethertypes;
index_t *rules;
- int rv = 0;
+ int ii, rv = 0;
+ u8 *data, n_et;
+ u16 *et;
if (mp->is_add)
{
@@ -934,9 +937,28 @@ vl_api_gbp_contract_add_del_t_handler (vl_api_gbp_contract_add_del_t * mp)
if (0 != rv)
goto out;
+ 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);
+ 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];
+ }
+
rv = gbp_contract_update (ntohs (mp->contract.src_epg),
ntohs (mp->contract.dst_epg),
- ntohl (mp->contract.acl_index), rules);
+ ntohl (mp->contract.acl_index),
+ rules, allowed_ethertypes);
}
else
rv = gbp_contract_delete (ntohs (mp->contract.src_epg),