From patchwork Thu Aug 2 11:01:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 174730 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 8FBAD2C008B for ; Thu, 2 Aug 2012 21:05:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2EF499D24F; Thu, 2 Aug 2012 07:05:40 -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 Fcv+sVEWmjit; Thu, 2 Aug 2012 07:05:39 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id E8BE89D24D; Thu, 2 Aug 2012 07:05:18 -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 476599D24B for ; Thu, 2 Aug 2012 07:05:17 -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 crd5b9g6ZW44 for ; Thu, 2 Aug 2012 07:05:12 -0400 (EDT) Received: from ebb05.tieto.com (ebb05.tieto.com [131.207.168.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "ebb05.tieto.com", Issuer "VeriSign Class 3 Secure Server CA - G3" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id CDE3717C005 for ; Thu, 2 Aug 2012 07:04:51 -0400 (EDT) X-AuditID: 83cfa824-b7c81ae000000a96-0b-501a5ed2d5cf Received: from FIHGA-EXHUB01.eu.tieto.com ( [131.207.136.34]) by ebb05.tieto.com (SMTP Mailer) with SMTP id C1.B7.02710.2DE5A105; Thu, 2 Aug 2012 14:04:50 +0300 (EEST) Received: from EXMB01.eu.tieto.com ([169.254.1.121]) by FIHGA-EXHUB01.eu.tieto.com ([131.207.136.34]) with mapi; Thu, 2 Aug 2012 14:04:50 +0300 From: To: Date: Thu, 2 Aug 2012 14:01:37 +0300 Subject: [RFC 3/4] wpa_cli: add IFNAME command Thread-Topic: [RFC 3/4] wpa_cli: add IFNAME command Thread-Index: Ac1wni/HENp+yBZhTA+841KtPorzeQ== Message-ID: <3078A9B976EF864C8DDD0C499FFD07912150C655E5@EXMB01.eu.tieto.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Brightmail-Tracker: AAAAAA== Cc: j@w1.fi 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 This command will return wpa_s->ifname. Could be used as a nice prompt in wpa_cli. Signed-hostap: Janusz Dziedzic --- wpa_supplicant/ctrl_iface.c | 3 +++ wpa_supplicant/wpa_cli.c | 8 ++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 82dbf86..06e315c 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -4070,6 +4070,9 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, if (os_strcmp(buf, "PING") == 0) { os_memcpy(reply, "PONG\n", 5); reply_len = 5; + } else if (os_strcmp(buf, "IFNAME") == 0) { + os_memcpy(reply, wpa_s->ifname, os_strlen(wpa_s->ifname)); + reply_len = os_strlen(wpa_s->ifname); } else if (os_strncmp(buf, "RELOG", 5) == 0) { if (wpa_debug_reopen_file() < 0) reply_len = -1; diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index b159ad3..7a06f09 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -430,6 +430,11 @@ static int wpa_ctrl_command(struct wpa_ctrl *ctrl, char *cmd) } +static int wpa_cli_cmd_ifname(struct wpa_ctrl *ctrl, int argc, char *argv[]) +{ + return wpa_ctrl_command(ctrl, "IFNAME"); +} + static int wpa_cli_cmd_status(struct wpa_ctrl *ctrl, int argc, char *argv[]) { if (argc > 0 && os_strcmp(argv[0], "verbose") == 0) @@ -2947,6 +2952,9 @@ static struct wpa_cli_cmd wpa_cli_commands[] = { { "status", wpa_cli_cmd_status, cli_cmd_flag_none, "[verbose] = get current WPA/EAPOL/EAP status" }, + { "ifname", wpa_cli_cmd_ifname, + cli_cmd_flag_none, + "= get current interface name" }, { "ping", wpa_cli_cmd_ping, cli_cmd_flag_none, "= pings wpa_supplicant" },