aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gbp')
-rw-r--r--src/plugins/gbp/gbp_api.c17
-rw-r--r--src/plugins/gbp/gbp_ext_itf.c3
-rw-r--r--src/plugins/gbp/gbp_recirc.c6
-rw-r--r--src/plugins/gbp/gbp_recirc.h2
4 files changed, 19 insertions, 9 deletions
diff --git a/src/plugins/gbp/gbp_api.c b/src/plugins/gbp/gbp_api.c
index 85473674de4..8d80365c55d 100644
--- a/src/plugins/gbp/gbp_api.c
+++ b/src/plugins/gbp/gbp_api.c
@@ -645,10 +645,10 @@ vl_api_gbp_recirc_add_del_t_handler (vl_api_gbp_recirc_add_del_t * mp)
goto bad_sw_if_index;
if (mp->is_add)
- gbp_recirc_add (sw_if_index,
- ntohs (mp->recirc.epg_id), mp->recirc.is_ext);
+ rv = gbp_recirc_add (sw_if_index,
+ ntohs (mp->recirc.epg_id), mp->recirc.is_ext);
else
- gbp_recirc_delete (sw_if_index);
+ rv = gbp_recirc_delete (sw_if_index);
BAD_SW_IF_INDEX_LABEL;
@@ -700,17 +700,20 @@ static void
vl_api_gbp_ext_itf_add_del_t_handler (vl_api_gbp_ext_itf_add_del_t * mp)
{
vl_api_gbp_ext_itf_add_del_reply_t *rmp;
- u32 sw_if_index;
+ u32 sw_if_index = ~0;
+ vl_api_gbp_ext_itf_t *ext_itf;
int rv = 0;
- sw_if_index = ntohl (mp->ext_itf.sw_if_index);
+ ext_itf = &mp->ext_itf;
+ if (ext_itf)
+ sw_if_index = ntohl (ext_itf->sw_if_index);
+
if (!vnet_sw_if_index_is_api_valid (sw_if_index))
goto bad_sw_if_index;
if (mp->is_add)
rv = gbp_ext_itf_add (sw_if_index,
- ntohl (mp->ext_itf.bd_id),
- ntohl (mp->ext_itf.rd_id));
+ ntohl (ext_itf->bd_id), ntohl (ext_itf->rd_id));
else
rv = gbp_ext_itf_delete (sw_if_index);
diff --git a/src/plugins/gbp/gbp_ext_itf.c b/src/plugins/gbp/gbp_ext_itf.c
index 57ff625d64a..16cdaa87b77 100644
--- a/src/plugins/gbp/gbp_ext_itf.c
+++ b/src/plugins/gbp/gbp_ext_itf.c
@@ -113,6 +113,9 @@ gbp_ext_itf_delete (u32 sw_if_index)
gbp_ext_itf_t *gx;
index_t gxi;
+ if (vec_len (gbp_ext_itf_db) <= sw_if_index)
+ return (VNET_API_ERROR_INVALID_SW_IF_INDEX);
+
gxi = gbp_ext_itf_db[sw_if_index];
if (INDEX_INVALID != gxi)
diff --git a/src/plugins/gbp/gbp_recirc.c b/src/plugins/gbp/gbp_recirc.c
index d907be01b3c..cee63811bd8 100644
--- a/src/plugins/gbp/gbp_recirc.c
+++ b/src/plugins/gbp/gbp_recirc.c
@@ -171,12 +171,14 @@ gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext)
return (0);
}
-void
+int
gbp_recirc_delete (u32 sw_if_index)
{
gbp_recirc_t *gr;
index_t gri;
+ if (vec_len (gbp_recirc_db) <= sw_if_index)
+ return VNET_API_ERROR_INVALID_SW_IF_INDEX;
gri = gbp_recirc_db[sw_if_index];
if (INDEX_INVALID != gri)
@@ -214,7 +216,9 @@ gbp_recirc_delete (u32 sw_if_index)
gbp_endpoint_group_unlock (gr->gr_epgi);
gbp_recirc_db[sw_if_index] = INDEX_INVALID;
pool_put (gbp_recirc_pool, gr);
+ return (0);
}
+ return VNET_API_ERROR_NO_SUCH_ENTRY;
}
void
diff --git a/src/plugins/gbp/gbp_recirc.h b/src/plugins/gbp/gbp_recirc.h
index c577a5f3ea9..86b857d74a9 100644
--- a/src/plugins/gbp/gbp_recirc.h
+++ b/src/plugins/gbp/gbp_recirc.h
@@ -60,7 +60,7 @@ typedef struct gpb_recirc_t_
} gbp_recirc_t;
extern int gbp_recirc_add (u32 sw_if_index, epg_id_t epg_id, u8 is_ext);
-extern void gbp_recirc_delete (u32 sw_if_index);
+extern int gbp_recirc_delete (u32 sw_if_index);
typedef walk_rc_t (*gbp_recirc_cb_t) (gbp_recirc_t * gbpe, void *ctx);
extern void gbp_recirc_walk (gbp_recirc_cb_t bgpe, void *ctx);