From 24ffafedc87d05611703deb62e25d71684e0723e Mon Sep 17 00:00:00 2001 From: Paul Drews Date: Tue, 24 Jul 2012 16:17:53 -0700 Subject: Restore the ability to use ctrl_interface directory lihardware_legacy was ALWAYS re-writing the wpa_supplicant.conf file's "ctrl_interface" entry to the value specified as the property wifi.interface, whose value was typically "wlan0". This was designed to allow the wpa_supplicant service to be started with a "socket" directive in its service description in an init.rc file. Under these circumstances, the socket name is exchanged between wpa_supplicant and its WifiService client through an environment variable whose name is derived from wifi.interface and a standard prefix. However, since the "ctrl_interface" entry was always re-written in this way, it broke the ability to use "ctrl_interface" in its standard usage as a directory where the (unix-domain) socket will be exchanged. This change restores the ability to use the standard directory-form ctrl_interface usage by limiting the re-writing of the ctrl_interface entry to cases where it does not look like an absolute path or the "DIR=" form of directory. Change-Id: I96c8656d144c1ea41e25ab0eb0807f7b49193b49 Signed-off-by: Paul Drews Signed-off-by: Andrew Boie --- wifi/wifi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'wifi') diff --git a/wifi/wifi.c b/wifi/wifi.c index 5a42e2d..cd9bf65 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -367,7 +367,19 @@ int update_ctrl_interface(const char *config_file) { } else { strcpy(ifc, CONTROL_IFACE_PATH); } - if ((sptr = strstr(pbuf, "ctrl_interface="))) { + /* + * if there is a "ctrl_interface=" entry, re-write it ONLY if it is + * NOT a directory. The non-directory value option is an Android add-on + * that allows the control interface to be exchanged through an environment + * variable (initialized by the "init" program when it starts a service + * with a "socket" option). + * + * The is deemed to be a directory if the "DIR=" form is used or + * the value begins with "/". + */ + if ((sptr = strstr(pbuf, "ctrl_interface=")) && + (!strstr(pbuf, "ctrl_interface=DIR=")) && + (!strstr(pbuf, "ctrl_interface=/"))) { char *iptr = sptr + strlen("ctrl_interface="); int ilen = 0; int mlen = strlen(ifc); -- cgit v1.1