From patchwork Tue Dec 10 14:22:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11282573 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AB49138C for ; Tue, 10 Dec 2019 14:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03C832077B for ; Tue, 10 Dec 2019 14:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727345AbfLJOWy (ORCPT ); Tue, 10 Dec 2019 09:22:54 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:44887 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbfLJOWy (ORCPT ); Tue, 10 Dec 2019 09:22:54 -0500 Received: from isengard.tu-ilmenau.de (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id B68B158006E; Tue, 10 Dec 2019 15:22:52 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH 1/2] iw: event: add new peer candidate command Date: Tue, 10 Dec 2019 15:22:44 +0100 Message-Id: <20191210142245.13972-1-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch prints information about mesh peering candidates. Signed-off-by: Markus Theil --- event.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/event.c b/event.c index 4a932d1..f17e78e 100644 --- a/event.c +++ b/event.c @@ -650,6 +650,24 @@ static void parse_nan_match(struct nlattr **attrs) printf("\n"); } +static void parse_new_peer_candidate(struct nlattr **attrs) +{ + char macbuf[ETH_ALEN * 3]; + int32_t sig_dbm; + + printf("new peer candidate"); + if (attrs[NL80211_ATTR_MAC]) { + mac_addr_n2a(macbuf, nla_data(attrs[NL80211_ATTR_MAC])); + printf(" %s", macbuf); + } + if (attrs[NL80211_ATTR_RX_SIGNAL_DBM]) { + sig_dbm = nla_get_u32(attrs[NL80211_ATTR_RX_SIGNAL_DBM]); + printf(" %i dBm", sig_dbm); + } + + printf("\n"); +} + static int print_event(struct nl_msg *msg, void *arg) { struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); @@ -989,6 +1007,10 @@ static int print_event(struct nl_msg *msg, void *arg) parse_nan_match(tb); break; } + case NL80211_CMD_NEW_PEER_CANDIDATE: { + parse_new_peer_candidate(tb); + break; + } default: printf("unknown event %d (%s)\n", gnlh->cmd, command_name(gnlh->cmd)); From patchwork Tue Dec 10 14:22:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Theil X-Patchwork-Id: 11282571 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6835E930 for ; Tue, 10 Dec 2019 14:22:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42D042077B for ; Tue, 10 Dec 2019 14:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbfLJOWy (ORCPT ); Tue, 10 Dec 2019 09:22:54 -0500 Received: from smail.rz.tu-ilmenau.de ([141.24.186.67]:44890 "EHLO smail.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727295AbfLJOWy (ORCPT ); Tue, 10 Dec 2019 09:22:54 -0500 Received: from isengard.tu-ilmenau.de (unknown [141.24.207.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smail.rz.tu-ilmenau.de (Postfix) with ESMTPSA id C6077580073; Tue, 10 Dec 2019 15:22:52 +0100 (CET) From: Markus Theil To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Markus Theil Subject: [PATCH 2/2] iw: event: add set interface command Date: Tue, 10 Dec 2019 15:22:45 +0100 Message-Id: <20191210142245.13972-2-markus.theil@tu-ilmenau.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210142245.13972-1-markus.theil@tu-ilmenau.de> References: <20191210142245.13972-1-markus.theil@tu-ilmenau.de> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch adds support for CMD_SET_INTERFACE which is called when switching to mesh or ap mode. Signed-off-by: Markus Theil --- event.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/event.c b/event.c index f17e78e..0cedeb9 100644 --- a/event.c +++ b/event.c @@ -668,6 +668,46 @@ static void parse_new_peer_candidate(struct nlattr **attrs) printf("\n"); } +static void parse_set_interface(struct nlattr **attrs) +{ + printf("set interface"); + + if (attrs[NL80211_ATTR_IFTYPE]) { + printf(" type "); + switch (nla_get_u32(attrs[NL80211_ATTR_IFTYPE])) { + case NL80211_IFTYPE_STATION: + printf("station"); + break; + case NL80211_IFTYPE_AP: + printf("access point"); + break; + case NL80211_IFTYPE_MESH_POINT: + printf("mesh point"); + break; + case NL80211_IFTYPE_ADHOC: + printf("ad-hoc"); + break; + case NL80211_IFTYPE_MONITOR: + printf("monitor"); + break; + default: + printf("unknown"); + } + } + + if (attrs[NL80211_ATTR_MESH_ID]) { + printf(" meshid "); + print_ssid_escaped(nla_len(attrs[NL80211_ATTR_MESH_ID]), + nla_data(attrs[NL80211_ATTR_MESH_ID])); + } + + if (attrs[NL80211_ATTR_4ADDR]) { + printf(" use 4addr %i", nla_get_u8(attrs[NL80211_ATTR_4ADDR])); + } + + printf("\n"); +} + static int print_event(struct nl_msg *msg, void *arg) { struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg)); @@ -1011,6 +1051,10 @@ static int print_event(struct nl_msg *msg, void *arg) parse_new_peer_candidate(tb); break; } + case NL80211_CMD_SET_INTERFACE: { + parse_set_interface(tb); + break; + } default: printf("unknown event %d (%s)\n", gnlh->cmd, command_name(gnlh->cmd));