aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorManikandan Mohan <manikand@qca.qualcomm.com>2015-08-24 21:34:03 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:20:09 -0600
commit24ed3efe545e0e9a7669da944ba484d91afb4e70 (patch)
tree9f2bf5ec4c3fdac30adccac0fd9ae8355ff96a26 /hostapd
parent7a178f7ac60ce9cf1570f412c8b40af312f66673 (diff)
downloadandroid_external_wpa_supplicant_8-24ed3efe545e0e9a7669da944ba484d91afb4e70.tar.gz
android_external_wpa_supplicant_8-24ed3efe545e0e9a7669da944ba484d91afb4e70.tar.bz2
android_external_wpa_supplicant_8-24ed3efe545e0e9a7669da944ba484d91afb4e70.zip
Allow wpa_cli/hostapd_cli client socket directory to be specified
This adds a new helper function wpa_ctrl_open2() that can be used instead of wpa_ctrl_open() to override the default client socket directory. Add optional -s<directory path> argument to hostapd_cli and wpa_cli to allow the client socket directory to be specified. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Git-commit: 4ae7120919b16b8994212cd2675364159eeac5c7 Git-repo : git://w1.fi/srv/git/hostap.git Change-Id: I07f81b365d4f02d4590f91baa5de9f493612a9da CRs-fixed: 908558
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/hostapd_cli.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 42f8bd48..6b1ecba9 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -97,6 +97,7 @@ static int hostapd_cli_attached = 0;
#define CONFIG_CTRL_IFACE_DIR "/var/run/hostapd"
#endif /* CONFIG_CTRL_IFACE_DIR */
static const char *ctrl_iface_dir = CONFIG_CTRL_IFACE_DIR;
+static const char *client_socket_dir = NULL;
static char *ctrl_ifname = NULL;
static const char *pid_file = NULL;
@@ -119,6 +120,8 @@ static void usage(void)
" -v shown version information\n"
" -p<path> path to find control sockets (default: "
"/var/run/hostapd)\n"
+ " -s<dir_path> dir path to open client sockets (default: "
+ CONFIG_CTRL_IFACE_DIR ")\n"
" -a<file> run in daemon mode executing the action file "
"based on events\n"
" from hostapd\n"
@@ -145,7 +148,14 @@ static struct wpa_ctrl * hostapd_cli_open_connection(const char *ifname)
return NULL;
snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ifname);
- ctrl_conn = wpa_ctrl_open(cfile);
+ if (client_socket_dir && client_socket_dir[0] &&
+ access(client_socket_dir, F_OK) < 0) {
+ perror(client_socket_dir);
+ free(cfile);
+ return NULL;
+ }
+
+ ctrl_conn = wpa_ctrl_open2(cfile, client_socket_dir);
free(cfile);
return ctrl_conn;
}
@@ -1317,7 +1327,7 @@ int main(int argc, char *argv[])
return -1;
for (;;) {
- c = getopt(argc, argv, "a:BhG:i:p:v");
+ c = getopt(argc, argv, "a:BhG:i:p:P:s:v");
if (c < 0)
break;
switch (c) {
@@ -1343,6 +1353,12 @@ int main(int argc, char *argv[])
case 'p':
ctrl_iface_dir = optarg;
break;
+ case 'P':
+ pid_file = optarg;
+ break;
+ case 's':
+ client_socket_dir = optarg;
+ break;
default:
usage();
return -1;