diff mbox

wpa_cli: Run action file in case of an AP event

Message ID 1464016307-3420-1-git-send-email-joerg.krause@embedded.rocks
State Accepted
Headers show

Commit Message

Jörg Krause May 23, 2016, 3:11 p.m. UTC
Run the action script in case of an AP event "AP-ENABLED" or "AP-DISABLED".

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
 wpa_supplicant/wpa_cli.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jouni Malinen May 23, 2016, 9:19 p.m. UTC | #1
On Mon, May 23, 2016 at 05:11:47PM +0200, Jörg Krause wrote:
> Run the action script in case of an AP event "AP-ENABLED" or "AP-DISABLED".

Thanks, applied.
Jörg Krause May 25, 2016, 7:08 a.m. UTC | #2
On Di, 2016-05-24 at 00:19 +0300, Jouni Malinen wrote:
> On Mon, May 23, 2016 at 05:11:47PM +0200, Jörg Krause wrote:
> > Run the action script in case of an AP event "AP-ENABLED" or "AP-
> > DISABLED".
> 
> Thanks, applied.

Many thanks!

I would like to pass more events, e.g. ASSOC-REJECT, to the action
script. Do you have any concerns about which events are passed?

Currently, the events are passed in two different ways: Pass a
shortened string like "CONNECTED" and "DISCONNECTED" for CTRL_EVENT_*
or pass a full string for all other events.

As ASSOC-REJECT is of type CTRL_EVENT_* too, do you prefer to pass the
string "ASSOC-REJECT" or CTRL_EVENT_ASSOC_REJECT, e.g.

    wpa_cli_exec(action_file, ifname, "ASSOC-REJECT");

OR

    wpa_cli_exec(action_file, ifname, CTRL_EVENT_ASSOC_REJECT);

Best regards,
Jörg Krause
Jouni Malinen May 27, 2016, 9:04 a.m. UTC | #3
On Wed, May 25, 2016 at 09:08:11AM +0200, Jörg Krause wrote:
> I would like to pass more events, e.g. ASSOC-REJECT, to the action
> script. Do you have any concerns about which events are passed?

I do have some concern based on what is actually included in the event
contents, i.e., whether it is something that can be controlled by remote
devices. This is an area that is inconveniently easy to do in a manner
that results in security vulnerabilities.

> Currently, the events are passed in two different ways: Pass a
> shortened string like "CONNECTED" and "DISCONNECTED" for CTRL_EVENT_*
> or pass a full string for all other events.
> 
> As ASSOC-REJECT is of type CTRL_EVENT_* too, do you prefer to pass the
> string "ASSOC-REJECT" or CTRL_EVENT_ASSOC_REJECT, e.g.
> 
>     wpa_cli_exec(action_file, ifname, "ASSOC-REJECT");
> 
> OR
> 
>     wpa_cli_exec(action_file, ifname, CTRL_EVENT_ASSOC_REJECT);

I have no strong preference on that front.
diff mbox

Patch

diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 9b1c802..53036ae 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -3777,6 +3777,10 @@  static void wpa_cli_action_process(const char *msg)
 			wpa_cli_connected = 0;
 			wpa_cli_exec(action_file, ifname, "DISCONNECTED");
 		}
+	} else if (str_match(pos, AP_EVENT_ENABLED)) {
+		wpa_cli_exec(action_file, ctrl_ifname, pos);
+	} else if (str_match(pos, AP_EVENT_DISABLED)) {
+		wpa_cli_exec(action_file, ctrl_ifname, pos);
 	} else if (str_match(pos, MESH_GROUP_STARTED)) {
 		wpa_cli_exec(action_file, ctrl_ifname, pos);
 	} else if (str_match(pos, MESH_GROUP_REMOVED)) {