Skip to content
Snippets Groups Projects
Commit d42712d0 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

librmnetctl: Fix incorrect handling of messages with return type data

When an message with return type data fails in kernel, the error
is handled incorrectly.

Consider a scenario when we try to query the vnd name corresponding
to a non existent vnd id.

/ # rmnetcli getvndname 25
rmnetcli getvndname 25
LIBRARY ERROR: Return type is invalid

We appear to be getting a library error even though the actual
error originates from the kernel. The actual error for this case
should be a kernel error and the return code should be Invalid
request / Unsupported scenario.

Fix this by checking for return codes in case there is an error
when a return data type fails.

Change-Id: Ideb765f786cf19e29f3f496a6c8d7da92e769111
parent 066f7d5f
No related branches found
No related tags found
No related merge requests found
......@@ -438,8 +438,14 @@ int rmnet_get_network_device_associated(rmnetctl_hndl_t *hndl,
!= RMNETCTL_SUCCESS)
break;
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
if (_rmnetctl_check_data(response.crd, error_code)
!= RMNETCTL_SUCCESS) {
if (_rmnetctl_check_code(response.crd, error_code)
== RMNETCTL_SUCCESS)
return_code = _rmnetctl_set_codes(response.return_code,
error_code);
break;
}
*register_status = response.return_code;
return_code = RMNETCTL_SUCCESS;
......@@ -517,8 +523,14 @@ int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
!= RMNETCTL_SUCCESS)
break;
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
if (_rmnetctl_check_data(response.crd, error_code)
!= RMNETCTL_SUCCESS) {
if (_rmnetctl_check_code(response.crd, error_code)
== RMNETCTL_SUCCESS)
return_code = _rmnetctl_set_codes(response.return_code,
error_code);
break;
}
*egress_flags = response.data_format.flags;
*agg_size = response.data_format.agg_size;
......@@ -595,8 +607,14 @@ int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
!= RMNETCTL_SUCCESS)
break;
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
if (_rmnetctl_check_data(response.crd, error_code)
!= RMNETCTL_SUCCESS) {
if (_rmnetctl_check_code(response.crd, error_code)
== RMNETCTL_SUCCESS)
return_code = _rmnetctl_set_codes(response.return_code,
error_code);
break;
}
if (ingress_flags)
*ingress_flags = response.data_format.flags;
......@@ -727,8 +745,15 @@ int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl,
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
!= RMNETCTL_SUCCESS)
break;
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
if (_rmnetctl_check_data(response.crd, error_code)
!= RMNETCTL_SUCCESS) {
if (_rmnetctl_check_code(response.crd, error_code)
== RMNETCTL_SUCCESS)
return_code = _rmnetctl_set_codes(response.return_code,
error_code);
break;
}
str_len = strlcpy(*next_dev,
(char *)(response.local_ep_config.next_dev),
......@@ -819,8 +844,15 @@ int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl,
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
!= RMNETCTL_SUCCESS)
break;
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
if (_rmnetctl_check_data(response.crd, error_code)
!= RMNETCTL_SUCCESS) {
if (_rmnetctl_check_code(response.crd, error_code)
== RMNETCTL_SUCCESS)
return_code = _rmnetctl_set_codes(response.return_code,
error_code);
break;
}
str_len = (uint32_t)strlcpy(buf,
(char *)(response.vnd.vnd_name),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment