Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] iw: support setting frame subtype and reason code when deleting station
@ 2016-05-04 15:38 Rafał Miłecki
  2016-05-31  9:44 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2016-05-04 15:38 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Rafał Miłecki

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 station.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 3 deletions(-)

diff --git a/station.c b/station.c
index 8fdb83a..b29b788 100644
--- a/station.c
+++ b/station.c
@@ -498,9 +498,68 @@ static int handle_station_get(struct nl80211_state *state,
 COMMAND(station, get, "<MAC address>",
 	NL80211_CMD_GET_STATION, 0, CIB_NETDEV, handle_station_get,
 	"Get information for a specific station.");
-COMMAND(station, del, "<MAC address>",
-	NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get,
-	"Remove the given station entry (use with caution!)");
+
+static int handle_station_del(struct nl80211_state *state,
+			      struct nl_msg *msg,
+			      int argc, char **argv,
+			      enum id_input id)
+{
+	char *end;
+	unsigned char mac_addr[ETH_ALEN];
+	int subtype;
+	int reason_code;
+
+	if (argc < 1)
+		return 1;
+
+	if (mac_addr_a2n(mac_addr, argv[0])) {
+		fprintf(stderr, "invalid mac address\n");
+		return 2;
+	}
+
+	argc--;
+	argv++;
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+
+	if (argc > 1 && strcmp(argv[0], "subtype") == 0) {
+		argv++;
+		argc--;
+
+		subtype = strtod(argv[0], &end);
+		if (*end != '\0')
+			return 1;
+
+		NLA_PUT_U8(msg, NL80211_ATTR_MGMT_SUBTYPE, subtype);
+		argv++;
+		argc--;
+	}
+
+	if (argc > 1 && strcmp(argv[0], "reason-code") == 0) {
+		argv++;
+		argc--;
+
+		reason_code = strtod(argv[0], &end);
+		if (*end != '\0')
+			return 1;
+
+		NLA_PUT_U16(msg, NL80211_ATTR_REASON_CODE, reason_code);
+		argv++;
+		argc--;
+	}
+
+	if (argc)
+		return 1;
+
+	register_handler(print_sta_handler, NULL);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(station, del, "<MAC address> [subtype <subtype>] [reason-code <code>]",
+	NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_del,
+	"Remove the given station entry (use with caution!)\n"
+	"Example subtype values: 0xA (disassociation), 0xC (deauthentication)");
 
 static const struct cmd *station_set_plink;
 static const struct cmd *station_set_vlan;
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iw: support setting frame subtype and reason code when deleting station
  2016-05-04 15:38 [PATCH] iw: support setting frame subtype and reason code when deleting station Rafał Miłecki
@ 2016-05-31  9:44 ` Johannes Berg
  2016-05-31 10:03   ` Rafał Miłecki
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2016-05-31  9:44 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless

Applied.

On Wed, 2016-05-04 at 17:38 +0200, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

Oddly enough, patchwork corrupted *this*, but not the From: line ...

johannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iw: support setting frame subtype and reason code when deleting station
  2016-05-31  9:44 ` Johannes Berg
@ 2016-05-31 10:03   ` Rafał Miłecki
  2016-05-31 10:35     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2016-05-31 10:03 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org

On 31 May 2016 at 11:44, Johannes Berg <johannes@sipsolutions.net> wrote:
> Applied.
>
> On Wed, 2016-05-04 at 17:38 +0200, Rafał Miłecki wrote:
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>
> Oddly enough, patchwork corrupted *this*, but not the From: line ...

This patch was sent before patchwork update, I guess crazy things
could happen with old version and update could make things even more
weird.

Hopefully all further patches will be OK :)

Thanks

-- 
Rafał

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iw: support setting frame subtype and reason code when deleting station
  2016-05-31 10:03   ` Rafał Miłecki
@ 2016-05-31 10:35     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2016-05-31 10:35 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless@vger.kernel.org

On Tue, 2016-05-31 at 12:03 +0200, Rafał Miłecki wrote:
> On 31 May 2016 at 11:44, Johannes Berg <johannes@sipsolutions.net>
> wrote:
> > 
> > Applied.
> > 
> > On Wed, 2016-05-04 at 17:38 +0200, Rafał Miłecki wrote:
> > > 
> > > Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> > Oddly enough, patchwork corrupted *this*, but not the From: line
> > ...
> This patch was sent before patchwork update, I guess crazy things
> could happen with old version and update could make things even more
> weird.
> 
> Hopefully all further patches will be OK :)
> 

Yeah, indeed, I realized that when I reviewed your other patch (the
channels one) which is perfectly correct in both places.

johannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-31 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 15:38 [PATCH] iw: support setting frame subtype and reason code when deleting station Rafał Miłecki
2016-05-31  9:44 ` Johannes Berg
2016-05-31 10:03   ` Rafał Miłecki
2016-05-31 10:35     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox