summaryrefslogtreecommitdiffstats
path: root/contrib/wpa_supplicant/wpa_ctrl.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-03-07 05:44:45 +0000
committersam <sam@FreeBSD.org>2006-03-07 05:44:45 +0000
commitf87f3cf9d3ac68ade33194941f85722ffdff2195 (patch)
tree72b7a4837fa3c101b02d8b1b2b0cc478c8b033e3 /contrib/wpa_supplicant/wpa_ctrl.c
parent8b3f1ba26b4b0c34e27cf045b5873f791d667e6e (diff)
downloadFreeBSD-src-f87f3cf9d3ac68ade33194941f85722ffdff2195.zip
FreeBSD-src-f87f3cf9d3ac68ade33194941f85722ffdff2195.tar.gz
resolve merge conflicts
MFC after: 2 weeks
Diffstat (limited to 'contrib/wpa_supplicant/wpa_ctrl.c')
-rw-r--r--contrib/wpa_supplicant/wpa_ctrl.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/contrib/wpa_supplicant/wpa_ctrl.c b/contrib/wpa_supplicant/wpa_ctrl.c
index 3c79fc4..e7a9a4f 100644
--- a/contrib/wpa_supplicant/wpa_ctrl.c
+++ b/contrib/wpa_supplicant/wpa_ctrl.c
@@ -1,5 +1,5 @@
/*
- * WPA Supplicant - wpa_supplicant control interface library
+ * wpa_supplicant/hostapd control interface library
* Copyright (c) 2004-2005, Jouni Malinen <jkmaline@cc.hut.fi>
*
* This program is free software; you can redistribute it and/or modify
@@ -22,6 +22,7 @@
#include <sys/time.h>
#ifndef CONFIG_NATIVE_WINDOWS
#include <sys/socket.h>
+#include <netinet/in.h>
#include <sys/un.h>
#endif /* CONFIG_NATIVE_WINDOWS */
@@ -31,6 +32,15 @@
#endif /* CONFIG_NATIVE_WINDOWS */
+/**
+ * struct wpa_ctrl - Internal structure for control interface library
+ *
+ * This structure is used by the wpa_supplicant/hostapd control interface
+ * library to store internal data. Programs using the library should not touch
+ * this data directly. They can only use the pointer to the data structure as
+ * an identifier for the control interface connection and use this as one of
+ * the arguments for most of the control interface library functions.
+ */
struct wpa_ctrl {
int s;
#ifdef CONFIG_CTRL_IFACE_UDP
@@ -74,7 +84,7 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
ctrl->dest.sin_family = AF_INET;
ctrl->dest.sin_addr.s_addr = htonl((127 << 24) | 1);
- ctrl->dest.sin_port = htons(9877);
+ ctrl->dest.sin_port = htons(WPA_CTRL_IFACE_PORT);
if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest,
sizeof(ctrl->dest)) < 0) {
perror("connect");
@@ -124,7 +134,7 @@ void wpa_ctrl_close(struct wpa_ctrl *ctrl)
}
-int wpa_ctrl_request(struct wpa_ctrl *ctrl, char *cmd, size_t cmd_len,
+int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
char *reply, size_t *reply_len,
void (*msg_cb)(char *msg, size_t len))
{
@@ -153,7 +163,7 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, char *cmd, size_t cmd_len,
if (msg_cb) {
/* Make sure the message is nul
* terminated. */
- if (res == *reply_len)
+ if ((size_t) res == *reply_len)
res = (*reply_len) - 1;
reply[res] = '\0';
msg_cb(reply, res);
OpenPOWER on IntegriCloud