Deleted Added
full compact
ieee80211_action.c (195377) ieee80211_action.c (195618)
1/*-
2 * Copyright (c) 2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27#ifdef __FreeBSD__
1/*-
2 * Copyright (c) 2009 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27#ifdef __FreeBSD__
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_action.c 195377 2009-07-05 17:59:19Z sam $");
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_action.c 195618 2009-07-11 15:02:45Z rpaulo $");
29#endif
30
31/*
32 * IEEE 802.11 send/recv action frame support.
33 */
34
35#include "opt_inet.h"
36#include "opt_wlan.h"

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

42#include <sys/socket.h>
43
44#include <net/if.h>
45#include <net/if_media.h>
46#include <net/ethernet.h>
47
48#include <net80211/ieee80211_var.h>
49#include <net80211/ieee80211_action.h>
29#endif
30
31/*
32 * IEEE 802.11 send/recv action frame support.
33 */
34
35#include "opt_inet.h"
36#include "opt_wlan.h"

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

42#include <sys/socket.h>
43
44#include <net/if.h>
45#include <net/if_media.h>
46#include <net/ethernet.h>
47
48#include <net80211/ieee80211_var.h>
49#include <net80211/ieee80211_action.h>
50#include <net80211/ieee80211_mesh.h>
50
51static int
52send_inval(struct ieee80211_node *ni, int cat, int act, void *sa)
53{
54 return EINVAL;
55}
56
57static ieee80211_send_action_func *ba_send_action[8] = {
58 send_inval, send_inval, send_inval, send_inval,
59 send_inval, send_inval, send_inval, send_inval,
60};
61static ieee80211_send_action_func *ht_send_action[8] = {
62 send_inval, send_inval, send_inval, send_inval,
63 send_inval, send_inval, send_inval, send_inval,
64};
51
52static int
53send_inval(struct ieee80211_node *ni, int cat, int act, void *sa)
54{
55 return EINVAL;
56}
57
58static ieee80211_send_action_func *ba_send_action[8] = {
59 send_inval, send_inval, send_inval, send_inval,
60 send_inval, send_inval, send_inval, send_inval,
61};
62static ieee80211_send_action_func *ht_send_action[8] = {
63 send_inval, send_inval, send_inval, send_inval,
64 send_inval, send_inval, send_inval, send_inval,
65};
65/* NB: temporary until 802.11s support is added */
66#ifdef IEEE80211_ACTION_CAT_MESHPEERING
67static ieee80211_send_action_func *meshpl_send_action[8] = {
68 send_inval, send_inval, send_inval, send_inval,
69 send_inval, send_inval, send_inval, send_inval,
70};
71static ieee80211_send_action_func *meshlm_send_action[4] = {
72 send_inval, send_inval, send_inval, send_inval,
73};
74static ieee80211_send_action_func *hwmp_send_action[8] = {
75 send_inval, send_inval, send_inval, send_inval,
76 send_inval, send_inval, send_inval, send_inval,
77};
66static ieee80211_send_action_func *meshpl_send_action[8] = {
67 send_inval, send_inval, send_inval, send_inval,
68 send_inval, send_inval, send_inval, send_inval,
69};
70static ieee80211_send_action_func *meshlm_send_action[4] = {
71 send_inval, send_inval, send_inval, send_inval,
72};
73static ieee80211_send_action_func *hwmp_send_action[8] = {
74 send_inval, send_inval, send_inval, send_inval,
75 send_inval, send_inval, send_inval, send_inval,
76};
78#endif
79static ieee80211_send_action_func *vendor_send_action[8] = {
80 send_inval, send_inval, send_inval, send_inval,
81 send_inval, send_inval, send_inval, send_inval,
82};
83
84int
85ieee80211_send_action_register(int cat, int act, ieee80211_send_action_func *f)
86{

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

91 break;
92 ba_send_action[act] = f;
93 return 0;
94 case IEEE80211_ACTION_CAT_HT:
95 if (act >= N(ht_send_action))
96 break;
97 ht_send_action[act] = f;
98 return 0;
77static ieee80211_send_action_func *vendor_send_action[8] = {
78 send_inval, send_inval, send_inval, send_inval,
79 send_inval, send_inval, send_inval, send_inval,
80};
81
82int
83ieee80211_send_action_register(int cat, int act, ieee80211_send_action_func *f)
84{

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

89 break;
90 ba_send_action[act] = f;
91 return 0;
92 case IEEE80211_ACTION_CAT_HT:
93 if (act >= N(ht_send_action))
94 break;
95 ht_send_action[act] = f;
96 return 0;
99#ifdef IEEE80211_ACTION_CAT_MESHPEERING
100 case IEEE80211_ACTION_CAT_MESHPEERING:
101 if (act >= N(meshpl_send_action))
102 break;
103 meshpl_send_action[act] = f;
104 return 0;
105 case IEEE80211_ACTION_CAT_MESHLMETRIC:
106 if (act >= N(meshlm_send_action))
107 break;
108 meshlm_send_action[act] = f;
109 return 0;
110 case IEEE80211_ACTION_CAT_MESHPATH:
111 if (act > N(hwmp_send_action))
112 break;
113 hwmp_send_action[act] = f;
114 return 0;
97 case IEEE80211_ACTION_CAT_MESHPEERING:
98 if (act >= N(meshpl_send_action))
99 break;
100 meshpl_send_action[act] = f;
101 return 0;
102 case IEEE80211_ACTION_CAT_MESHLMETRIC:
103 if (act >= N(meshlm_send_action))
104 break;
105 meshlm_send_action[act] = f;
106 return 0;
107 case IEEE80211_ACTION_CAT_MESHPATH:
108 if (act > N(hwmp_send_action))
109 break;
110 hwmp_send_action[act] = f;
111 return 0;
115#endif
116 case IEEE80211_ACTION_CAT_VENDOR:
117 if (act >= N(vendor_send_action))
118 break;
119 vendor_send_action[act] = f;
120 return 0;
121 }
122 return EINVAL;
123#undef N

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

139 case IEEE80211_ACTION_CAT_BA:
140 if (act < N(ba_send_action))
141 f = ba_send_action[act];
142 break;
143 case IEEE80211_ACTION_CAT_HT:
144 if (act < N(ht_send_action))
145 f = ht_send_action[act];
146 break;
112 case IEEE80211_ACTION_CAT_VENDOR:
113 if (act >= N(vendor_send_action))
114 break;
115 vendor_send_action[act] = f;
116 return 0;
117 }
118 return EINVAL;
119#undef N

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

135 case IEEE80211_ACTION_CAT_BA:
136 if (act < N(ba_send_action))
137 f = ba_send_action[act];
138 break;
139 case IEEE80211_ACTION_CAT_HT:
140 if (act < N(ht_send_action))
141 f = ht_send_action[act];
142 break;
147#ifdef IEEE80211_ACTION_CAT_MESHPEERING
148 case IEEE80211_ACTION_CAT_MESHPEERING:
149 if (act < N(meshpl_send_action))
150 f = meshpl_send_action[act];
151 break;
152 case IEEE80211_ACTION_CAT_MESHLMETRIC:
153 if (act < N(meshlm_send_action))
154 f = meshlm_send_action[act];
155 break;
156 case IEEE80211_ACTION_CAT_MESHPATH:
157 if (act < N(hwmp_send_action))
158 f = hwmp_send_action[act];
159 break;
143 case IEEE80211_ACTION_CAT_MESHPEERING:
144 if (act < N(meshpl_send_action))
145 f = meshpl_send_action[act];
146 break;
147 case IEEE80211_ACTION_CAT_MESHLMETRIC:
148 if (act < N(meshlm_send_action))
149 f = meshlm_send_action[act];
150 break;
151 case IEEE80211_ACTION_CAT_MESHPATH:
152 if (act < N(hwmp_send_action))
153 f = hwmp_send_action[act];
154 break;
160#endif
161 case IEEE80211_ACTION_CAT_VENDOR:
162 if (act < N(vendor_send_action))
163 f = vendor_send_action[act];
164 break;
165 }
166 return f(ni, cat, act, sa);
167#undef N
168}

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

177static ieee80211_recv_action_func *ba_recv_action[8] = {
178 recv_inval, recv_inval, recv_inval, recv_inval,
179 recv_inval, recv_inval, recv_inval, recv_inval,
180};
181static ieee80211_recv_action_func *ht_recv_action[8] = {
182 recv_inval, recv_inval, recv_inval, recv_inval,
183 recv_inval, recv_inval, recv_inval, recv_inval,
184};
155 case IEEE80211_ACTION_CAT_VENDOR:
156 if (act < N(vendor_send_action))
157 f = vendor_send_action[act];
158 break;
159 }
160 return f(ni, cat, act, sa);
161#undef N
162}

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

171static ieee80211_recv_action_func *ba_recv_action[8] = {
172 recv_inval, recv_inval, recv_inval, recv_inval,
173 recv_inval, recv_inval, recv_inval, recv_inval,
174};
175static ieee80211_recv_action_func *ht_recv_action[8] = {
176 recv_inval, recv_inval, recv_inval, recv_inval,
177 recv_inval, recv_inval, recv_inval, recv_inval,
178};
185#ifdef IEEE80211_ACTION_CAT_MESHPEERING
186static ieee80211_recv_action_func *meshpl_recv_action[8] = {
187 recv_inval, recv_inval, recv_inval, recv_inval,
188 recv_inval, recv_inval, recv_inval, recv_inval,
189};
190static ieee80211_recv_action_func *meshlm_recv_action[4] = {
191 recv_inval, recv_inval, recv_inval, recv_inval,
192};
193static ieee80211_recv_action_func *hwmp_recv_action[8] = {
194 recv_inval, recv_inval, recv_inval, recv_inval,
195 recv_inval, recv_inval, recv_inval, recv_inval,
196};
179static ieee80211_recv_action_func *meshpl_recv_action[8] = {
180 recv_inval, recv_inval, recv_inval, recv_inval,
181 recv_inval, recv_inval, recv_inval, recv_inval,
182};
183static ieee80211_recv_action_func *meshlm_recv_action[4] = {
184 recv_inval, recv_inval, recv_inval, recv_inval,
185};
186static ieee80211_recv_action_func *hwmp_recv_action[8] = {
187 recv_inval, recv_inval, recv_inval, recv_inval,
188 recv_inval, recv_inval, recv_inval, recv_inval,
189};
197#endif
198static ieee80211_recv_action_func *vendor_recv_action[8] = {
199 recv_inval, recv_inval, recv_inval, recv_inval,
200 recv_inval, recv_inval, recv_inval, recv_inval,
201};
202
203int
204ieee80211_recv_action_register(int cat, int act, ieee80211_recv_action_func *f)
205{

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

210 break;
211 ba_recv_action[act] = f;
212 return 0;
213 case IEEE80211_ACTION_CAT_HT:
214 if (act >= N(ht_recv_action))
215 break;
216 ht_recv_action[act] = f;
217 return 0;
190static ieee80211_recv_action_func *vendor_recv_action[8] = {
191 recv_inval, recv_inval, recv_inval, recv_inval,
192 recv_inval, recv_inval, recv_inval, recv_inval,
193};
194
195int
196ieee80211_recv_action_register(int cat, int act, ieee80211_recv_action_func *f)
197{

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

202 break;
203 ba_recv_action[act] = f;
204 return 0;
205 case IEEE80211_ACTION_CAT_HT:
206 if (act >= N(ht_recv_action))
207 break;
208 ht_recv_action[act] = f;
209 return 0;
218#ifdef IEEE80211_ACTION_CAT_MESHPEERING
219 case IEEE80211_ACTION_CAT_MESHPEERING:
220 if (act >= N(meshpl_recv_action))
221 break;
222 meshpl_recv_action[act] = f;
223 return 0;
224 case IEEE80211_ACTION_CAT_MESHLMETRIC:
225 if (act >= N(meshlm_recv_action))
226 break;
227 meshlm_recv_action[act] = f;
228 return 0;
229 case IEEE80211_ACTION_CAT_MESHPATH:
230 if (act >= N(hwmp_recv_action))
231 break;
232 hwmp_recv_action[act] = f;
233 return 0;
210 case IEEE80211_ACTION_CAT_MESHPEERING:
211 if (act >= N(meshpl_recv_action))
212 break;
213 meshpl_recv_action[act] = f;
214 return 0;
215 case IEEE80211_ACTION_CAT_MESHLMETRIC:
216 if (act >= N(meshlm_recv_action))
217 break;
218 meshlm_recv_action[act] = f;
219 return 0;
220 case IEEE80211_ACTION_CAT_MESHPATH:
221 if (act >= N(hwmp_recv_action))
222 break;
223 hwmp_recv_action[act] = f;
224 return 0;
234#endif
235 case IEEE80211_ACTION_CAT_VENDOR:
236 if (act >= N(vendor_recv_action))
237 break;
238 vendor_recv_action[act] = f;
239 return 0;
240 }
241 return EINVAL;
242#undef N

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

262 case IEEE80211_ACTION_CAT_BA:
263 if (ia->ia_action < N(ba_recv_action))
264 f = ba_recv_action[ia->ia_action];
265 break;
266 case IEEE80211_ACTION_CAT_HT:
267 if (ia->ia_action < N(ht_recv_action))
268 f = ht_recv_action[ia->ia_action];
269 break;
225 case IEEE80211_ACTION_CAT_VENDOR:
226 if (act >= N(vendor_recv_action))
227 break;
228 vendor_recv_action[act] = f;
229 return 0;
230 }
231 return EINVAL;
232#undef N

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

252 case IEEE80211_ACTION_CAT_BA:
253 if (ia->ia_action < N(ba_recv_action))
254 f = ba_recv_action[ia->ia_action];
255 break;
256 case IEEE80211_ACTION_CAT_HT:
257 if (ia->ia_action < N(ht_recv_action))
258 f = ht_recv_action[ia->ia_action];
259 break;
270#ifdef IEEE80211_ACTION_CAT_MESHPEERING
271 case IEEE80211_ACTION_CAT_MESHPEERING:
272 if (ia->ia_action < N(meshpl_recv_action))
273 f = meshpl_recv_action[ia->ia_action];
274 break;
275 case IEEE80211_ACTION_CAT_MESHLMETRIC:
276 if (ia->ia_action < N(meshlm_recv_action))
277 f = meshlm_recv_action[ia->ia_action];
278 break;
279 case IEEE80211_ACTION_CAT_MESHPATH:
280 if (ia->ia_action < N(hwmp_recv_action))
281 f = hwmp_recv_action[ia->ia_action];
282 break;
260 case IEEE80211_ACTION_CAT_MESHPEERING:
261 if (ia->ia_action < N(meshpl_recv_action))
262 f = meshpl_recv_action[ia->ia_action];
263 break;
264 case IEEE80211_ACTION_CAT_MESHLMETRIC:
265 if (ia->ia_action < N(meshlm_recv_action))
266 f = meshlm_recv_action[ia->ia_action];
267 break;
268 case IEEE80211_ACTION_CAT_MESHPATH:
269 if (ia->ia_action < N(hwmp_recv_action))
270 f = hwmp_recv_action[ia->ia_action];
271 break;
283#endif
284 case IEEE80211_ACTION_CAT_VENDOR:
285 if (ia->ia_action < N(vendor_recv_action))
286 f = vendor_recv_action[ia->ia_action];
287 break;
288 }
289 return f(ni, wh, frm, efrm);
290#undef N
291}
272 case IEEE80211_ACTION_CAT_VENDOR:
273 if (ia->ia_action < N(vendor_recv_action))
274 f = vendor_recv_action[ia->ia_action];
275 break;
276 }
277 return f(ni, wh, frm, efrm);
278#undef N
279}