diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c index 490fcbbd3..ed88f1f93 100644 --- a/src/rsn_supp/tdls.c +++ b/src/rsn_supp/tdls.c @@ -2302,3 +2302,9 @@ void wpa_tdls_enable(struct wpa_sm *sm, int enabled) wpa_printf(MSG_DEBUG, "TDLS: %s", enabled ? "enabled" : "disabled"); sm->tdls_disabled = !enabled; } + + +int wpa_tdls_is_external_setup(struct wpa_sm *sm) +{ + return sm->tdls_external_setup; +} diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index d4ae09c1a..4c1750f19 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -370,5 +370,6 @@ int wpa_tdls_init(struct wpa_sm *sm); void wpa_tdls_deinit(struct wpa_sm *sm); void wpa_tdls_enable(struct wpa_sm *sm, int enabled); void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr); +int wpa_tdls_is_external_setup(struct wpa_sm *sm); #endif /* WPA_H */ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 1b2b766f0..a1d13e325 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -206,6 +206,7 @@ static int wpa_supplicant_ctrl_iface_tdls_discover( struct wpa_supplicant *wpa_s, char *addr) { u8 peer[ETH_ALEN]; + int ret; if (hwaddr_aton(addr, peer)) { wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER: invalid " @@ -216,7 +217,12 @@ static int wpa_supplicant_ctrl_iface_tdls_discover( wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER " MACSTR, MAC2STR(peer)); - return wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer); + if (wpa_tdls_is_external_setup(wpa_s->wpa)) + ret = wpa_tdls_send_discovery_request(wpa_s->wpa, peer); + else + ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer); + + return ret; } @@ -236,8 +242,13 @@ static int wpa_supplicant_ctrl_iface_tdls_setup( MAC2STR(peer)); ret = wpa_tdls_reneg(wpa_s->wpa, peer); - if (ret) - ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer); + if (ret) { + if (wpa_tdls_is_external_setup(wpa_s->wpa)) + ret = wpa_tdls_start(wpa_s->wpa, peer); + else + ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer); + } + return ret; } @@ -256,7 +267,8 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown( wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR, MAC2STR(peer)); - return wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer); + return wpa_tdls_teardown_link(wpa_s->wpa, peer, + WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED); } #endif /* CONFIG_TDLS */