util.c (6032f934c818e5c3435c9f17274fe1983f53c6b4) util.c (ee3858551ae6d044578f598f8001db5f1a9fd52e)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 12 unchanged lines hidden (view full) ---

21#include <linux/wireless.h>
22#include <linux/bitmap.h>
23#include <net/net_namespace.h>
24#include <net/cfg80211.h>
25#include <net/rtnetlink.h>
26
27#include "ieee80211_i.h"
28#include "ieee80211_rate.h"
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 12 unchanged lines hidden (view full) ---

21#include <linux/wireless.h>
22#include <linux/bitmap.h>
23#include <net/net_namespace.h>
24#include <net/cfg80211.h>
25#include <net/rtnetlink.h>
26
27#include "ieee80211_i.h"
28#include "ieee80211_rate.h"
29#ifdef CONFIG_MAC80211_MESH
30#include "mesh.h"
31#endif
29#include "wme.h"
30
31/* privid for wiphys to determine whether they belong to us or not */
32void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
33
34/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
35/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
36const unsigned char rfc1042_header[] =

--- 104 unchanged lines hidden (view full) ---

141 return 0;
142 hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
143 if (unlikely(hdrlen > skb->len))
144 return 0;
145 return hdrlen;
146}
147EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
148
32#include "wme.h"
33
34/* privid for wiphys to determine whether they belong to us or not */
35void *mac80211_wiphy_privid = &mac80211_wiphy_privid;
36
37/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
38/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
39const unsigned char rfc1042_header[] =

--- 104 unchanged lines hidden (view full) ---

144 return 0;
145 hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
146 if (unlikely(hdrlen > skb->len))
147 return 0;
148 return hdrlen;
149}
150EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
151
152#ifdef CONFIG_MAC80211_MESH
153int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
154{
155 int ae = meshhdr->flags & IEEE80211S_FLAGS_AE;
156 /* 7.1.3.5a.2 */
157 switch (ae) {
158 case 0:
159 return 5;
160 case 1:
161 return 11;
162 case 2:
163 return 17;
164 case 3:
165 return 23;
166 default:
167 return 5;
168 }
169}
170#endif
171
149void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx)
150{
151 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
152
153 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
154 if (tx->u.tx.extra_frag) {
155 struct ieee80211_hdr *fhdr;
156 int i;

--- 233 unchanged lines hidden (view full) ---

390 if (netif_running(sdata->dev))
391 iterator(data, sdata->dev->dev_addr,
392 &sdata->vif);
393 }
394
395 rcu_read_unlock();
396}
397EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
172void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx)
173{
174 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
175
176 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
177 if (tx->u.tx.extra_frag) {
178 struct ieee80211_hdr *fhdr;
179 int i;

--- 233 unchanged lines hidden (view full) ---

413 if (netif_running(sdata->dev))
414 iterator(data, sdata->dev->dev_addr,
415 &sdata->vif);
416 }
417
418 rcu_read_unlock();
419}
420EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
421
422#ifdef CONFIG_MAC80211_MESH
423/**
424 * ieee80211_new_mesh_header - create a new mesh header
425 * @meshhdr: uninitialized mesh header
426 * @sdata: mesh interface to be used
427 *
428 * Return the header length.
429 */
430int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
431 struct ieee80211_sub_if_data *sdata)
432{
433 meshhdr->flags = 0;
434 meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL;
435
436 meshhdr->seqnum[0] = sdata->u.sta.mesh_seqnum[0]++;
437 meshhdr->seqnum[1] = sdata->u.sta.mesh_seqnum[1];
438 meshhdr->seqnum[2] = sdata->u.sta.mesh_seqnum[2];
439
440 if (sdata->u.sta.mesh_seqnum[0] == 0) {
441 sdata->u.sta.mesh_seqnum[1]++;
442 if (sdata->u.sta.mesh_seqnum[1] == 0)
443 sdata->u.sta.mesh_seqnum[2]++;
444 }
445
446 return 5;
447}
448#endif