summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2003-11-06 00:47:11 +0000
committerLennart Poettering <lennart@poettering.net>2003-11-06 00:47:11 +0000
commit9ca4078714503ee8942f6dd16c31f1d807bbf053 (patch)
tree68d5a312b40c6d708b4d71fecea809536127717d
parent216fa54655810fce6ba911a3cf9fca19df862dec (diff)
scan fix
git-svn-id: file:///home/lennart/svn/public/waproamd/trunk@41 022f378f-78c4-0310-b860-d162c87e6274
-rw-r--r--src/waproamd.c74
1 files changed, 41 insertions, 33 deletions
diff --git a/src/waproamd.c b/src/waproamd.c
index b269def..b37b38d 100644
--- a/src/waproamd.c
+++ b/src/waproamd.c
@@ -70,8 +70,9 @@ int poll_interval = 5,
char log_ident[32], pid_ident[32];
int issue_scan(struct interface *i) {
+ static int count = 0;
- /* daemon_log(LOG_ERR, "Scanning...\n"); */
+ daemon_log(LOG_ERR, "Scanning... %i\n", count++);
/* Due to driver issues, the return codes of these function calls are no longer evaluated */
iw_set_mode(i, IW_MODE_INFRA);
@@ -372,40 +373,50 @@ int go(struct interface *i) {
daemon_log(LOG_INFO, "Interface enabled\n");
associated = scanning = 0;
}
-
- /* Changed: associated -> not associated */
- if (a && !associated) {
- daemon_log(LOG_INFO, "No longer associated.\n");
- scanning = 0;
- }
-
- /* Changed: not associated -> associated */
- if (!a && associated) {
- if (set_current_ap(&associated_ap) < 0)
- goto finish;
-
- daemon_log(LOG_INFO, "Associated.\n");
- scanning = 0;
- }
-
- if (scanning) {
- int r;
- struct ap_info *ai = NULL;
+
+ if (!disabled) {
+ /* Changed: associated -> not associated */
+ if (a && !associated) {
+ daemon_log(LOG_INFO, "No longer associated.\n");
+ scanning = 0;
+ }
- if ((r = read_scan(i, &ai)) < 0) {
- if (!use_ifmonitor)
+ /* Changed: not associated -> associated */
+ if (!a && associated) {
+ if (set_current_ap(&associated_ap) < 0)
goto finish;
+ daemon_log(LOG_INFO, "Associated.\n");
scanning = 0;
+ }
+
+ if (scanning) {
+ int r;
+ struct ap_info *ai = NULL;
- } else if (!r) {
+ if ((r = read_scan(i, &ai)) < 0) {
+ if (!use_ifmonitor)
+ goto finish;
+
+ scanning = 0;
+
+ } else if (!r) {
- scanning = 0;
+ scanning = 0;
- if (!associated) {
-
- if (set_current_ap(ai ? &ai->ap : NULL) < 0)
- goto finish;
+ if (!associated) {
+
+ if (ai) {
+ if (iw_tune(i, ai) < 0)
+ goto finish;
+
+ if (set_current_ap(&ai->ap) < 0)
+ goto finish;
+ } else {
+ if (set_current_ap(NULL) < 0)
+ goto finish;
+ }
+ }
}
}
}
@@ -459,14 +470,11 @@ int go(struct interface *i) {
}
}
- if (next_scan == (time_t) -1 && !scanning)
- if (!disabled && !associated && !paused)
- next_scan = time(NULL) + scan_interval;
-
if (disabled || associated || paused) {
scanning = 0;
next_scan = (time_t) -1;
- }
+ } else if (next_scan == (time_t) -1 && !scanning)
+ next_scan = time(NULL) + scan_interval;
}
r = 0;