summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net80211/ieee80211_output.c')
-rw-r--r--sys/net80211/ieee80211_output.c87
1 files changed, 41 insertions, 46 deletions
diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c
index ca7f2433d5e..37d1f5af9a5 100644
--- a/sys/net80211/ieee80211_output.c
+++ b/sys/net80211/ieee80211_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_output.c,v 1.12 2005/09/08 12:44:55 jsg Exp $ */
+/* $OpenBSD: ieee80211_output.c,v 1.13 2005/09/08 13:24:53 reyk Exp $ */
/* $NetBSD: ieee80211_output.c,v 1.13 2004/05/31 11:02:55 dyoung Exp $ */
/*-
@@ -78,7 +78,7 @@ ieee80211_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
u_int dlt = 0;
int s, error = 0;
struct m_tag *mtag;
-
+
/* Interface has to be up and running */
if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
(IFF_UP | IFF_RUNNING)) {
@@ -227,10 +227,10 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node **pni)
/* Handle raw frames if mbuf is tagged as 802.11 */
if ((mtag = m_tag_find(m, PACKET_TAG_DLT, NULL)) != NULL) {
dlt = *(u_int *)(mtag + 1);
-
+
if (!(dlt == DLT_IEEE802_11 || dlt == DLT_IEEE802_11_RADIO))
goto fallback;
-
+
wh = mtod(m, struct ieee80211_frame *);
if (m->m_pkthdr.len < sizeof(struct ieee80211_frame_min))
@@ -379,9 +379,11 @@ ieee80211_compute_duration1(int len, int use_ack, uint32_t flags, int rate,
pre = IEEE80211_DUR_DS_SIFS;
if ((flags & IEEE80211_F_SHPREAMBLE) != 0)
- pre += IEEE80211_DUR_DS_SHORT_PREAMBLE + IEEE80211_DUR_DS_FAST_PLCPHDR;
+ pre += IEEE80211_DUR_DS_SHORT_PREAMBLE +
+ IEEE80211_DUR_DS_FAST_PLCPHDR;
else
- pre += IEEE80211_DUR_DS_LONG_PREAMBLE + IEEE80211_DUR_DS_SLOW_PLCPHDR;
+ pre += IEEE80211_DUR_DS_LONG_PREAMBLE +
+ IEEE80211_DUR_DS_SLOW_PLCPHDR;
d->d_residue = 0;
data_dur = (bitlen * 2) / rate;
@@ -605,14 +607,14 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
* [tlv] extended supported rates
*/
m = ieee80211_getmbuf(M_DONTWAIT, MT_DATA,
- 2 + ic->ic_des_esslen
- + 2 + IEEE80211_RATE_SIZE
- + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
+ 2 + ic->ic_des_esslen + 2 + IEEE80211_RATE_SIZE +
+ 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
if (m == NULL)
senderr(ENOMEM, is_tx_nombuf);
m->m_data += sizeof(struct ieee80211_frame);
frm = mtod(m, u_int8_t *);
- frm = ieee80211_add_ssid(frm, ic->ic_des_essid, ic->ic_des_esslen);
+ frm = ieee80211_add_ssid(frm, ic->ic_des_essid,
+ ic->ic_des_esslen);
mode = ieee80211_chan2mode(ic, ni->ni_chan);
frm = ieee80211_add_rates(frm, &ic->ic_sup_rates[mode]);
frm = ieee80211_add_xrates(frm, &ic->ic_sup_rates[mode]);
@@ -634,12 +636,10 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
* [tlv] extended supported rates
*/
m = ieee80211_getmbuf(M_DONTWAIT, MT_DATA,
- 8 + 2 + 2 + 2
- + 2 + ni->ni_esslen
- + 2 + IEEE80211_RATE_SIZE
- + (ic->ic_phytype == IEEE80211_T_FH ? 7 : 3)
- + 6
- + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
+ 8 + 2 + 2 + 2 + 2 + ni->ni_esslen +
+ 2 + IEEE80211_RATE_SIZE +
+ (ic->ic_phytype == IEEE80211_T_FH ? 7 : 3) + 6 +
+ 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
if (m == NULL)
senderr(ENOMEM, is_tx_nombuf);
m->m_data += sizeof(struct ieee80211_frame);
@@ -666,15 +666,15 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
frm = ieee80211_add_rates(frm, &ic->ic_bss->ni_rates);
if (ic->ic_phytype == IEEE80211_T_FH) {
- *frm++ = IEEE80211_ELEMID_FHPARMS;
- *frm++ = 5;
- *frm++ = ni->ni_fhdwell & 0x00ff;
- *frm++ = (ni->ni_fhdwell >> 8) & 0x00ff;
- *frm++ = IEEE80211_FH_CHANSET(
+ *frm++ = IEEE80211_ELEMID_FHPARMS;
+ *frm++ = 5;
+ *frm++ = ni->ni_fhdwell & 0x00ff;
+ *frm++ = (ni->ni_fhdwell >> 8) & 0x00ff;
+ *frm++ = IEEE80211_FH_CHANSET(
ieee80211_chan2ieee(ic, ni->ni_chan));
- *frm++ = IEEE80211_FH_CHANPAT(
+ *frm++ = IEEE80211_FH_CHANPAT(
ieee80211_chan2ieee(ic, ni->ni_chan));
- *frm++ = ni->ni_fhindex;
+ *frm++ = ni->ni_fhindex;
} else {
*frm++ = IEEE80211_ELEMID_DSPARMS;
*frm++ = 1;
@@ -692,7 +692,7 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
*frm++ = 0; /* DTIM count */
*frm++ = 1; /* DTIM period */
*frm++ = 0; /* bitmap control */
- *frm++ = 0; /* Partial Virtual Bitmap (variable length) */
+ *frm++ = 0; /* Partial Virtual Bitmap (variable) */
}
frm = ieee80211_add_xrates(frm, &ic->ic_bss->ni_rates);
m->m_pkthdr.len = m->m_len = frm - mtod(m, u_int8_t *);
@@ -720,8 +720,8 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
}
frm = mtod(m, u_int8_t *);
((u_int16_t *)frm)[0] =
- (is_shared_key) ? htole16(IEEE80211_AUTH_ALG_SHARED)
- : htole16(IEEE80211_AUTH_ALG_OPEN);
+ (is_shared_key) ? htole16(IEEE80211_AUTH_ALG_SHARED) :
+ htole16(IEEE80211_AUTH_ALG_OPEN);
((u_int16_t *)frm)[1] = htole16(arg); /* sequence number */
((u_int16_t *)frm)[2] = 0; /* status */
@@ -765,12 +765,10 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
* [tlv] extended supported rates
*/
m = ieee80211_getmbuf(M_DONTWAIT, MT_DATA,
- sizeof(capinfo)
- + sizeof(u_int16_t)
- + IEEE80211_ADDR_LEN
- + 2 + ni->ni_esslen
- + 2 + IEEE80211_RATE_SIZE
- + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
+ sizeof(capinfo) + sizeof(u_int16_t) +
+ IEEE80211_ADDR_LEN + 2 + ni->ni_esslen +
+ 2 + IEEE80211_RATE_SIZE + 2 +
+ (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
if (m == NULL)
senderr(ENOMEM, is_tx_nombuf);
m->m_data += sizeof(struct ieee80211_frame);
@@ -822,11 +820,9 @@ ieee80211_send_mgmt(struct ieee80211com *ic, struct ieee80211_node *ni,
* [tlv] extended supported rates
*/
m = ieee80211_getmbuf(M_DONTWAIT, MT_DATA,
- sizeof(capinfo)
- + sizeof(u_int16_t)
- + sizeof(u_int16_t)
- + 2 + IEEE80211_RATE_SIZE
- + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
+ sizeof(capinfo) + sizeof(u_int16_t) +
+ sizeof(u_int16_t) + 2 + IEEE80211_RATE_SIZE +
+ 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
if (m == NULL)
senderr(ENOMEM, is_tx_nombuf);
m->m_data += sizeof(struct ieee80211_frame);
@@ -900,9 +896,8 @@ ieee80211_beacon_alloc(struct ieee80211com *ic, struct ieee80211_node *ni)
if (rs->rs_nrates > IEEE80211_RATE_SIZE)
pktlen += 2;
m = ieee80211_getmbuf(M_DONTWAIT, MT_DATA,
- 2 + ic->ic_des_esslen
- + 2 + IEEE80211_RATE_SIZE
- + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
+ 2 + ic->ic_des_esslen + 2 + IEEE80211_RATE_SIZE +
+ 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE));
if (m == NULL)
return NULL;
@@ -977,7 +972,7 @@ ieee80211_beacon_alloc(struct ieee80211com *ic, struct ieee80211_node *ni)
void
ieee80211_pwrsave(struct ieee80211com *ic, struct ieee80211_node *ni,
- struct mbuf *m)
+ struct mbuf *m)
{
/* Store the new packet on our queue, changing the TIM if necessary */
@@ -989,11 +984,11 @@ ieee80211_pwrsave(struct ieee80211com *ic, struct ieee80211_node *ni,
m_freem(m);
if (ic->ic_if.if_flags & IFF_DEBUG)
printf("%s: station %s power save queue overflow"
- " of size %d drops %d\n",
- ic->ic_if.if_xname,
- ether_sprintf(ni->ni_macaddr),
- IEEE80211_PS_MAX_QUEUE,
- ni->ni_savedq.ifq_drops);
+ " of size %d drops %d\n",
+ ic->ic_if.if_xname,
+ ether_sprintf(ni->ni_macaddr),
+ IEEE80211_PS_MAX_QUEUE,
+ ni->ni_savedq.ifq_drops);
} else {
/* Similar to ieee80211_mgmt_output, store the node in
* the rcvif field.