3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

netdev: Add support for extended errors

This commit is contained in:
Denis Kenzior 2020-04-02 00:30:17 -05:00
parent ad97f4f945
commit 426681aeb2

View File

@ -974,8 +974,15 @@ static struct l_genl_msg *netdev_build_cmd_del_station(struct netdev *netdev,
static void netdev_del_sta_cb(struct l_genl_msg *msg, void *user_data)
{
if (l_genl_msg_get_error(msg) < 0)
l_error("DEL_STATION failed: %i", l_genl_msg_get_error(msg));
int err = l_genl_msg_get_error(msg);
const char *ext_error;
if (err >= 0)
return;
ext_error = l_genl_msg_get_extended_error(msg);
l_error("DEL_STATION failed: %s",
ext_error ? ext_error : strerror(-err));
}
int netdev_del_station(struct netdev *netdev, const uint8_t *sta,
@ -1096,7 +1103,11 @@ static void netdev_set_station_cb(struct l_genl_msg *msg, void *user_data)
goto done;
if (err < 0) {
l_error("Set Station failed for ifindex %d", netdev->index);
const char *ext_error = l_genl_msg_get_extended_error(msg);
l_error("Set Station failed for ifindex %d:%s", netdev->index,
ext_error ? ext_error : strerror(-err));
netdev_setting_keys_failed(nhs, err);
return;
}
@ -1114,8 +1125,12 @@ static void netdev_new_group_key_cb(struct l_genl_msg *msg, void *data)
nhs->group_new_key_cmd_id = 0;
if (err < 0) {
l_error("New Key for Group Key failed for ifindex: %d",
netdev->index);
const char *ext_error = l_genl_msg_get_extended_error(msg);
l_error("New Key for Group Key failed for ifindex: %d:%s",
netdev->index,
ext_error ? ext_error : strerror(-err));
netdev_setting_keys_failed(nhs, err);
return;
}
@ -1134,8 +1149,12 @@ static void netdev_new_group_management_key_cb(struct l_genl_msg *msg,
nhs->group_management_new_key_cmd_id = 0;
if (err < 0) {
l_error("New Key for Group Mgmt failed for ifindex: %d",
netdev->index);
const char *ext_error = l_genl_msg_get_extended_error(msg);
l_error("New Key for Group Mgmt failed for ifindex: %d:%s",
netdev->index,
ext_error ? ext_error : strerror(-err));
netdev_setting_keys_failed(nhs, err);
return;
}
@ -1303,8 +1322,11 @@ static void netdev_new_pairwise_key_cb(struct l_genl_msg *msg, void *data)
nhs->pairwise_new_key_cmd_id = 0;
if (err < 0) {
l_error("New Key for Pairwise Key failed for ifindex: %d",
netdev->index);
const char *ext_error = l_genl_msg_get_extended_error(msg);
l_error("New Key for Pairwise Key failed for ifindex: %d:%s",
netdev->index,
ext_error ? ext_error : strerror(-err));
goto error;
}
@ -1540,11 +1562,16 @@ static void netdev_qos_map_cb(struct l_genl_msg *msg, void *user_data)
{
struct netdev *netdev = user_data;
int err = l_genl_msg_get_error(msg);
if (err < 0)
l_error("Could not set QoS Map in kernel: %d", err);
const char *ext_error;
netdev->qos_map_cmd_id = 0;
if (err >= 0)
return;
ext_error = l_genl_msg_get_extended_error(msg);
l_error("Couuld not set QoS Map in kernel: %s",
ext_error ? ext_error : strerror(-err));
}
/*
@ -3323,11 +3350,17 @@ static void netdev_neighbor_report_frame_event(const struct mmpdu_header *hdr,
l_timeout_remove(netdev->neighbor_report_timeout);
}
static void netdev_sa_query_resp_cb(struct l_genl_msg *msg,
void *user_data)
static void netdev_sa_query_resp_cb(struct l_genl_msg *msg, void *user_data)
{
if (l_genl_msg_get_error(msg) < 0)
l_debug("error sending SA Query request");
int err = l_genl_msg_get_error(msg);
const char *ext_error;
if (err >= 0)
return;
ext_error = l_genl_msg_get_extended_error(msg);
l_debug("error sending SA Query request: %s",
ext_error ? ext_error : strerror(-err));
}
static void netdev_sa_query_req_frame_event(const struct mmpdu_header *hdr,
@ -3406,17 +3439,21 @@ static void netdev_sa_query_resp_frame_event(const struct mmpdu_header *hdr,
netdev->sa_query_timeout = NULL;
}
static void netdev_sa_query_req_cb(struct l_genl_msg *msg,
void *user_data)
static void netdev_sa_query_req_cb(struct l_genl_msg *msg, void *user_data)
{
struct netdev *netdev = user_data;
int err = l_genl_msg_get_error(msg);
const char *ext_error;
if (l_genl_msg_get_error(msg) < 0) {
l_debug("error sending SA Query request");
if (err >= 0)
return;
l_timeout_remove(netdev->sa_query_timeout);
netdev->sa_query_timeout = NULL;
}
ext_error = l_genl_msg_get_extended_error(msg);
l_debug("error sending SA Query request: %s",
ext_error ? ext_error : strerror(-err));
l_timeout_remove(netdev->sa_query_timeout);
netdev->sa_query_timeout = NULL;
}
static void netdev_sa_query_timeout(struct l_timeout *timeout,
@ -3720,14 +3757,15 @@ static struct l_genl_msg *netdev_build_control_port_frame(struct netdev *netdev,
static void netdev_control_port_frame_cb(struct l_genl_msg *msg,
void *user_data)
{
int err;
int err = l_genl_msg_get_error(msg);
const char *ext_error;
err = l_genl_msg_get_error(msg);
if (err >= 0)
return;
l_debug("%d", err);
if (err < 0)
l_info("CMD_CONTROL_PORT failed: %s", strerror(-err));
ext_error = l_genl_msg_get_extended_error(msg);
l_error("CMD_CONTROL_PORT failed: %s",
ext_error ? ext_error : strerror(-err));
}
static int netdev_control_port_write_pae(struct netdev *netdev,
@ -3889,12 +3927,15 @@ static struct l_genl_msg *netdev_build_cmd_cqm_rssi_update(
static void netdev_cmd_set_cqm_cb(struct l_genl_msg *msg, void *user_data)
{
int r = l_genl_msg_get_error(msg);
int err = l_genl_msg_get_error(msg);
const char *ext_error;
if (!r)
if (err >= 0)
return;
l_error("CMD_SET_CQM failed: %d(%s)", r, strerror(-r));
ext_error = l_genl_msg_get_extended_error(msg);
l_error("CMD_SET_CQM failed: %s",
ext_error ? ext_error : strerror(-err));
}
int netdev_set_rssi_report_levels(struct netdev *netdev, const int8_t *levels,