aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-03-27 21:17:45 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-27 21:17:45 (GMT)
commitbde9a4e3de2051e7cb8a2c8718d89c40050a3524 (patch)
tree9d49c14871d387a7b42806a5a0206cd9e94dbe9e
parenta6fbff2049fab0122a81ac575b824551f5ce711b (diff)
downloadhostap-bde9a4e3de2051e7cb8a2c8718d89c40050a3524.zip
hostap-bde9a4e3de2051e7cb8a2c8718d89c40050a3524.tar.gz
hostap-bde9a4e3de2051e7cb8a2c8718d89c40050a3524.tar.bz2
Comment out UDP/UNIX socket code from common ctrl_iface based on build
These were unreachable cases in the switch statements based on how the build was configured. Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/common/ctrl_iface_common.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/common/ctrl_iface_common.c b/src/common/ctrl_iface_common.c
index acd2410..ebbe6ff 100644
--- a/src/common/ctrl_iface_common.c
+++ b/src/common/ctrl_iface_common.c
@@ -17,15 +17,15 @@
static int sockaddr_compare(struct sockaddr_storage *a, socklen_t a_len,
struct sockaddr_storage *b, socklen_t b_len)
{
- struct sockaddr_in *in_a, *in_b;
- struct sockaddr_in6 *in6_a, *in6_b;
- struct sockaddr_un *u_a, *u_b;
-
if (a->ss_family != b->ss_family)
return 1;
switch (a->ss_family) {
+#ifdef CONFIG_CTRL_IFACE_UDP
case AF_INET:
+ {
+ struct sockaddr_in *in_a, *in_b;
+
in_a = (struct sockaddr_in *) a;
in_b = (struct sockaddr_in *) b;
@@ -34,7 +34,11 @@ static int sockaddr_compare(struct sockaddr_storage *a, socklen_t a_len,
if (in_a->sin_addr.s_addr != in_b->sin_addr.s_addr)
return 1;
break;
+ }
case AF_INET6:
+ {
+ struct sockaddr_in6 *in6_a, *in6_b;
+
in6_a = (struct sockaddr_in6 *) a;
in6_b = (struct sockaddr_in6 *) b;
@@ -44,7 +48,13 @@ static int sockaddr_compare(struct sockaddr_storage *a, socklen_t a_len,
sizeof(in6_a->sin6_addr)) != 0)
return 1;
break;
+ }
+#endif /* CONFIG_CTRL_IFACE_UDP */
+#ifdef CONFIG_CTRL_IFACE_UNIX
case AF_UNIX:
+ {
+ struct sockaddr_un *u_a, *u_b;
+
u_a = (struct sockaddr_un *) a;
u_b = (struct sockaddr_un *) b;
@@ -54,6 +64,8 @@ static int sockaddr_compare(struct sockaddr_storage *a, socklen_t a_len,
!= 0)
return 1;
break;
+ }
+#endif /* CONFIG_CTRL_IFACE_UNIX */
default:
return 1;
}
@@ -65,13 +77,14 @@ static int sockaddr_compare(struct sockaddr_storage *a, socklen_t a_len,
void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
socklen_t socklen)
{
- char host[NI_MAXHOST] = { 0 };
- char service[NI_MAXSERV] = { 0 };
- char addr_txt[200];
-
switch (sock->ss_family) {
+#ifdef CONFIG_CTRL_IFACE_UDP
case AF_INET:
case AF_INET6:
+ {
+ char host[NI_MAXHOST] = { 0 };
+ char service[NI_MAXSERV] = { 0 };
+
getnameinfo((struct sockaddr *) sock, socklen,
host, sizeof(host),
service, sizeof(service),
@@ -79,12 +92,20 @@ void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
wpa_printf(level, "%s %s:%s", msg, host, service);
break;
+ }
+#endif /* CONFIG_CTRL_IFACE_UDP */
+#ifdef CONFIG_CTRL_IFACE_UNIX
case AF_UNIX:
+ {
+ char addr_txt[200];
+
printf_encode(addr_txt, sizeof(addr_txt),
(u8 *) ((struct sockaddr_un *) sock)->sun_path,
socklen - offsetof(struct sockaddr_un, sun_path));
wpa_printf(level, "%s %s", msg, addr_txt);
break;
+ }
+#endif /* CONFIG_CTRL_IFACE_UNIX */
default:
wpa_printf(level, "%s", msg);
break;