summaryrefslogtreecommitdiff
path: root/contrib/wpa
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2009-03-13 19:05:34 +0000
committerSam Leffler <sam@FreeBSD.org>2009-03-13 19:05:34 +0000
commit470736a0612be349e590fe52ce9a656cd269f4b4 (patch)
tree55371f4d49fe501ccdf3cce43851a926129db6c4 /contrib/wpa
parent869041cd77b687b67bccd9164d0c05f86196e1fd (diff)
downloadsrc-test-470736a0612be349e590fe52ce9a656cd269f4b4.tar.gz
src-test-470736a0612be349e590fe52ce9a656cd269f4b4.zip
fix portability; linux does not have sa_len/sun_len
Notes
Notes: svn path=/head/; revision=189775
Diffstat (limited to 'contrib/wpa')
-rw-r--r--contrib/wpa/wpa_supplicant/ctrl_iface_unix.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c b/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c
index bf6328e75e5a4..9f54486fb687d 100644
--- a/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c
+++ b/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c
@@ -16,6 +16,7 @@
#include <sys/un.h>
#include <sys/stat.h>
#include <grp.h>
+#include <stddef.h>
#include "common.h"
#include "eloop.h"
@@ -69,7 +70,8 @@ static int wpa_supplicant_ctrl_iface_attach(struct ctrl_iface_priv *priv,
dst->next = priv->ctrl_dst;
priv->ctrl_dst = dst;
wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached",
- (u8 *) from->sun_path, fromlen - sizeof(from->sun_family));
+ (u8 *) from->sun_path,
+ fromlen - offsetof(struct sockaddr_un, sun_path));
return 0;
}
@@ -84,7 +86,7 @@ static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
while (dst) {
if (fromlen == dst->addrlen &&
os_memcmp(from->sun_path, dst->addr.sun_path,
- fromlen - sizeof(from->sun_family)) == 0) {
+ fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) {
if (prev == NULL)
priv->ctrl_dst = dst->next;
else
@@ -92,7 +94,7 @@ static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
os_free(dst);
wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached",
(u8 *) from->sun_path,
- fromlen - sizeof(from->sun_family));
+ fromlen - offsetof(struct sockaddr_un, sun_path));
return 0;
}
prev = dst;
@@ -115,10 +117,10 @@ static int wpa_supplicant_ctrl_iface_level(struct ctrl_iface_priv *priv,
while (dst) {
if (fromlen == dst->addrlen &&
os_memcmp(from->sun_path, dst->addr.sun_path,
- fromlen - sizeof(from->sun_family)) == 0) {
+ fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) {
wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor "
"level", (u8 *) from->sun_path,
- fromlen - sizeof(from->sun_family));
+ fromlen - offsetof(struct sockaddr_un, sun_path));
dst->debug_level = atoi(level);
return 0;
}
@@ -339,6 +341,8 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
}
os_memset(&addr, 0, sizeof(addr));
+ /* XXX #ifdef */
+ addr.sun_len = sizeof(addr);
addr.sun_family = AF_UNIX;
fname = wpa_supplicant_ctrl_iface_path(wpa_s);
if (fname == NULL)
@@ -509,8 +513,8 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
next = dst->next;
if (level >= dst->debug_level) {
wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor send",
- (u8 *) dst->addr.sun_path, dst->addrlen -
- sizeof(dst->addr.sun_family));
+ (u8 *) dst->addr.sun_path,
+ dst->addrlen - offsetof(struct sockaddr_un, sun_path));
msg.msg_name = (void *) &dst->addr;
msg.msg_namelen = dst->addrlen;
if (sendmsg(priv->sock, &msg, 0) < 0) {
@@ -637,6 +641,8 @@ wpa_supplicant_global_ctrl_iface_init(struct wpa_global *global)
}
os_memset(&addr, 0, sizeof(addr));
+ /* XXX #ifdef */
+ addr.sun_len = sizeof(addr);
addr.sun_family = AF_UNIX;
os_strlcpy(addr.sun_path, global->params.ctrl_interface,
sizeof(addr.sun_path));