From patchwork Mon Mar 3 12:53:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilan Peer X-Patchwork-Id: 325808 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 626602C00D5 for ; Mon, 3 Mar 2014 23:57:41 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9A76A9D2FA; Mon, 3 Mar 2014 07:57:09 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E8ZZ780OmQRd; Mon, 3 Mar 2014 07:57:09 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7421317C00F; Mon, 3 Mar 2014 07:56:18 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9FB4517C00F for ; Mon, 3 Mar 2014 07:56:16 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bRv2hJrJ6-Aj for ; Mon, 3 Mar 2014 07:56:11 -0500 (EST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 724559C17E for ; Mon, 3 Mar 2014 07:56:00 -0500 (EST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 03 Mar 2014 04:55:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,577,1389772800"; d="scan'208";a="491246667" Received: from unknown (HELO ipeer-e6430-1.jer.intel.com) ([10.12.217.169]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2014 04:55:24 -0800 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH] P2P: fix P2P Device handling when starting with RF-kill blocked. Date: Mon, 3 Mar 2014 14:53:21 +0200 Message-Id: <1393851204-964-5-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393851204-964-1-git-send-email-ilan.peer@intel.com> References: <1393851204-964-1-git-send-email-ilan.peer@intel.com> Cc: Moshe Benji X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Moshe Benji On RF-kill, we should not request the kernel to start a P2P device. In addition, we should call i802_set_iface_flags() both for a P2P interface and any other interface instead of calling a dedicated function for each. Signed-off-by: Moshe Benji --- src/drivers/driver_nl80211.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index c509170..6df0a84 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4621,26 +4621,25 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv, return -1; } - if (nlmode == NL80211_IFTYPE_P2P_DEVICE) { - int ret = nl80211_set_p2pdev(bss, 1); - if (ret < 0) - wpa_printf(MSG_ERROR, "nl80211: Could not start P2P device"); + if (nlmode == NL80211_IFTYPE_P2P_DEVICE) nl80211_get_macaddr(bss); - return ret; - } - if (linux_set_iface_flags(drv->global->ioctl_sock, bss->ifname, 1)) { - if (rfkill_is_blocked(drv->rfkill)) { - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " - "interface '%s' due to rfkill", - bss->ifname); - drv->if_disabled = 1; - send_rfkill_event = 1; - } else { + if (!rfkill_is_blocked(drv->rfkill)) { + int ret = i802_set_iface_flags(bss, 1); + if (ret) { wpa_printf(MSG_ERROR, "nl80211: Could not set " "interface '%s' UP", bss->ifname); - return -1; + return ret; } + if (nlmode == NL80211_IFTYPE_P2P_DEVICE) + return ret; + } else { + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable " + "interface '%s' due to rfkill", bss->ifname); + if (nlmode == NL80211_IFTYPE_P2P_DEVICE) + return 0; + drv->if_disabled = 1; + send_rfkill_event = 1; } if (!drv->hostapd)