summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorPaul Drews <paul.drews@intel.com>2012-07-24 16:17:53 -0700
committerAndrew Boie <andrew.p.boie@intel.com>2012-08-23 14:01:37 -0700
commit24ffafedc87d05611703deb62e25d71684e0723e (patch)
treee24e39071b09a8f339806640436919280f7261e6 /wifi
parent20eade73390ac941b9ebbe19177393e70531db8b (diff)
downloadhardware_libhardware_legacy-24ffafedc87d05611703deb62e25d71684e0723e.zip
hardware_libhardware_legacy-24ffafedc87d05611703deb62e25d71684e0723e.tar.gz
hardware_libhardware_legacy-24ffafedc87d05611703deb62e25d71684e0723e.tar.bz2
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 <paul.drews@intel.com> Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Diffstat (limited to 'wifi')
-rw-r--r--wifi/wifi.c14
1 files changed, 13 insertions, 1 deletions
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=<value>" 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 <value> 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);