diff mbox

[v3,02/26] wpa_supplicant: ctrl handle IFNAME for global iface

Message ID 1455711269-12929-3-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
In case of global ctrl iface return "global" as
a result of IFNAME.

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

Comments

Jouni Malinen Feb. 20, 2016, 3:18 p.m. UTC | #1
On Wed, Feb 17, 2016 at 01:14:05PM +0100, Janusz Dziedzic wrote:
> In case of global ctrl iface return "global" as
> a result of IFNAME.

Why would this be done? "global" looks like a valid netdev name and
getting "UNKNOWN COMMAND" response would already be available for
recognizing the global interface.

> +	} else if (os_strncmp(buf, "IFNAME", 6) == 0) {

Please also note that this would match any string starting with
"IFNAME". That does not sound correct regardless of whether there is
use in returning the fixed "global" response.
Janusz.Dziedzic@tieto.com Feb. 21, 2016, 12:44 p.m. UTC | #2
On 20 February 2016 at 16:18, Jouni Malinen <j@w1.fi> wrote:
> On Wed, Feb 17, 2016 at 01:14:05PM +0100, Janusz Dziedzic wrote:
>> In case of global ctrl iface return "global" as
>> a result of IFNAME.
>
> Why would this be done? "global" looks like a valid netdev name and
> getting "UNKNOWN COMMAND" response would already be available for
> recognizing the global interface.
>
>> +     } else if (os_strncmp(buf, "IFNAME", 6) == 0) {
>
Yes, I think we can skip this patch. I added this to handle wpa_cli
issue when connecting to global udp port.
But, this is not required for wpaspy and in case of wpa_cli proper
patch could be added to wpa_cli code.

> Please also note that this would match any string starting with
> "IFNAME". That does not sound correct regardless of whether there is
> use in returning the fixed "global" response.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index b3d6246..6829aa0 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -9677,6 +9677,9 @@  char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
 	} else if (os_strncmp(buf, "RELOG", 5) == 0) {
 		if (wpa_debug_reopen_file() < 0)
 			reply_len = -1;
+	} else if (os_strncmp(buf, "IFNAME", 6) == 0) {
+		os_memcpy(reply, "global", 6);
+		reply_len = 6;
 	} else {
 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
 		reply_len = 16;