[PATCH] STA: Allow management action frames reporting through the control interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If configured, all registered management action frames will be reported on the control interface.

Signed-off-by: Quentin Feraboli <quentin.feraboli@xxxxxxxxxxxxxx>
---
 src/common/wpa_ctrl.h              |  1 +
 wpa_supplicant/config.c            |  1 +
 wpa_supplicant/config.h            |  5 +++++
 wpa_supplicant/config_file.c       |  2 ++
 wpa_supplicant/events.c            | 16 ++++++++++++++++
 wpa_supplicant/wpa_supplicant.conf |  5 +++++
 6 files changed, 30 insertions(+)

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 40628e81d..635ecfb6e 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -455,6 +455,7 @@ extern "C" {

 /* Event triggered for received management frame */
 #define AP_MGMT_FRAME_RECEIVED "AP-MGMT-FRAME-RECEIVED "
+#define STA_MGMT_ACTION_FRAME_RECEIVED "STA-MGMT-ACTION-FRAME-RECEIVED "

 /* Event triggerred on AP receiving Wi-Fi Alliance Generational Capabilities
  * indication.
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 6dfb3165a..1972ba8f5 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -5680,6 +5680,7 @@ static const struct global_parse_data global_fields[] = {
        { INT_RANGE(wfa_gen_capa, 0, 2), 0},
        { BIN(wfa_gen_capa_supp), 0 },
        { BIN(wfa_gen_capa_cert), 0 },
+       { INT(notify_mgmt_action_frames), 0 },
        /* NOTE: When adding new parameters here, add_interface() in
         * wpa_supplicant/dbus_new_introspect.c may need to be modified to
         * increase the size of the iface->xml buffer. */
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index ca227a82e..a865ad8a6 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1910,6 +1910,11 @@ struct wpa_config {
         * wfa_gen_capa_supp.
         */
        struct wpabuf *wfa_gen_capa_cert;
+
+       /**
+        * notify_mgmt_action_frames: Whether to report all actions frames to the control interface.
+        */
+       int notify_mgmt_action_frames;
 };


diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index ea52d9cf2..146f487f1 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -1756,6 +1756,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                fprintf(f, "wfa_gen_capa=%d\n", config->wfa_gen_capa);
        write_global_bin(f, "wfa_gen_capa_supp", config->wfa_gen_capa_supp);
        write_global_bin(f, "wfa_gen_capa_cert", config->wfa_gen_capa_cert);
+       if (config->notify_mgmt_action_frames)
+               fprintf(f, "notify_mgmt_action_frames=%d\n", config->notify_mgmt_action_frames);
 }

 static void wpa_config_write_identity(FILE *f, struct wpa_dev_ik *dev_ik)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index ec29deae1..a7501d687 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5439,6 +5439,19 @@ void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s,
        wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER);
 }

+static void notify_mgmt_action_frame(struct wpa_supplicant *wpa_s, const u8 *buf,
+       size_t len)
+{
+       int hex_len = len * 2 + 1;
+       char *hex = os_malloc(hex_len);
+
+       if (hex) {
+               wpa_snprintf_hex(hex, hex_len, buf, len);
+               wpa_msg_ctrl(wpa_s, MSG_INFO,
+                       STA_MGMT_ACTION_FRAME_RECEIVED "buf=%s", hex);
+                       os_free(hex);
+       }
+}

 static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
                                      const u8 *frame, size_t len, int freq,
@@ -5461,6 +5474,9 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
                " Category=%u DataLen=%d freq=%d MHz",
                MAC2STR(mgmt->sa), category, (int) plen, freq);

+       if (wpa_s->conf->notify_mgmt_action_frames)
+               notify_mgmt_action_frame(wpa_s, frame, len);
+
 #ifndef CONFIG_NO_WMM_AC
        if (category == WLAN_ACTION_WMM) {
                wmm_ac_rx_action(wpa_s, mgmt->da, mgmt->sa, payload, plen);
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 40c5ff57d..6cc017d85 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -1845,6 +1845,11 @@ fast_reauth=1
 # as the maximum idle period for the STA during association.
 #max_idle=600

+# Enable management action frames reporting
+# Set to 0 to not report any action frames to the control interface (default behavior)
+# Set to 1 to report all action frames to the control interface
+#notify_mgmt_action_frames=0
+
 # Example blocks:

 # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
--
2.34.1

-- This message and any attachments herein are, unless otherwise stated, confidential, intended solely for the addressees and are SoftAtHome’s ownership. Any unauthorized use, reproduction or dissemination is prohibited unless formaly agreed beforehand by the sender. If you are not the intended addressee of this message, please immediately delete it and all its attachments from your computer system and notify the sender. SoftAtHome reserves the right to monitor all email communications through its networks. Any views or opinions presented are solely those of its author and do not necessarily represent those of SoftAtHome. The internet cannot guarantee the integrity of this message. SoftAtHome not shall be liable for the message if altered, changed or falsified. While we take all reasonable precautions to ensure that viruses are not transmitted via emails, we recommend that you take your own measures to prevent viruses from entering your computer system. SoftAtHome is a French Société Anonyme with a Board of Directors, having a capital of 6 450 699 Euros having its registered office located at 9-11 rue du débarcadère – 92700 – Colombes – France – Tel + 33 (0)1 57 66 88 88 – Fax + 33 (0)1 57 66 88 89 - RCS Nanterre B 500 440 813 – Intra-Community VAT: FR 04500440813 -- Ce message et toutes les pièces jointes qui y sont incluses sont, sauf indication contraire, confidentiels, destinés uniquement aux destinataires et sont la propriété de SoftAtHome. Toute utilisation non autorisée, reproduction ou diffusion est interdite, sauf accord formel préalable de l'expéditeur. Si vous n'êtes pas le destinataire prévu de ce message, veuillez le supprimer immédiatement ainsi que toutes ses pièces jointes de votre système informatique et en informer l'expéditeur. SoftAtHome se réserve le droit de surveiller toutes les communications par e-mail via ses réseaux. Les opinions exprimées dans ce message sont celles de leur auteur et ne représentent pas nécessairement celles de SoftAtHome. L’Intern
et ne permettant pas d’assurer l’intégrité de ce message, SoftAtHome décline toute responsabilité à ce titre, dans l’hypothèse où il aurait été altéré, déformé ou falsifié. Par ailleurs et malgré toutes les précautions prises pour éviter la présence de virus dans nos envois, nous vous recommandons de prendre, de votre côté, les mesures permettant d'assurer la non-introduction de virus dans votre système informatique. SoftAtHome est une Société Anonyme française à Conseil d’Administration ayant un capital de 6 450 699 euros, dont le siège social est situé au 9-11 rue du débarcadère - 92700 - Colombes - France - Tel + 33 (0)1 57 66 88 88 - Fax + 33 (0)1 57 66 88 89 RCS Nanterre B 500 440 813 - TVA intracommunautaire : FR 04500440813

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux