Make 802.11 devices to work with stealth AP even when scanning
channels marked passive. From FreeBSD.
This commit is contained in:
parent
72ccefa820
commit
3fb751b1b5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_input.c,v 1.59 2006/05/14 21:19:33 elad Exp $ */
|
||||
/* $NetBSD: ieee80211_input.c,v 1.60 2006/06/30 06:17:10 tacha Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -36,7 +36,7 @@
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.59 2006/05/14 21:19:33 elad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.60 2006/06/30 06:17:10 tacha Exp $");
|
||||
#endif
|
||||
|
||||
#include "opt_inet.h"
|
||||
@ -2092,6 +2092,18 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0,
|
||||
* If scanning, just pass information to the scan module.
|
||||
*/
|
||||
if (ic->ic_flags & IEEE80211_F_SCAN) {
|
||||
if (ic->ic_flags_ext & IEEE80211_FEXT_PROBECHAN) {
|
||||
/*
|
||||
* Actively scanning a channel marked passive;
|
||||
* send a probe request now that we know there
|
||||
* is 802.11 traffic present.
|
||||
*
|
||||
* XXX check if the beacon we recv'd gives
|
||||
* us what we need and suppress the probe req
|
||||
*/
|
||||
ieee80211_probe_curchan(ic, 1);
|
||||
ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN;
|
||||
}
|
||||
ieee80211_add_scan(ic, &scan, wh,
|
||||
subtype, rssi, rstamp);
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_node.c,v 1.56 2006/05/03 16:50:58 seanb Exp $ */
|
||||
/* $NetBSD: ieee80211_node.c,v 1.57 2006/06/30 06:17:10 tacha Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -36,7 +36,7 @@
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.56 2006/05/03 16:50:58 seanb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.57 2006/06/30 06:17:10 tacha Exp $");
|
||||
#endif
|
||||
|
||||
#include "opt_inet.h"
|
||||
@ -340,6 +340,7 @@ ieee80211_next_scan(struct ieee80211com *ic)
|
||||
* flushing anything queued in the driver and below.
|
||||
*/
|
||||
ic->ic_mgt_timer = 0;
|
||||
ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN;
|
||||
|
||||
chan = ic->ic_curchan;
|
||||
do {
|
||||
@ -366,6 +367,31 @@ ieee80211_next_scan(struct ieee80211com *ic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Probe the curent channel, if allowed, while scanning.
|
||||
* If the channel is not marked passive-only then send
|
||||
* a probe request immediately. Otherwise mark state and
|
||||
* listen for beacons on the channel; if we receive something
|
||||
* then we'll transmit a probe request.
|
||||
*/
|
||||
void
|
||||
ieee80211_probe_curchan(struct ieee80211com *ic, int force)
|
||||
{
|
||||
struct ifnet *ifp = ic->ic_ifp;
|
||||
|
||||
if ((ic->ic_curchan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0 || force) {
|
||||
/*
|
||||
* XXX send both broadcast+directed probe request
|
||||
*/
|
||||
ieee80211_send_probereq(ic->ic_bss,
|
||||
ic->ic_myaddr, ifp->if_broadcastaddr,
|
||||
ifp->if_broadcastaddr,
|
||||
ic->ic_des_essid, ic->ic_des_esslen,
|
||||
ic->ic_opt_ie, ic->ic_opt_ie_len);
|
||||
} else
|
||||
ic->ic_flags_ext |= IEEE80211_FEXT_PROBECHAN;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
copy_bss(struct ieee80211_node *nbss, const struct ieee80211_node *obss)
|
||||
{
|
||||
@ -610,6 +636,7 @@ ieee80211_cancel_scan(struct ieee80211com *ic)
|
||||
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive");
|
||||
|
||||
ic->ic_flags &= ~(IEEE80211_F_SCAN | IEEE80211_F_ASCAN);
|
||||
ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_node.h,v 1.21 2005/12/10 23:26:35 elad Exp $ */
|
||||
/* $NetBSD: ieee80211_node.h,v 1.22 2006/06/30 06:17:10 tacha Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -191,6 +191,7 @@ void ieee80211_node_unauthorize(struct ieee80211_node *);
|
||||
|
||||
void ieee80211_begin_scan(struct ieee80211com *, int);
|
||||
int ieee80211_next_scan(struct ieee80211com *);
|
||||
void ieee80211_probe_curchan(struct ieee80211com *, int);
|
||||
void ieee80211_create_ibss(struct ieee80211com*, struct ieee80211_channel *);
|
||||
void ieee80211_reset_bss(struct ieee80211com *);
|
||||
void ieee80211_cancel_scan(struct ieee80211com *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_proto.c,v 1.24 2006/03/02 03:38:48 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_proto.c,v 1.25 2006/06/30 06:17:10 tacha Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -36,7 +36,7 @@
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.23 2005/08/10 16:22:29 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.24 2006/03/02 03:38:48 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.25 2006/06/30 06:17:10 tacha Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -991,19 +991,11 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
|
||||
break;
|
||||
case IEEE80211_S_SCAN:
|
||||
/*
|
||||
* Scan next. If doing an active scan and the
|
||||
* channel is not marked passive-only then send
|
||||
* a probe request. Otherwise just listen for
|
||||
* beacons on the channel.
|
||||
* Scan next. If doing an active scan probe
|
||||
* for the requested ap (if any).
|
||||
*/
|
||||
if ((ic->ic_flags & IEEE80211_F_ASCAN) &&
|
||||
(ic->ic_curchan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) {
|
||||
ieee80211_send_probereq(ni,
|
||||
ic->ic_myaddr, ifp->if_broadcastaddr,
|
||||
ifp->if_broadcastaddr,
|
||||
ic->ic_des_essid, ic->ic_des_esslen,
|
||||
ic->ic_opt_ie, ic->ic_opt_ie_len);
|
||||
}
|
||||
if (ic->ic_flags & IEEE80211_F_ASCAN)
|
||||
ieee80211_probe_curchan(ic, 0);
|
||||
break;
|
||||
case IEEE80211_S_RUN:
|
||||
/* beacon miss */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_var.h,v 1.24 2006/03/28 00:48:10 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_var.h,v 1.25 2006/06/30 06:17:10 tacha Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -256,6 +256,7 @@ extern struct ieee80211com_head ieee80211com_head;
|
||||
#define IEEE80211_FEXT_WDS 0x00000001 /* CONF: 4 addr allowed */
|
||||
/* 0x00000006 reserved */
|
||||
#define IEEE80211_FEXT_BGSCAN 0x00000008 /* STATUS: enable full bgscan completion */
|
||||
#define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/
|
||||
|
||||
/* ic_caps */
|
||||
#define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */
|
||||
|
Loading…
Reference in New Issue
Block a user