diff options
author | Steven Luong <sluong@cisco.com> | 2020-08-10 09:34:07 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-08-24 10:44:31 +0000 |
commit | 3f54d96dac7eda66096ad7068a86fdf4b86cea67 (patch) | |
tree | 4d6a8b6e93ec142af9208a12f4391d8f3a25c148 /src | |
parent | 067ef751d3144b5de29b20ff9384d78304dfe387 (diff) |
bonding: enhance binary api handling
- check input sw_if_index to make sure it is sane. Coverity actually
complains about it.
- return rv. Some of the APIs handlers were not passing back the rv.
Type: improvement
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I8378ea948af561ba2bd9b02fb10bf4f9df2a2cd2
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/bonding/bond_api.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c index 2395a47fe7a..4306e3cba9f 100644 --- a/src/vnet/bonding/bond_api.c +++ b/src/vnet/bonding/bond_api.c @@ -113,12 +113,15 @@ vl_api_bond_add_member_t_handler (vl_api_bond_add_member_t * mp) clib_memset (ap, 0, sizeof (*ap)); ap->group = ntohl (mp->bond_sw_if_index); + VALIDATE_SW_IF_INDEX (mp); ap->member = ntohl (mp->sw_if_index); ap->is_passive = mp->is_passive; ap->is_long_timeout = mp->is_long_timeout; bond_add_member (vm, ap); + rv = ap->rv; + BAD_SW_IF_INDEX_LABEL; REPLY_MACRO (VL_API_BOND_ADD_MEMBER_REPLY); } @@ -133,12 +136,15 @@ vl_api_bond_enslave_t_handler (vl_api_bond_enslave_t * mp) clib_memset (ap, 0, sizeof (*ap)); ap->group = ntohl (mp->bond_sw_if_index); + VALIDATE_SW_IF_INDEX (mp); ap->member = ntohl (mp->sw_if_index); ap->is_passive = mp->is_passive; ap->is_long_timeout = mp->is_long_timeout; bond_add_member (vm, ap); + rv = ap->rv; + BAD_SW_IF_INDEX_LABEL; REPLY_MACRO (VL_API_BOND_ENSLAVE_REPLY); } @@ -157,6 +163,7 @@ static void ap->weight = ntohl (mp->weight); bond_set_intf_weight (vm, ap); + rv = ap->rv; REPLY_MACRO (VL_API_SW_INTERFACE_SET_BOND_WEIGHT_REPLY); } @@ -173,6 +180,7 @@ vl_api_bond_detach_slave_t_handler (vl_api_bond_detach_slave_t * mp) ap->member = ntohl (mp->sw_if_index); bond_detach_member (vm, ap); + rv = ap->rv; REPLY_MACRO (VL_API_BOND_DETACH_SLAVE_REPLY); } @@ -189,6 +197,7 @@ vl_api_bond_detach_member_t_handler (vl_api_bond_detach_member_t * mp) ap->member = ntohl (mp->sw_if_index); bond_detach_member (vm, ap); + rv = ap->rv; REPLY_MACRO (VL_API_BOND_DETACH_MEMBER_REPLY); } |