Resolve conflicts.

This commit is contained in:
dyoung 2005-07-26 22:52:48 +00:00
parent 80b91eea2d
commit 61fb42b78a
16 changed files with 174 additions and 103 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_ioctl.c,v 1.20 2005/06/26 04:31:51 dyoung Exp $ */ /* $NetBSD: ieee80211_ioctl.c,v 1.21 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -33,10 +33,10 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.18 2005/01/24 19:32:09 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.25 2005/07/06 15:38:27 sam Exp $");
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.20 2005/06/26 04:31:51 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.21 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
/* /*
@ -1466,6 +1466,9 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
/* NB: get from ic_bss for station mode */ /* NB: get from ic_bss for station mode */
ireq->i_val = ic->ic_bss->ni_intval; ireq->i_val = ic->ic_bss->ni_intval;
break; break;
case IEEE80211_IOC_PUREG:
ireq->i_val = (ic->ic_flags & IEEE80211_F_PUREG) != 0;
break;
default: default:
error = EINVAL; error = EINVAL;
break; break;
@ -1526,9 +1529,11 @@ ieee80211_ioctl_setkey(struct ieee80211com *ic, struct ieee80211req *ireq)
if (ik.ik_flags != (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)) if (ik.ik_flags != (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV))
return EINVAL; return EINVAL;
if (ic->ic_opmode == IEEE80211_M_STA) { if (ic->ic_opmode == IEEE80211_M_STA) {
ni = ic->ic_bss; ni = ieee80211_ref_node(ic->ic_bss);
if (!IEEE80211_ADDR_EQ(ik.ik_macaddr, ni->ni_bssid)) if (!IEEE80211_ADDR_EQ(ik.ik_macaddr, ni->ni_bssid)) {
ieee80211_free_node(ni);
return EADDRNOTAVAIL; return EADDRNOTAVAIL;
}
} else { } else {
ni = ieee80211_find_node(&ic->ic_sta, ik.ik_macaddr); ni = ieee80211_find_node(&ic->ic_sta, ik.ik_macaddr);
if (ni == NULL) if (ni == NULL)
@ -1540,9 +1545,6 @@ ieee80211_ioctl_setkey(struct ieee80211com *ic, struct ieee80211req *ireq)
return EINVAL; return EINVAL;
wk = &ic->ic_nw_keys[kid]; wk = &ic->ic_nw_keys[kid];
ni = NULL; ni = NULL;
/* XXX auto-add group key flag until applications are updated */
if ((ik.ik_flags & IEEE80211_KEY_XMIT) == 0) /* XXX */
ik.ik_flags |= IEEE80211_KEY_GROUP; /* XXX */
} }
error = 0; error = 0;
ieee80211_key_update_begin(ic); ieee80211_key_update_begin(ic);
@ -1584,9 +1586,17 @@ ieee80211_ioctl_delkey(struct ieee80211com *ic, struct ieee80211req *ireq)
if (dk.idk_keyix == (u_int8_t) IEEE80211_KEYIX_NONE) { if (dk.idk_keyix == (u_int8_t) IEEE80211_KEYIX_NONE) {
struct ieee80211_node *ni; struct ieee80211_node *ni;
ni = ieee80211_find_node(&ic->ic_sta, dk.idk_macaddr); if (ic->ic_opmode == IEEE80211_M_STA) {
if (ni == NULL) ni = ieee80211_ref_node(ic->ic_bss);
return EINVAL; /* XXX */ if (!IEEE80211_ADDR_EQ(dk.idk_macaddr, ni->ni_bssid)) {
ieee80211_free_node(ni);
return EADDRNOTAVAIL;
}
} else {
ni = ieee80211_find_node(&ic->ic_sta, dk.idk_macaddr);
if (ni == NULL)
return ENOENT;
}
/* XXX error return */ /* XXX error return */
ieee80211_crypto_delkey(ic, &ni->ni_ucastkey); ieee80211_crypto_delkey(ic, &ni->ni_ucastkey);
ieee80211_free_node(ni); ieee80211_free_node(ni);
@ -1635,14 +1645,14 @@ ieee80211_ioctl_setmlme(struct ieee80211com *ic, struct ieee80211req *ireq)
return EINVAL; return EINVAL;
/* XXX must be in S_SCAN state? */ /* XXX must be in S_SCAN state? */
if (ic->ic_des_esslen != 0) { if (mlme.im_ssid_len != 0) {
/* /*
* Desired ssid specified; must match both bssid and * Desired ssid specified; must match both bssid and
* ssid to distinguish ap advertising multiple ssid's. * ssid to distinguish ap advertising multiple ssid's.
*/ */
ni = ieee80211_find_node_with_ssid(&ic->ic_scan, ni = ieee80211_find_node_with_ssid(&ic->ic_scan,
mlme.im_macaddr, mlme.im_macaddr,
ic->ic_des_esslen, ic->ic_des_essid); mlme.im_ssid_len, mlme.im_ssid);
} else { } else {
/* /*
* Normal case; just match bssid. * Normal case; just match bssid.
@ -1988,6 +1998,8 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
} else } else
error = EINVAL; error = EINVAL;
ieee80211_key_update_end(ic); ieee80211_key_update_end(ic);
if (!error) /* NB: for compatibility */
error = ENETRESET;
break; break;
case IEEE80211_IOC_WEPTXKEY: case IEEE80211_IOC_WEPTXKEY:
kid = (u_int) ireq->i_val; kid = (u_int) ireq->i_val;
@ -2326,6 +2338,15 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
} else } else
error = EINVAL; error = EINVAL;
break; break;
case IEEE80211_IOC_PUREG:
if (ireq->i_val)
ic->ic_flags |= IEEE80211_F_PUREG;
else
ic->ic_flags &= ~IEEE80211_F_PUREG;
/* NB: reset only if we're operating on an 11g channel */
if (ic->ic_curmode == IEEE80211_MODE_11G)
error = ENETRESET;
break;
default: default:
error = EINVAL; error = EINVAL;
break; break;
@ -2407,14 +2428,14 @@ ieee80211_ioctl(struct ieee80211com *ic, u_long cmd, caddr_t data)
*/ */
case AF_IPX: { case AF_IPX: {
struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
struct arpcom *ac = (struct arpcom *)ifp;
if (ipx_nullhost(*ina)) if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *) ac->ac_enaddr; ina->x_host = *(union ipx_host *)
IFP2ENADDR(ifp);
else else
bcopy((caddr_t) ina->x_host.c_host, bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) ac->ac_enaddr, (caddr_t) IFP2ENADDR(ifp),
sizeof(ac->ac_enaddr)); ETHER_ADDR_LEN);
/* fall thru... */ /* fall thru... */
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_ioctl.h,v 1.9 2005/06/22 06:16:02 dyoung Exp $ */ /* $NetBSD: ieee80211_ioctl.h,v 1.10 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -30,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.8 2004/12/31 22:42:38 sam Exp $ * $FreeBSD: src/sys/net80211/ieee80211_ioctl.h,v 1.10 2005/07/06 15:38:27 sam Exp $
*/ */
#ifndef _NET80211_IEEE80211_IOCTL_H_ #ifndef _NET80211_IEEE80211_IOCTL_H_
#define _NET80211_IEEE80211_IOCTL_H_ #define _NET80211_IEEE80211_IOCTL_H_
@ -229,8 +229,10 @@ struct ieee80211req_mlme {
#define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */ #define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */
#define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */ #define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */
#define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */ #define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */
u_int8_t im_ssid_len; /* length of optional ssid */
u_int16_t im_reason; /* 802.11 reason code */ u_int16_t im_reason; /* 802.11 reason code */
u_int8_t im_macaddr[IEEE80211_ADDR_LEN]; u_int8_t im_macaddr[IEEE80211_ADDR_LEN];
u_int8_t im_ssid[IEEE80211_NWID_LEN];
}; };
/* /*
@ -428,6 +430,7 @@ struct ieee80211req {
#define IEEE80211_IOC_BEACON_INTERVAL 53 /* beacon interval (ms) */ #define IEEE80211_IOC_BEACON_INTERVAL 53 /* beacon interval (ms) */
#define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */ #define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */
#define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */ #define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */
#define IEEE80211_IOC_PUREG 56 /* pure 11g (no 11b stations) */
/* /*
* Scan result data returned for IEEE80211_IOC_SCAN_RESULTS. * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_netbsd.c,v 1.5 2005/07/10 08:11:40 dyoung Exp $ */ /* $NetBSD: ieee80211_netbsd.c,v 1.6 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
* All rights reserved. * All rights reserved.
@ -30,7 +30,7 @@
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.6 2005/01/22 20:29:23 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_freebsd.c,v 1.6 2005/01/22 20:29:23 sam Exp $");
#else #else
__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.5 2005/07/10 08:11:40 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.6 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_netbsd.h,v 1.4 2005/07/10 08:12:50 dyoung Exp $ */ /* $NetBSD: ieee80211_netbsd.h,v 1.5 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2003-2005 Sam Leffler, Errno Consulting * Copyright (c) 2003-2005 Sam Leffler, Errno Consulting
* All rights reserved. * All rights reserved.
@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.2 2004/12/31 22:42:38 sam Exp $ * $FreeBSD: src/sys/net80211/ieee80211_freebsd.h,v 1.5 2005/07/06 01:55:17 sam Exp $
*/ */
#ifndef _NET80211_IEEE80211_NETBSD_H_ #ifndef _NET80211_IEEE80211_NETBSD_H_
#define _NET80211_IEEE80211_NETBSD_H_ #define _NET80211_IEEE80211_NETBSD_H_
@ -177,6 +177,7 @@ int ieee80211_node_dectestref(struct ieee80211_node *ni);
struct mbuf *ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen); struct mbuf *ieee80211_getmgtframe(u_int8_t **frm, u_int pktlen);
#define M_PWR_SAV M_PROTO1 /* bypass PS handling */ #define M_PWR_SAV M_PROTO1 /* bypass PS handling */
#define M_MORE_DATA M_LINK3 /* more data frames to follow */
/* /*
* Encode WME access control bits in the PROTO flags. * Encode WME access control bits in the PROTO flags.
* This is safe since it's passed directly in to the * This is safe since it's passed directly in to the

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_node.c,v 1.41 2005/07/05 19:56:04 dyoung Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.42 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -33,10 +33,10 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.43 2005/02/10 16:59:04 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.48 2005/07/06 01:51:44 sam Exp $");
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.41 2005/07/05 19:56:04 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.42 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
#include "opt_inet.h" #include "opt_inet.h"
@ -70,6 +70,16 @@ __KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.41 2005/07/05 19:56:04 dyoung E
#include <net/if_ether.h> #include <net/if_ether.h>
#endif #endif
/*
* Association id's are managed with a bit vector.
*/
#define IEEE80211_AID_SET(b, w) \
((w)[IEEE80211_AID(b) / 32] |= (1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_CLR(b, w) \
((w)[IEEE80211_AID(b) / 32] &= ~(1 << (IEEE80211_AID(b) % 32)))
#define IEEE80211_AID_ISSET(b, w) \
((w)[IEEE80211_AID(b) / 32] & (1 << (IEEE80211_AID(b) % 32)))
static struct ieee80211_node *node_alloc(struct ieee80211_node_table *); static struct ieee80211_node *node_alloc(struct ieee80211_node_table *);
static void node_cleanup(struct ieee80211_node *); static void node_cleanup(struct ieee80211_node *);
static void node_free(struct ieee80211_node *); static void node_free(struct ieee80211_node *);
@ -885,6 +895,13 @@ node_cleanup(struct ieee80211_node *ni)
"[%s] power save mode off, %u sta's in ps mode\n", "[%s] power save mode off, %u sta's in ps mode\n",
ether_sprintf(ni->ni_macaddr), ic->ic_ps_sta); ether_sprintf(ni->ni_macaddr), ic->ic_ps_sta);
} }
/*
* Clear AREF flag that marks the authorization refcnt bump
* has happened. This is probably not needed as the node
* should always be removed from the table so not found but
* do it just in case.
*/
ni->ni_flags &= ~IEEE80211_NODE_AREF;
/* /*
* Drain power save queue and, if needed, clear TIM. * Drain power save queue and, if needed, clear TIM.
@ -1269,31 +1286,46 @@ ieee80211_find_node_with_ssid(struct ieee80211_node_table *nt,
const u_int8_t *macaddr, u_int ssidlen, const u_int8_t *ssid) const u_int8_t *macaddr, u_int ssidlen, const u_int8_t *ssid)
#endif #endif
{ {
#define MATCH_SSID(ni, ssid, ssidlen) \
(ni->ni_esslen == ssidlen && memcmp(ni->ni_essid, ssid, ssidlen) == 0)
static const u_int8_t zeromac[IEEE80211_ADDR_LEN];
struct ieee80211com *ic = nt->nt_ic; struct ieee80211com *ic = nt->nt_ic;
struct ieee80211_node *ni; struct ieee80211_node *ni;
int hash; int hash;
hash = IEEE80211_NODE_HASH(macaddr);
IEEE80211_NODE_LOCK(nt); IEEE80211_NODE_LOCK(nt);
LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) { /*
if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && * A mac address that is all zero means match only the ssid;
ni->ni_esslen == ic->ic_des_esslen && * otherwise we must match both.
memcmp(ni->ni_essid, ic->ic_des_essid, ni->ni_esslen) == 0) { */
ieee80211_ref_node(ni); /* mark referenced */ if (IEEE80211_ADDR_EQ(macaddr, zeromac)) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE, TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
#ifdef IEEE80211_DEBUG_REFCNT if (MATCH_SSID(ni, ssid, ssidlen))
"%s (%s:%u) %p<%s> refcnt %d\n", __func__, break;
func, line,
#else
"%s %p<%s> refcnt %d\n", __func__,
#endif
ni, ether_sprintf(ni->ni_macaddr),
ieee80211_node_refcnt(ni));
break;
} }
} else {
hash = IEEE80211_NODE_HASH(macaddr);
LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) &&
MATCH_SSID(ni, ssid, ssidlen))
break;
}
}
if (ni != NULL) {
ieee80211_ref_node(ni); /* mark referenced */
IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE,
#ifdef IEEE80211_DEBUG_REFCNT
"%s (%s:%u) %p<%s> refcnt %d\n", __func__,
func, line,
#else
"%s %p<%s> refcnt %d\n", __func__,
#endif
ni, ether_sprintf(ni->ni_macaddr),
ieee80211_node_refcnt(ni));
} }
IEEE80211_NODE_UNLOCK(nt); IEEE80211_NODE_UNLOCK(nt);
return ni; return ni;
#undef MATCH_SSID
} }
static void static void
@ -1458,6 +1490,14 @@ restart:
if (ni->ni_scangen == gen) /* previously handled */ if (ni->ni_scangen == gen) /* previously handled */
continue; continue;
ni->ni_scangen = gen; ni->ni_scangen = gen;
/*
* Ignore entries for which have yet to receive an
* authentication frame. These are transient and
* will be reclaimed when the last reference to them
* goes away (when frame xmits complete).
*/
if ((ni->ni_flags & IEEE80211_NODE_AREF) == 0)
continue;
/* /*
* Free fragment if not needed anymore * Free fragment if not needed anymore
* (last fragment older than 1s). * (last fragment older than 1s).

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_node.h,v 1.17 2005/07/05 23:04:14 he Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.18 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -30,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: src/sys/net80211/ieee80211_node.h,v 1.14 2005/01/24 19:32:09 sam Exp $ * $FreeBSD: src/sys/net80211/ieee80211_node.h,v 1.17 2005/07/06 01:51:44 sam Exp $
*/ */
#ifndef _NET80211_IEEE80211_NODE_H_ #ifndef _NET80211_IEEE80211_NODE_H_
#define _NET80211_IEEE80211_NODE_H_ #define _NET80211_IEEE80211_NODE_H_
@ -102,6 +102,7 @@ struct ieee80211_node {
#define IEEE80211_NODE_ERP 0x0004 /* ERP enabled */ #define IEEE80211_NODE_ERP 0x0004 /* ERP enabled */
/* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */ /* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
#define IEEE80211_NODE_PWR_MGT 0x0010 /* power save mode enabled */ #define IEEE80211_NODE_PWR_MGT 0x0010 /* power save mode enabled */
#define IEEE80211_NODE_AREF 0x0020 /* authentication ref held */
u_int16_t ni_associd; /* assoc response */ u_int16_t ni_associd; /* assoc response */
u_int16_t ni_txpower; /* current transmit power */ u_int16_t ni_txpower; /* current transmit power */
u_int16_t ni_vlan; /* vlan tag */ u_int16_t ni_vlan; /* vlan tag */
@ -138,6 +139,8 @@ struct ieee80211_node {
u_int8_t ni_fhindex; /* FH only */ u_int8_t ni_fhindex; /* FH only */
u_int8_t ni_erp; /* ERP from beacon/probe resp */ u_int8_t ni_erp; /* ERP from beacon/probe resp */
u_int16_t ni_timoff; /* byte offset to TIM ie */ u_int16_t ni_timoff; /* byte offset to TIM ie */
u_int8_t ni_dtim_period; /* DTIM period */
u_int8_t ni_dtim_count; /* DTIM count for last bcn */
/* others */ /* others */
int ni_fails; /* failure count to associate */ int ni_fails; /* failure count to associate */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_output.c,v 1.32 2005/06/27 05:49:13 dyoung Exp $ */ /* $NetBSD: ieee80211_output.c,v 1.33 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -33,10 +33,10 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.20 2005/02/10 17:00:48 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.26 2005/07/06 01:55:17 sam Exp $");
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.32 2005/06/27 05:49:13 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_output.c,v 1.33 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
#include "opt_inet.h" #include "opt_inet.h"
@ -556,6 +556,8 @@ ieee80211_encap(struct ieee80211com *ic, struct mbuf *m,
case IEEE80211_M_MONITOR: case IEEE80211_M_MONITOR:
goto bad; goto bad;
} }
if (m->m_flags & M_MORE_DATA)
wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA;
if (addqos) { if (addqos) {
struct ieee80211_qosframe *qwh = struct ieee80211_qosframe *qwh =
(struct ieee80211_qosframe *) wh; (struct ieee80211_qosframe *) wh;
@ -590,7 +592,7 @@ ieee80211_encap(struct ieee80211com *ic, struct mbuf *m,
!IEEE80211_KEY_UNDEFINED(ni->ni_ucastkey)))) { !IEEE80211_KEY_UNDEFINED(ni->ni_ucastkey)))) {
wh->i_fc[1] |= IEEE80211_FC1_WEP; wh->i_fc[1] |= IEEE80211_FC1_WEP;
/* XXX do fragmentation */ /* XXX do fragmentation */
if (!ieee80211_crypto_enmic(ic, key, m)) { if (!ieee80211_crypto_enmic(ic, key, m, 0)) {
IEEE80211_DPRINTF(ic, IEEE80211_MSG_OUTPUT, IEEE80211_DPRINTF(ic, IEEE80211_MSG_OUTPUT,
"[%s] enmic failed, discard frame\n", "[%s] enmic failed, discard frame\n",
ether_sprintf(eh.ether_dhost)); ether_sprintf(eh.ether_dhost));
@ -918,7 +920,7 @@ ieee80211_setup_wpa_ie(struct ieee80211com *ic, u_int8_t *ie)
} }
/* optional capabilities */ /* optional capabilities */
if (rsn->rsn_caps != 0) if (rsn->rsn_caps != 0 && rsn->rsn_caps != RSN_CAP_PREAUTH)
ADDSHORT(frm, rsn->rsn_caps); ADDSHORT(frm, rsn->rsn_caps);
/* calculate element length */ /* calculate element length */
@ -1001,8 +1003,7 @@ ieee80211_setup_rsn_ie(struct ieee80211com *ic, u_int8_t *ie)
} }
/* optional capabilities */ /* optional capabilities */
if (rsn->rsn_caps != 0) ADDSHORT(frm, rsn->rsn_caps);
ADDSHORT(frm, rsn->rsn_caps);
/* XXX PMKID */ /* XXX PMKID */
/* calculate element length */ /* calculate element length */
@ -1302,16 +1303,6 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
else else
IEEE80211_NODE_STAT(ni, tx_auth_fail); IEEE80211_NODE_STAT(ni, tx_auth_fail);
/*
* When 802.1x is not in use mark the port
* authorized at this point so traffic can flow.
*/
#ifndef IEEE80211_NO_HOSTAP
if (ic->ic_opmode == IEEE80211_M_HOSTAP &&
status == IEEE80211_STATUS_SUCCESS &&
ni->ni_authmode != IEEE80211_AUTH_8021X)
ieee80211_node_authorize(ic, ni);
#endif /* !IEEE80211_NO_HOSTAP */
if (ic->ic_opmode == IEEE80211_M_STA) if (ic->ic_opmode == IEEE80211_M_STA)
timer = IEEE80211_TRANS_WAIT; timer = IEEE80211_TRANS_WAIT;
break; break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_proto.c,v 1.20 2005/06/26 04:31:51 dyoung Exp $ */ /* $NetBSD: ieee80211_proto.c,v 1.21 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -33,10 +33,10 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.15 2005/01/24 20:39:29 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_proto.c,v 1.17 2005/07/04 01:29:41 sam Exp $");
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.20 2005/06/26 04:31:51 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_proto.c,v 1.21 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
/* /*
@ -846,13 +846,31 @@ ieee80211_wme_updateparams(struct ieee80211com *ic)
} }
} }
static void
sta_disassoc(void *arg, struct ieee80211_node *ni)
{
struct ieee80211com *ic = arg;
if (ni->ni_associd != 0) {
IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DISASSOC,
IEEE80211_REASON_ASSOC_LEAVE);
ieee80211_node_leave(ic, ni);
}
}
static void
sta_deauth(void *arg, struct ieee80211_node *ni)
{
struct ieee80211com *ic = arg;
IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_DEAUTH,
IEEE80211_REASON_ASSOC_LEAVE);
}
static int static int
ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{ {
struct ifnet *ifp = ic->ic_ifp; struct ifnet *ifp = ic->ic_ifp;
#ifndef IEEE80211_NO_HOSTAP
struct ieee80211_node_table *nt;
#endif /* !IEEE80211_NO_HOSTAP */
struct ieee80211_node *ni; struct ieee80211_node *ni;
enum ieee80211_state ostate; enum ieee80211_state ostate;
@ -876,16 +894,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
break; break;
case IEEE80211_M_HOSTAP: case IEEE80211_M_HOSTAP:
#ifndef IEEE80211_NO_HOSTAP #ifndef IEEE80211_NO_HOSTAP
nt = &ic->ic_sta; ieee80211_iterate_nodes(&ic->ic_sta,
IEEE80211_NODE_LOCK(nt); sta_disassoc, ic);
TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
if (ni->ni_associd == 0)
continue;
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_DISASSOC,
IEEE80211_REASON_ASSOC_LEAVE);
}
IEEE80211_NODE_UNLOCK(nt);
#endif /* !IEEE80211_NO_HOSTAP */ #endif /* !IEEE80211_NO_HOSTAP */
break; break;
default: default:
@ -901,14 +911,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
break; break;
case IEEE80211_M_HOSTAP: case IEEE80211_M_HOSTAP:
#ifndef IEEE80211_NO_HOSTAP #ifndef IEEE80211_NO_HOSTAP
nt = &ic->ic_sta; ieee80211_iterate_nodes(&ic->ic_sta,
IEEE80211_NODE_LOCK(nt); sta_deauth, ic);
TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_DEAUTH,
IEEE80211_REASON_AUTH_LEAVE);
}
IEEE80211_NODE_UNLOCK(nt);
#endif /* !IEEE80211_NO_HOSTAP */ #endif /* !IEEE80211_NO_HOSTAP */
break; break;
default: default:
@ -974,7 +978,8 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
ni->ni_fails++; ni->ni_fails++;
ieee80211_unref_node(&ni); ieee80211_unref_node(&ni);
} }
ieee80211_begin_scan(ic, arg); if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
ieee80211_begin_scan(ic, arg);
break; break;
} }
break; break;
@ -1006,10 +1011,12 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
ic->ic_state = ostate; /* stay RUN */ ic->ic_state = ostate; /* stay RUN */
break; break;
case IEEE80211_FC0_SUBTYPE_DEAUTH: case IEEE80211_FC0_SUBTYPE_DEAUTH:
/* try to reauth */
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_AUTH, 1);
ieee80211_sta_leave(ic, ni); ieee80211_sta_leave(ic, ni);
if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
/* try to reauth */
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_AUTH, 1);
}
break; break;
} }
break; break;
@ -1028,9 +1035,11 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 0); IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 0);
break; break;
case IEEE80211_S_RUN: case IEEE80211_S_RUN:
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 1);
ieee80211_sta_leave(ic, ni); ieee80211_sta_leave(ic, ni);
if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
IEEE80211_SEND_MGMT(ic, ni,
IEEE80211_FC0_SUBTYPE_ASSOC_REQ, 1);
}
break; break;
} }
break; break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_proto.h,v 1.11 2005/06/27 05:49:13 dyoung Exp $ */ /* $NetBSD: ieee80211_proto.h,v 1.12 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting

View File

@ -1,5 +1,5 @@
/* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */ /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */
/* $NetBSD: ieee80211_radiotap.h,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ /* $NetBSD: ieee80211_radiotap.h,v 1.12 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2003, 2004 David Young. All rights reserved. * Copyright (c) 2003, 2004 David Young. All rights reserved.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_rssadapt.c,v 1.11 2005/06/22 06:16:02 dyoung Exp $ */ /* $NetBSD: ieee80211_rssadapt.c,v 1.12 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2003, 2004 David Young. All rights reserved. * Copyright (c) 2003, 2004 David Young. All rights reserved.
* *
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_rssadapt.c,v 1.11 2005/06/22 06:16:02 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_rssadapt.c,v 1.12 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
#include <sys/param.h> #include <sys/param.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */ /* $NetBSD: ieee80211_rssadapt.h,v 1.5 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2003, 2004 David Young. All rights reserved. * Copyright (c) 2003, 2004 David Young. All rights reserved.
* *

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_sysctl.h,v 1.4 2005/06/26 04:34:43 dyoung Exp $ */ /* $NetBSD: ieee80211_sysctl.h,v 1.5 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2005 David Young. All rights reserved. * Copyright (c) 2005 David Young. All rights reserved.
* *

View File

@ -1,4 +1,4 @@
/* $NetBSD: ieee80211_var.h,v 1.19 2005/06/22 06:16:02 dyoung Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.20 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2001 Atsushi Onoe
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@ -30,7 +30,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.20 2005/01/24 19:39:07 sam Exp $ * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.22 2005/07/06 15:38:27 sam Exp $
*/ */
#ifndef _NET80211_IEEE80211_VAR_H_ #ifndef _NET80211_IEEE80211_VAR_H_
#define _NET80211_IEEE80211_VAR_H_ #define _NET80211_IEEE80211_VAR_H_
@ -132,7 +132,8 @@ struct ieee80211com {
u_int16_t ic_ps_pending; /* ps sta's w/ pending frames */ u_int16_t ic_ps_pending; /* ps sta's w/ pending frames */
u_int8_t *ic_tim_bitmap; /* power-save stations w/ data*/ u_int8_t *ic_tim_bitmap; /* power-save stations w/ data*/
u_int16_t ic_tim_len; /* ic_tim_bitmap size (bytes) */ u_int16_t ic_tim_len; /* ic_tim_bitmap size (bytes) */
u_int16_t ic_dtim_period; /* DTIM period */ u_int8_t ic_dtim_period; /* DTIM period */
u_int8_t ic_dtim_count; /* DTIM count for last bcn */
struct ifmedia ic_media; /* interface media config */ struct ifmedia ic_media; /* interface media config */
caddr_t ic_rawbpf; /* packet filter structure */ caddr_t ic_rawbpf; /* packet filter structure */
struct ieee80211_node *ic_bss; /* information for this node */ struct ieee80211_node *ic_bss; /* information for this node */
@ -206,9 +207,10 @@ extern struct ieee80211com_head ieee80211com_head;
#define IEEE80211_ADDR_COPY(dst,src) memcpy(dst,src,IEEE80211_ADDR_LEN) #define IEEE80211_ADDR_COPY(dst,src) memcpy(dst,src,IEEE80211_ADDR_LEN)
/* ic_flags */ /* ic_flags */
/* NB: bits 0x6f available */ /* NB: bits 0x4f available */
/* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */ /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */
#define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */ #define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */
#define IEEE80211_F_PUREG 0x00000020 /* CONF: 11g w/o 11b sta's */
#define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */ #define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */
#define IEEE80211_F_ASCAN 0x00000100 /* STATUS: active scan */ #define IEEE80211_F_ASCAN 0x00000100 /* STATUS: active scan */
#define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */ #define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */

View File

@ -35,7 +35,7 @@
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_xauth.c,v 1.2 2004/12/31 22:42:38 sam Exp $"); __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_xauth.c,v 1.2 2004/12/31 22:42:38 sam Exp $");
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
__KERNEL_RCSID(0, "$NetBSD: ieee80211_xauth.c,v 1.2 2005/06/22 06:16:02 dyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: ieee80211_xauth.c,v 1.3 2005/07/26 22:52:48 dyoung Exp $");
#endif #endif
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbuf.h,v 1.112 2005/06/06 06:06:50 martin Exp $ */ /* $NetBSD: mbuf.h,v 1.113 2005/07/26 22:52:48 dyoung Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc.
@ -298,6 +298,7 @@ MBUF_DEFINE(mbuf, MHLEN, MLEN);
#define M_LINK0 0x1000 /* link layer specific flag */ #define M_LINK0 0x1000 /* link layer specific flag */
#define M_LINK1 0x2000 /* link layer specific flag */ #define M_LINK1 0x2000 /* link layer specific flag */
#define M_LINK2 0x4000 /* link layer specific flag */ #define M_LINK2 0x4000 /* link layer specific flag */
#define M_LINK3 0x8000 /* link layer specific flag */
/* additional flags for M_EXT mbufs */ /* additional flags for M_EXT mbufs */
#define M_EXT_FLAGS 0xff000000 #define M_EXT_FLAGS 0xff000000