From patchwork Thu Jun 14 12:13:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 164920 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]) by ozlabs.org (Postfix) with ESMTP id 02A381007D1 for ; Thu, 14 Jun 2012 22:14:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 945A49C141; Thu, 14 Jun 2012 08:14:09 -0400 (EDT) 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 NbrX4vMXsX-9; Thu, 14 Jun 2012 08:14:09 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6343E9D273; Thu, 14 Jun 2012 08:14:05 -0400 (EDT) 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 A48BC9D273 for ; Thu, 14 Jun 2012 08:14:03 -0400 (EDT) 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 NWDKb0kKVQX1 for ; Thu, 14 Jun 2012 08:13:58 -0400 (EDT) Received: from mail-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id A60AB9C141 for ; Thu, 14 Jun 2012 08:13:58 -0400 (EDT) Received: by bkty8 with SMTP id y8so2054693bkt.17 for ; Thu, 14 Jun 2012 05:13:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.155.148 with SMTP id s20mr882253bkw.56.1339676036087; Thu, 14 Jun 2012 05:13:56 -0700 (PDT) Received: by 10.204.17.19 with HTTP; Thu, 14 Jun 2012 05:13:56 -0700 (PDT) Date: Thu, 14 Jun 2012 21:13:56 +0900 Message-ID: Subject: [PATCH] P2P: Add p2p_client_list support for FullMAC Persistent GO From: Masashi Honma To: hostap ML X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Hello. Currenlty FullMAC Persistent GO can't use p2p_client_list. Because it's own hapd->p2p_group is NULL at ap_sta_set_authorized(). This patch changes the processing to use sta->p2p_ie instead of p2p_group_get_dev_addr() on FullMAC GO. Signed-hostap: Masashi Honma * @ies_len: ies buffer length in octets Regards, Masashi Honma. diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index a7dffc7..95b701c 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -845,11 +845,20 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, int authorized) { const u8 *dev_addr = NULL; +#ifdef CONFIG_P2P + u8 addr[ETH_ALEN]; +#endif /* CONFIG_P2P */ + if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED)) return; #ifdef CONFIG_P2P - dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr); + if (hapd->p2p_group == NULL) { + if (sta->p2p_ie != NULL && + p2p_parse_dev_addr_in_p2p_ie(sta->p2p_ie, addr) == 0) + dev_addr = addr; + } else + dev_addr = p2p_group_get_dev_addr(hapd->p2p_group, sta->addr); #endif /* CONFIG_P2P */ if (authorized) { diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 7046f7b..1deaced 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -2148,30 +2148,35 @@ int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end) } -int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr) +int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr) { - struct wpabuf *p2p_ie; struct p2p_message msg; - int ret = -1; - p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len, - P2P_IE_VENDOR_TYPE); - if (p2p_ie == NULL) - return -1; os_memset(&msg, 0, sizeof(msg)); - if (p2p_parse_p2p_ie(p2p_ie, &msg)) { - wpabuf_free(p2p_ie); + if (p2p_parse_p2p_ie(p2p_ie, &msg)) return -1; - } if (msg.p2p_device_addr) { os_memcpy(dev_addr, msg.p2p_device_addr, ETH_ALEN); - ret = 0; + return 0; } else if (msg.device_id) { os_memcpy(dev_addr, msg.device_id, ETH_ALEN); - ret = 0; + return 0; } + return -1; +} + +int p2p_parse_dev_addr(const u8 *ies, size_t ies_len, u8 *dev_addr) +{ + struct wpabuf *p2p_ie; + int ret; + + p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len, + P2P_IE_VENDOR_TYPE); + if (p2p_ie == NULL) + return -1; + ret = p2p_parse_dev_addr_in_p2p_ie(p2p_ie, dev_addr); wpabuf_free(p2p_ie); return ret; } diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index a759adf..f2692ca 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1427,6 +1427,15 @@ int p2p_ie_text(struct wpabuf *p2p_ie, char *buf, char *end); int p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, char *end); /** + * p2p_parse_dev_addr_in_p2p_ie - Parse P2P Device Address from a concatinated + * P2P IE + * @p2p_ie: P2P Information element + * @dev_addr: Buffer for returning P2P Device Address + * Returns: 0 on success or -1 if P2P Device Address could not be parsed + */ +int p2p_parse_dev_addr_in_p2p_ie(struct wpabuf *p2p_ie, u8 *dev_addr); + +/** * p2p_parse_dev_addr - Parse P2P Device Address from P2P IE(s) * @ies: Information elements from scan results