diff mbox series

[1/2] iw: event: add new peer candidate command

Message ID 20191210144215.15263-1-markus.theil@tu-ilmenau.de (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series [1/2] iw: event: add new peer candidate command | expand

Commit Message

Markus Theil Dec. 10, 2019, 2:42 p.m. UTC
This patch prints information about mesh peering candidates.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
 event.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Markus Theil Dec. 10, 2019, 2:43 p.m. UTC | #1
On 12/10/19 3:42 PM, Markus Theil wrote:
> This patch prints information about mesh peering candidates.
>
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
>  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));
Sorry, I accidentally sent this again :(
diff mbox series

Patch

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));