aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2016-03-04 09:20:23 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-05 15:15:05 (GMT)
commitacf57fae765b7bbabb6dcfa43a54af7f847b76cf (patch)
tree35075fdc728e7cb7fda30e4262b00ad2060a1444 /src
parent89b781bc89efa3600c9c44cd80af87125b167fa0 (diff)
downloadhostap-acf57fae765b7bbabb6dcfa43a54af7f847b76cf.zip
hostap-acf57fae765b7bbabb6dcfa43a54af7f847b76cf.tar.gz
hostap-acf57fae765b7bbabb6dcfa43a54af7f847b76cf.tar.bz2
ctrl_iface_common: Use sockaddr_storage instead of sockaddr_un
This is a step towards allowing UDP sockets to be used with the common implementation. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Diffstat (limited to 'src')
-rw-r--r--src/common/ctrl_iface_common.c27
-rw-r--r--src/common/ctrl_iface_common.h8
2 files changed, 14 insertions, 21 deletions
diff --git a/src/common/ctrl_iface_common.c b/src/common/ctrl_iface_common.c
index d08b4a5..acd2410 100644
--- a/src/common/ctrl_iface_common.c
+++ b/src/common/ctrl_iface_common.c
@@ -92,7 +92,7 @@ void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
}
-int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen)
{
struct wpa_ctrl_dst *dst;
@@ -105,25 +105,21 @@ int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
dst->debug_level = MSG_INFO;
dl_list_add(ctrl_dst, &dst->list);
- sockaddr_print(MSG_DEBUG, "CTRL_IFACE monitor attached",
- (struct sockaddr_storage *) from, fromlen);
+ sockaddr_print(MSG_DEBUG, "CTRL_IFACE monitor attached", from, fromlen);
return 0;
}
-int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen)
{
struct wpa_ctrl_dst *dst;
dl_list_for_each(dst, ctrl_dst, struct wpa_ctrl_dst, list) {
- if (!sockaddr_compare((struct sockaddr_storage *) from,
- fromlen,
- (struct sockaddr_storage *) &dst->addr,
- dst->addrlen)) {
+ if (!sockaddr_compare(from, fromlen,
+ &dst->addr, dst->addrlen)) {
sockaddr_print(MSG_DEBUG, "CTRL_IFACE monitor detached",
- (struct sockaddr_storage *) from,
- fromlen);
+ from, fromlen);
dl_list_del(&dst->list);
os_free(dst);
return 0;
@@ -134,7 +130,7 @@ int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
}
-int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen, const char *level)
{
struct wpa_ctrl_dst *dst;
@@ -142,14 +138,11 @@ int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_un *from,
wpa_printf(MSG_DEBUG, "CTRL_IFACE LEVEL %s", level);
dl_list_for_each(dst, ctrl_dst, struct wpa_ctrl_dst, list) {
- if (!sockaddr_compare((struct sockaddr_storage *) from,
- fromlen,
- (struct sockaddr_storage *) &dst->addr,
- dst->addrlen)) {
+ if (!sockaddr_compare(from, fromlen,
+ &dst->addr, dst->addrlen)) {
sockaddr_print(MSG_DEBUG,
"CTRL_IFACE changed monitor level",
- (struct sockaddr_storage *) from,
- fromlen);
+ from, fromlen);
dst->debug_level = atoi(level);
return 0;
}
diff --git a/src/common/ctrl_iface_common.h b/src/common/ctrl_iface_common.h
index 6844093..0b6e3e7 100644
--- a/src/common/ctrl_iface_common.h
+++ b/src/common/ctrl_iface_common.h
@@ -19,7 +19,7 @@
*/
struct wpa_ctrl_dst {
struct dl_list list;
- struct sockaddr_un addr;
+ struct sockaddr_storage addr;
socklen_t addrlen;
int debug_level;
int errors;
@@ -28,11 +28,11 @@ struct wpa_ctrl_dst {
void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
socklen_t socklen);
-int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen);
-int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen);
-int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_un *from,
+int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
socklen_t fromlen, const char *level);
#endif /* CONTROL_IFACE_COMMON_H */