summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdrien Schildknecht <adrien+dev@schischi.me>2013-01-24 14:51:33 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-01-24 15:22:00 +0100
commitd43664235a568ae6dcc1fb4e02ca91c889eb1570 (patch)
treecf44442945fb36943e0345072e223b9ecd0f6a82 /src
parent11757b8105ebebba40c3a94c5d6c5431cc58b3d1 (diff)
wifi: properly display ad-hoc networks
No statistics are displayed with ad-hoc networks since none are available.
Diffstat (limited to 'src')
-rw-r--r--src/print_wireless_info.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 9ab9c2f..a678f52 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -93,6 +93,15 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
info->essid[IW_ESSID_MAX_SIZE] = '\0';
}
+ /* If the function iw_get_stats does not return proper stats, the
+ wifi is considered as down.
+ Since ad-hoc network does not have theses stats, we need to return
+ here for this mode. */
+ if (wcfg.mode == 1) {
+ close(skfd);
+ return 1;
+ }
+
/* Wireless quality is a relative value in a driver-specific range.
Signal and noise level can be either relative or absolute values
in dBm. Furthermore, noise and quality can be expressed directly