From patchwork Mon Feb 18 20:30:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dvdspndl@gmail.com X-Patchwork-Id: 221487 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 3C7DE2C0095 for ; Tue, 19 Feb 2013 07:32:44 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id DD3069D325; Mon, 18 Feb 2013 15:32:41 -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 NERRcF29CEPY; Mon, 18 Feb 2013 15:32:41 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id D26E69D36E; Mon, 18 Feb 2013 15:31:33 -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 A8B4E9D31D for ; Mon, 18 Feb 2013 15:31:32 -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 CRarDQMHyPI5 for ; Mon, 18 Feb 2013 15:31:28 -0500 (EST) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) (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 5B9499D325 for ; Mon, 18 Feb 2013 15:30:53 -0500 (EST) Received: by mail-ee0-f42.google.com with SMTP id b47so3043425eek.15 for ; Mon, 18 Feb 2013 12:30:52 -0800 (PST) X-Received: by 10.14.194.198 with SMTP id m46mr48339918een.8.1361219452169; Mon, 18 Feb 2013 12:30:52 -0800 (PST) Received: from localhost (93-172-163-212.bb.netvision.net.il. [93.172.163.212]) by mx.google.com with ESMTPS id h5sm100404311eem.1.2013.02.18.12.30.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 18 Feb 2013 12:30:51 -0800 (PST) From: dvdspndl@gmail.com To: hostap@lists.shmoo.com Subject: [PATCH 06/10] nl80211_driver: add a handler to create_interface Date: Mon, 18 Feb 2013 22:30:32 +0200 Message-Id: <1361219436-5840-6-git-send-email-dvdspndl@gmail.com> X-Mailer: git-send-email 1.7.10.msysgit.1 In-Reply-To: <1361219436-5840-1-git-send-email-dvdspndl@gmail.com> References: <1361219436-5840-1-git-send-email-dvdspndl@gmail.com> 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: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: David Spinadel Add an option to pass handler to nl80211_create_iface and nl80211_create_interface_once that will be called after recieving the message from the kernel. this handler will add the option to process the message in different ways for different interfaces. Signed-off-by: David Spinadel --- src/drivers/driver_nl80211.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 0838709..0446f33 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -5988,7 +5988,9 @@ static const char * nl80211_iftype_str(enum nl80211_iftype mode) static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, const char *ifname, enum nl80211_iftype iftype, - const u8 *addr, int wds) + const u8 *addr, int wds, + int (*handler)(struct nl_msg *, void *), + void *arg) { struct nl_msg *msg, *flags = NULL; int ifidx; @@ -6025,7 +6027,7 @@ static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, wds); } - ret = send_and_recv_msgs(drv, msg, NULL, NULL); + ret = send_and_recv_msgs(drv, msg, handler, arg); msg = NULL; if (ret) { nla_put_failure: @@ -6057,11 +6059,14 @@ static int nl80211_create_iface_once(struct wpa_driver_nl80211_data *drv, static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, const char *ifname, enum nl80211_iftype iftype, - const u8 *addr, int wds) + const u8 *addr, int wds, + int (*handler)(struct nl_msg *, void *), + void *arg) { int ret; - ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds); + ret = nl80211_create_iface_once(drv, ifname, iftype, addr, wds, handler, + arg); /* if error occurred and interface exists already */ if (ret == -ENFILE && if_nametoindex(ifname)) { @@ -6072,7 +6077,7 @@ static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv, /* Try to create the interface again */ ret = nl80211_create_iface_once(drv, ifname, iftype, addr, - wds); + wds, handler, arg); } if (ret >= 0 && is_p2p_net_interface(iftype)) @@ -6422,7 +6427,7 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv) drv->monitor_ifidx = nl80211_create_iface(drv, buf, NL80211_IFTYPE_MONITOR, NULL, - 0); + 0, NULL, NULL); if (drv->monitor_ifidx == -EOPNOTSUPP) { /* @@ -7941,7 +7946,7 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, if (!if_nametoindex(name)) { if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, - NULL, 1) < 0) + NULL, 1, NULL, NULL) < 0) return -1; if (bridge_ifname && linux_br_add_if(drv->global->ioctl_sock, @@ -8227,7 +8232,7 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, os_memcpy(if_addr, addr, ETH_ALEN); ifidx = nl80211_create_iface(drv, ifname, wpa_driver_nl80211_if_type(type), addr, - 0); + 0, NULL, NULL); if (ifidx < 0) { #ifdef HOSTAPD os_free(new_bss);