aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/wpa_ctrl.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-02-27 16:35:33 (GMT)
committerJouni Malinen <j@w1.fi>2011-02-27 16:35:33 (GMT)
commit73304dbf65c3da859b1c51e6be32457e9ec9932d (patch)
tree572533966dd16dc420c260be942982132450f2fc /src/common/wpa_ctrl.c
parentb3f3865e0e7f8d2362c2bfb6019d84a67f2b2dff (diff)
downloadhostap-73304dbf65c3da859b1c51e6be32457e9ec9932d.zip
hostap-73304dbf65c3da859b1c51e6be32457e9ec9932d.tar.gz
hostap-73304dbf65c3da859b1c51e6be32457e9ec9932d.tar.bz2
Allow client control socket location to be overridden
Build options can now be used to replace the location of client sockets for UNIX domain socket control interface: CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_DIR=\"/tmp\" CFLAGS += -DCONFIG_CTRL_IFACE_CLIENT_PREFIX=\"wpa_ctrl_\"
Diffstat (limited to 'src/common/wpa_ctrl.c')
-rw-r--r--src/common/wpa_ctrl.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c
index 899b6bd..546699b 100644
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -63,6 +63,14 @@ struct wpa_ctrl {
#ifdef CONFIG_CTRL_IFACE_UNIX
+#ifndef CONFIG_CTRL_IFACE_CLIENT_DIR
+#define CONFIG_CTRL_IFACE_CLIENT_DIR "/tmp"
+#endif /* CONFIG_CTRL_IFACE_CLIENT_DIR */
+#ifndef CONFIG_CTRL_IFACE_CLIENT_PREFIX
+#define CONFIG_CTRL_IFACE_CLIENT_PREFIX "wpa_ctrl_"
+#endif /* CONFIG_CTRL_IFACE_CLIENT_PREFIX */
+
+
struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
{
struct wpa_ctrl *ctrl;
@@ -86,7 +94,9 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
counter++;
try_again:
ret = os_snprintf(ctrl->local.sun_path, sizeof(ctrl->local.sun_path),
- "/tmp/wpa_ctrl_%d-%d", (int) getpid(), counter);
+ CONFIG_CTRL_IFACE_CLIENT_DIR "/"
+ CONFIG_CTRL_IFACE_CLIENT_PREFIX "%d-%d",
+ (int) getpid(), counter);
if (ret < 0 || (size_t) ret >= sizeof(ctrl->local.sun_path)) {
close(ctrl->s);
os_free(ctrl);