aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/pnat/pnat_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nat/pnat/pnat_api.c')
-rw-r--r--src/plugins/nat/pnat/pnat_api.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/plugins/nat/pnat/pnat_api.c b/src/plugins/nat/pnat/pnat_api.c
index 2c4a1382d2a..442ee7c42c2 100644
--- a/src/plugins/nat/pnat/pnat_api.c
+++ b/src/plugins/nat/pnat/pnat_api.c
@@ -46,11 +46,7 @@ vl_api_pnat_binding_attach_t_handler(vl_api_pnat_binding_attach_t *mp) {
vl_api_pnat_binding_attach_reply_t *rmp;
int rv;
- /* Ensure that the interface exists */
- if (!vnet_sw_if_index_is_api_valid(mp->sw_if_index)) {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto bad_sw_if_index;
- }
+ VALIDATE_SW_IF_INDEX_END(mp);
rv =
pnat_binding_attach(mp->sw_if_index, mp->attachment, mp->binding_index);
@@ -65,11 +61,7 @@ vl_api_pnat_binding_detach_t_handler(vl_api_pnat_binding_detach_t *mp) {
vl_api_pnat_binding_detach_reply_t *rmp;
int rv;
- /* Ensure that the interface exists */
- if (!vnet_sw_if_index_is_api_valid(mp->sw_if_index)) {
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
- goto bad_sw_if_index;
- }
+ VALIDATE_SW_IF_INDEX_END(mp);
rv =
pnat_binding_detach(mp->sw_if_index, mp->attachment, mp->binding_index);