aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_bsd.c
diff options
context:
space:
mode:
authorYi Zhu <Yi.Zhu@Atheros.com>2011-04-12 20:09:14 (GMT)
committerJouni Malinen <j@w1.fi>2011-04-12 20:09:14 (GMT)
commitd4a747f0067379e7e995325efdaab03103cd07b1 (patch)
treee9747d7330107d2490efe35ac8014b3297f3d328 /src/drivers/driver_bsd.c
parent67b9bd089b0a556d3a1aa417412ecfa46f05b960 (diff)
downloadhostap-d4a747f0067379e7e995325efdaab03103cd07b1.zip
hostap-d4a747f0067379e7e995325efdaab03103cd07b1.tar.gz
hostap-d4a747f0067379e7e995325efdaab03103cd07b1.tar.bz2
bsd: Fix buffer size for routing socket with IPv6 disabled
AF_INET6 is not always enabled by default, so use AF_INET instead. In addition, use the old fixed length, 2048, as a failover value if the sysctl fails for any reason.
Diffstat (limited to 'src/drivers/driver_bsd.c')
-rw-r--r--src/drivers/driver_bsd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 5348d09..dc3e264 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -575,12 +575,12 @@ rtbuf_len(void)
{
size_t len;
- int mib[6] = {CTL_NET, AF_ROUTE, 0, AF_INET6, NET_RT_DUMP, 0};
+ int mib[6] = {CTL_NET, AF_ROUTE, 0, AF_INET, NET_RT_DUMP, 0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
- wpa_printf(MSG_ERROR, "%s failed: %s\n", __func__,
+ wpa_printf(MSG_WARNING, "%s failed: %s\n", __func__,
strerror(errno));
- return -1;
+ len = 2048;
}
return len;
@@ -717,8 +717,6 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
union wpa_event_data data;
len = rtbuf_len();
- if (len < 0)
- return;
buf = os_malloc(len);
if (buf == NULL) {
@@ -1156,8 +1154,6 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
int n, len;
len = rtbuf_len();
- if (len < 0)
- return;
buf = os_malloc(len);
if (buf == NULL) {