diff mbox

iw: print the ssid when requesting device info

Message ID 1352468278-30931-1-git-send-email-ordex@autistici.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Antonio Quartulli Nov. 9, 2012, 1:37 p.m. UTC
The GET_INTERFACE command receives also the ssid as part of the reply.
This patch makes iw print the ssid together with the other information
when issuing the "iw dev $vif info" command.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 interface.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Johannes Berg Nov. 9, 2012, 3:48 p.m. UTC | #1
On Fri, 2012-11-09 at 14:37 +0100, Antonio Quartulli wrote:
> The GET_INTERFACE command receives also the ssid as part of the reply.
> This patch makes iw print the ssid together with the other information
> when issuing the "iw dev $vif info" command.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Nov. 9, 2012, 3:50 p.m. UTC | #2
On Fri, 2012-11-09 at 16:48 +0100, Johannes Berg wrote:
> On Fri, 2012-11-09 at 14:37 +0100, Antonio Quartulli wrote:
> > The GET_INTERFACE command receives also the ssid as part of the reply.
> > This patch makes iw print the ssid together with the other information
> > when issuing the "iw dev $vif info" command.
> 
> Applied.

Huh, no, I take that back. What are you doing, printing an SSID as
though it was a string?!

There's print_ssid_escaped() for a reason.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antonio Quartulli Nov. 9, 2012, 3:52 p.m. UTC | #3
On Fri, Nov 09, 2012 at 04:50:39PM +0100, Johannes Berg wrote:
> On Fri, 2012-11-09 at 16:48 +0100, Johannes Berg wrote:
> > On Fri, 2012-11-09 at 14:37 +0100, Antonio Quartulli wrote:
> > > The GET_INTERFACE command receives also the ssid as part of the reply.
> > > This patch makes iw print the ssid together with the other information
> > > when issuing the "iw dev $vif info" command.
> > 
> > Applied.
> 
> Huh, no, I take that back. What are you doing, printing an SSID as
> though it was a string?!
> 

Uhm, right. I assumed it was composed by ASCII chars only.

> There's print_ssid_escaped() for a reason.

Thanks. Will use it.

Cheers,
diff mbox

Patch

diff --git a/interface.c b/interface.c
index 810c2b9..a1e2861 100644
--- a/interface.c
+++ b/interface.c
@@ -294,6 +294,13 @@  static int print_iface_handler(struct nl_msg *msg, void *arg)
 		mac_addr_n2a(mac_addr, nla_data(tb_msg[NL80211_ATTR_MAC]));
 		printf("%s\taddr %s\n", indent, mac_addr);
 	}
+	if (tb_msg[NL80211_ATTR_SSID]) {
+		char ssid[33];
+		memcpy(ssid, nla_data(tb_msg[NL80211_ATTR_SSID]),
+		       nla_len(tb_msg[NL80211_ATTR_SSID]));
+		ssid[nla_len(tb_msg[NL80211_ATTR_SSID])] = '\0';
+		printf("%s\tssid %s\n", indent, ssid);
+	}
 	if (tb_msg[NL80211_ATTR_IFTYPE])
 		printf("%s\ttype %s\n", indent, iftype_name(nla_get_u32(tb_msg[NL80211_ATTR_IFTYPE])));
 	if (!wiphy && tb_msg[NL80211_ATTR_WIPHY])