diff options
| author | Ravi Joshi <ravij@codeaurora.org> | 2018-02-27 12:33:14 -0800 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-03-10 14:03:23 -0800 |
| commit | 99608ae49ef3f40f2ca5ad6eac626c87bb768962 (patch) | |
| tree | 2b067b321daa64b21f12b089e7b935e5ab0fae30 | |
| parent | e4a5adf0cf85ffcd17a70a27f9545a8bcd049652 (diff) | |
qcacld-3.0: Accept nan responder request without iface name
The service layer need not provide the iface name in the
responder request to the driver if the request is being rejected.
The service layer maps the ndp_instance_id only after accepting
the request, if the ndp indication is rejected, the user space
has no knowledge of the iface name on which the NDP would have
gotten mapped if it were successful
CRs-Fixed: 2196867
Change-Id: I4b587963a0d0f220da30b2d8b2a0f19fb52eda2a
| -rw-r--r-- | core/hdd/src/wlan_hdd_nan_datapath.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index 5868604e27a7..95bb70f14d59 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -789,28 +789,39 @@ static int hdd_ndp_responder_req_handler(hdd_context_t *hdd_ctx, ENTER(); - if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]) { - hdd_err("Interface name string is unavailable"); - return -EINVAL; - } + if (tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]) { + iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]); - iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]); - /* Check if there is already an existing NAN interface */ - adapter = hdd_get_adapter_by_iface_name(hdd_ctx, iface_name); - if (!adapter) { - hdd_err("NAN data interface %s not available", iface_name); - return -EINVAL; - } + /* Check if iface exists */ + adapter = hdd_get_adapter_by_iface_name(hdd_ctx, iface_name); + if (!adapter) { + hdd_err("NAN data iface %s is unavailable", iface_name); + return -ENODEV; + } - if (!WLAN_HDD_IS_NDI(adapter)) { - hdd_err("Interface %s is not in NDI mode", iface_name); - return -EINVAL; + if (!WLAN_HDD_IS_NDI(adapter)) { + hdd_err("Interface %s is not in NDI mode", iface_name); + return -ENODEV; + } + } else { + /* + * If the data indication is rejected, the userspace + * may not send the iface name. Use the first available NDI + * in that case + */ + hdd_info("Iface name string is unavailable, use first NDI"); + + adapter = hdd_get_adapter(hdd_ctx, QDF_NDI_MODE); + if (!adapter) { + hdd_err("No active NDIs, rejecting the request"); + return -ENODEV; + } } /* NAN data path coexists only with STA interface */ if (!hdd_is_ndp_allowed(hdd_ctx)) { hdd_err("Unsupported concurrency for NAN datapath"); - return -EINVAL; + return -EPERM; } ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter); |
