summaryrefslogtreecommitdiffstats
path: root/src/iwapi.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2003-11-16 22:45:25 +0000
committerLennart Poettering <lennart@poettering.net>2003-11-16 22:45:25 +0000
commit219b9b062b40f0f5a4edd982164d170633dc7433 (patch)
treec72309fc476e2188c9d3399e3662c8d9bf5831a5 /src/iwapi.c
parent909f82a22883e3f45ec64d8206802bbce5bad9bf (diff)
many changes including host roaming support
git-svn-id: file:///home/lennart/svn/public/waproamd/trunk@46 022f378f-78c4-0310-b860-d162c87e6274
Diffstat (limited to 'src/iwapi.c')
-rw-r--r--src/iwapi.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/iwapi.c b/src/iwapi.c
index 5fbb305..3202f9e 100644
--- a/src/iwapi.c
+++ b/src/iwapi.c
@@ -18,7 +18,6 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include <net/if_arp.h>
#include <errno.h>
#include <assert.h>
#include <string.h>
@@ -195,13 +194,10 @@ int iw_scan_result(struct interface *i, int (*callback)(struct ap_info* ap)) {
}
if ((e->u.mode != IW_MODE_INFRA) &&
- (e->u.mode != IW_MODE_MASTER) &&
- (e->u.mode != IW_MODE_ADHOC))
- f = 0; // Ignore non-APs, non-adhocs
- else {
+ (e->u.mode != IW_MODE_MASTER))
+ f = 0; // Ignore non-APs
+ else
f |= 4;
- ap.adhoc = e->u.mode == IW_MODE_ADHOC;
- }
break;
@@ -235,12 +231,10 @@ int iw_tune(struct interface *i, struct ap_info *ap) {
assert(i && ap);
/* We are not interested in the return values of these functions due to driver issues */
- iw_set_mode(i, ap->adhoc ? IW_MODE_ADHOC : IW_MODE_INFRA);
+ iw_set_mode(i, IW_MODE_INFRA);
iw_set_essid(i, ap->essid);
iw_set_freq(i, &ap->freq);
-
- if (!ap->adhoc)
- iw_set_ap(i, &ap->ap);
+ iw_set_ap(i, &ap->ap);
return 0;
}
@@ -320,9 +314,16 @@ int iw_assoc(struct interface *i, struct ap_info *ap) {
struct hw_addr hw;
struct iwreq req;
struct iw_statistics q;
+ int m;
assert(i);
+ if (iw_get_mode(i, &m) < 0)
+ return -1;
+
+ if (m != IW_MODE_INFRA)
+ return 0;
+
if (iw_get_ap(i, &hw) < 0)
return -1;
@@ -345,7 +346,6 @@ int iw_assoc(struct interface *i, struct ap_info *ap) {
return 0;
if (ap) {
- int m;
memset(ap, 0, sizeof(struct ap_info));
memcpy(ap->ap.addr, hw.addr, ETH_ALEN);
@@ -355,16 +355,6 @@ int iw_assoc(struct interface *i, struct ap_info *ap) {
if (iw_get_freq(i, &ap->freq) < 0)
return -1;
-
- if (iw_get_mode(i, &m) < 0)
- return -1;
-
- if (m != IW_MODE_INFRA && m != IW_MODE_ADHOC) {
- daemon_log(LOG_ERR, "Bad interface mode\n");
- return -1;
- }
-
- ap->adhoc = m == IW_MODE_ADHOC;
}
return 1;
@@ -373,8 +363,5 @@ int iw_assoc(struct interface *i, struct ap_info *ap) {
int iw_ap_info_equal(const struct ap_info *a, const struct ap_info *b) {
assert(a && b);
- return !strcmp(a->essid, b->essid) &&
- !!a->adhoc == !!b->adhoc &&
- !memcmp(&a->freq, &b->freq, sizeof(a->freq)) &&
- (a->adhoc || hw_addr_equal(&a->ap, &b->ap));
+ return !strcmp(a->essid, b->essid) && !memcmp(&a->freq, &b->freq, sizeof(a->freq));
}