aboutsummaryrefslogtreecommitdiffstats
path: root/iw_scan.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2020-07-29 23:11:46 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2020-07-29 23:11:46 +0100
commit612e6fdfa43ac716a2431d695de842f7127c12d0 (patch)
tree58532da4c219499547e0ab5554d78ea112eea466 /iw_scan.c
parent818f5500fa11d5bf57c5542b20beb94d6f0dda6e (diff)
parent8deb3660926fe8278948b898b9c1b772eed2e61e (diff)
downloadwavemon-612e6fdfa43ac716a2431d695de842f7127c12d0.tar.gz
Update upstream source from tag 'upstream/0.9.1'
Update to upstream version '0.9.1' with Debian dir 559193b433abdd46788bc66e02edda248b928278
Diffstat (limited to 'iw_scan.c')
-rw-r--r--iw_scan.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/iw_scan.c b/iw_scan.c
index 2748376..b9b1f9c 100644
--- a/iw_scan.c
+++ b/iw_scan.c
@@ -143,7 +143,7 @@ static bool wait_for_scan_events(void)
int scan_dump_handler(struct nl_msg *msg, void *arg)
{
struct scan_result *sr = (struct scan_result *)arg;
- struct scan_entry *new = calloc(1, sizeof(*new));
+ struct scan_entry *new;
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct nlattr *bss[NL80211_BSS_MAX + 1];
@@ -209,9 +209,10 @@ int scan_dump_handler(struct nl_msg *msg, void *arg)
if (bss[NL80211_BSS_INFORMATION_ELEMENTS]) {
uint8_t *ie = nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
int ielen = nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
- uint8_t len = ie[1];
- while (ielen >= 2 && ielen >= ie[1]) {
+ while (ielen >= 2 && ielen >= ie[1]) {
+ uint8_t len = ie[1];
+
switch (ie[0]) {
case 0: /* SSID */
if (len > 0 && len <= 32)
@@ -227,7 +228,7 @@ int scan_dump_handler(struct nl_msg *msg, void *arg)
}
ielen -= ie[1] + 2;
ie += ie[1] + 2;
- }
+ }
}
/* Update stats */
@@ -429,6 +430,8 @@ void *do_scan(void *sr_ptr)
if (if_set_up(conf_ifname()) < 0)
err_sys("Can not bring up interface '%s'", conf_ifname());
+ if (atexit(if_set_down_on_exit) < 0)
+ snprintf(sr->msg, sizeof(sr->msg), "Warning: unable to restore %s down state on exit", conf_ifname());
break;
}
/* fall through */