}
-int send_and_recv(struct nl80211_global *global,
- struct nl_sock *nl_handle, struct nl_msg *msg,
- int (*valid_handler)(struct nl_msg *, void *),
- void *valid_data,
- int (*ack_handler_custom)(struct nl_msg *, void *),
- void *ack_data,
- struct nl80211_err_info *err_info)
+int send_and_recv_glb(struct nl80211_global *global,
+ struct wpa_driver_nl80211_data *drv, /* may be NULL */
+ struct nl_sock *nl_handle, struct nl_msg *msg,
+ int (*valid_handler)(struct nl_msg *, void *),
+ void *valid_data,
+ int (*ack_handler_custom)(struct nl_msg *, void *),
+ void *ack_data,
+ struct nl80211_err_info *err_info)
{
struct nl_cb *cb, *s_nl_cb;
struct nl80211_ack_err_args err;
return -1;
}
- ret = send_and_recv(global, global->nl, msg, family_handler, &res,
- NULL, NULL, NULL);
+ ret = send_and_recv_glb(global, NULL, global->nl, msg, family_handler,
+ &res, NULL, NULL, NULL);
if (ret == 0)
ret = res.id;
return ret;
return -1;
}
- ret = send_and_recv(drv->global, w->nl_beacons, msg, NULL, NULL,
+ ret = send_and_recv(drv, w->nl_beacons, msg, NULL, NULL,
NULL, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Register beacons command "
return -1;
}
- ret = send_and_recv(drv->global, nl_handle, msg, NULL, NULL,
+ ret = send_and_recv(drv, nl_handle, msg, NULL, NULL,
NULL, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Register frame command "
int ret;
msg = nl80211_bss_msg(bss, 0, NL80211_CMD_UNEXPECTED_FRAME);
- ret = send_and_recv(bss->drv->global, bss->nl_mgmt, msg, NULL, NULL,
+ ret = send_and_recv(bss->drv, bss->nl_mgmt, msg, NULL, NULL,
NULL, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Register spurious class3 "
return -1;
}
- ret = send_and_recv(drv->global, bss->nl_connect, msg,
+ ret = send_and_recv(drv, bss->nl_connect, msg,
NULL, NULL, NULL, NULL, NULL);
if (ret) {
wpa_dbg(drv->ctx, MSG_DEBUG,
if (nla_put_flag(msg, NL80211_ATTR_SOCKET_OWNER))
goto fail;
- ret = send_and_recv(drv->global, bss->nl_connect, msg, NULL, NULL, NULL,
+ ret = send_and_recv(drv, bss->nl_connect, msg, NULL, NULL, NULL,
NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
os_memset(&ext_arg, 0, sizeof(struct nl80211_ack_ext_arg));
ext_arg.ext_data = &cookie;
- ret = send_and_recv(bss->drv->global, bss->drv->global->nl, msg,
+ ret = send_and_recv(bss->drv, bss->drv->global->nl, msg,
NULL, NULL, ack_handler_cookie, &ext_arg, NULL);
if (ret) {
wpa_printf(MSG_DEBUG,
int ret;
msg = nl80211_drv_msg(drv, 0, NL80211_CMD_LEAVE_IBSS);
- ret = send_and_recv(drv->global, drv->first_bss->nl_connect, msg, NULL,
+ ret = send_and_recv(drv, drv->first_bss->nl_connect, msg, NULL,
NULL, NULL, NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Leave IBSS failed: ret=%d "
if (nla_put_flag(msg, NL80211_ATTR_SOCKET_OWNER))
goto fail;
- ret = send_and_recv(drv->global, drv->first_bss->nl_connect, msg, NULL,
+ ret = send_and_recv(drv, drv->first_bss->nl_connect, msg, NULL,
NULL, NULL, NULL, NULL);
msg = NULL;
if (ret) {
if (nla_put_flag(msg, NL80211_ATTR_SOCKET_OWNER))
goto fail;
- ret = send_and_recv(drv->global, bss->nl_connect, msg, NULL, NULL, NULL,
+ ret = send_and_recv(drv, bss->nl_connect, msg, NULL, NULL, NULL,
NULL, NULL);
msg = NULL;
if (ret) {
if (!TEST_FAIL_TAG("assoc")) {
if (nla_put_flag(msg, NL80211_ATTR_SOCKET_OWNER))
goto fail;
- ret = send_and_recv(drv->global, drv->first_bss->nl_connect,
+ ret = send_and_recv(drv, drv->first_bss->nl_connect,
msg, NULL, NULL, NULL, NULL, &err_info);
msg = NULL;
} else {
/* This test vendor_cmd can be used with nl80211 commands that
* need the connect nl_sock, so use the variant that takes in
* bss->nl_connect as the handle. */
- ret = send_and_recv(drv->global, bss->nl_connect, msg,
+ ret = send_and_recv(drv, bss->nl_connect, msg,
cmd_reply_handler, buf, NULL, NULL, NULL);
if (ret)
wpa_printf(MSG_DEBUG, "nl80211: command failed err=%d",
if (nla_put_flag(msg, NL80211_ATTR_SOCKET_OWNER))
return -1;
- ret = send_and_recv(drv->global, bss->nl_connect, msg, NULL, NULL, NULL,
+ ret = send_and_recv(drv, bss->nl_connect, msg, NULL, NULL, NULL,
NULL, NULL);
msg = NULL;
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: mesh leave (ifindex=%d)", drv->ifindex);
msg = nl80211_bss_msg(bss, 0, NL80211_CMD_LEAVE_MESH);
- ret = send_and_recv(drv->global, bss->nl_connect, msg, NULL, NULL, NULL,
+ ret = send_and_recv(drv, bss->nl_connect, msg, NULL, NULL, NULL,
NULL, NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: mesh leave failed: ret=%d (%s)",
uint8_t cmd);
struct nl_msg * nl80211_bss_msg(struct i802_bss *bss, int flags, uint8_t cmd);
-int send_and_recv(struct nl80211_global *global,
- struct nl_sock *nl_handle, struct nl_msg *msg,
- int (*valid_handler)(struct nl_msg *, void *),
- void *valid_data,
- int (*ack_handler_custom)(struct nl_msg *, void *),
- void *ack_data,
- struct nl80211_err_info *err_info);
+int send_and_recv_glb(struct nl80211_global *global,
+ struct wpa_driver_nl80211_data *drv, /* may be NULL */
+ struct nl_sock *nl_handle, struct nl_msg *msg,
+ int (*valid_handler)(struct nl_msg *, void *),
+ void *valid_data,
+ int (*ack_handler_custom)(struct nl_msg *, void *),
+ void *ack_data,
+ struct nl80211_err_info *err_info);
+
+static inline int
+send_and_recv(struct wpa_driver_nl80211_data *drv,
+ struct nl_sock *nl_handle, struct nl_msg *msg,
+ int (*valid_handler)(struct nl_msg *, void *),
+ void *valid_data,
+ int (*ack_handler_custom)(struct nl_msg *, void *),
+ void *ack_data,
+ struct nl80211_err_info *err_info)
+{
+ return send_and_recv_glb(drv->global, drv, nl_handle, msg,
+ valid_handler, valid_data,
+ ack_handler_custom, ack_data, err_info);
+}
static inline int
send_and_recv_cmd(struct wpa_driver_nl80211_data *drv,
struct nl_msg *msg)
{
- return send_and_recv(drv->global, drv->global->nl, msg,
+ return send_and_recv(drv, drv->global->nl, msg,
NULL, NULL, NULL, NULL, NULL);
}
int (*valid_handler)(struct nl_msg *, void *),
void *valid_data)
{
- return send_and_recv(drv->global, drv->global->nl, msg,
+ return send_and_recv(drv, drv->global->nl, msg,
valid_handler, valid_data, NULL, NULL, NULL);
}