diff mbox

[v3,15/26] hostapd: add global TERMINATE command

Message ID 1455711269-12929-16-git-send-email-janusz.dziedzic@tieto.com
State Changes Requested
Headers show

Commit Message

Janusz.Dziedzic@tieto.com Feb. 17, 2016, 12:14 p.m. UTC
This will terminate hostapd

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 hostapd/ctrl_iface.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jouni Malinen Feb. 20, 2016, 3:30 p.m. UTC | #1
On Wed, Feb 17, 2016 at 01:14:18PM +0100, Janusz Dziedzic wrote:
> This will terminate hostapd

> diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
> @@ -3084,6 +3084,8 @@ static void hostapd_global_ctrl_iface_receive(int sock, void *eloop_ctx,
> +	} else if (os_strncmp(buf, "TERMINATE", 9) == 0) {
> +		eloop_terminate();

Why os_strncmp() instead of os_strcmp()? I don't see much point in
allowing arbitrary text after the command in this type of case.
Janusz.Dziedzic@tieto.com Feb. 21, 2016, 12:53 p.m. UTC | #2
On 20 February 2016 at 16:30, Jouni Malinen <j@w1.fi> wrote:
> On Wed, Feb 17, 2016 at 01:14:18PM +0100, Janusz Dziedzic wrote:
>> This will terminate hostapd
>
>> diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
>> @@ -3084,6 +3084,8 @@ static void hostapd_global_ctrl_iface_receive(int sock, void *eloop_ctx,
>> +     } else if (os_strncmp(buf, "TERMINATE", 9) == 0) {
>> +             eloop_terminate();
>
> Why os_strncmp() instead of os_strcmp()? I don't see much point in
> allowing arbitrary text after the command in this type of case.
>
Will fix that.

> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox

Patch

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index d24e075..d55ada2 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3084,6 +3084,8 @@  static void hostapd_global_ctrl_iface_receive(int sock, void *eloop_ctx,
 		reply_len = hostapd_global_ctrl_iface_interfaces(interfaces,
 								 reply,
 								 sizeof(buffer));
+	} else if (os_strncmp(buf, "TERMINATE", 9) == 0) {
+		eloop_terminate();
 	} else {
 		wpa_printf(MSG_DEBUG, "Unrecognized global ctrl_iface command "
 			   "ignored");