Deleted Added
full compact
ieee80211_input.c (195618) ieee80211_input.c (195757)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 195618 2009-07-11 15:02:45Z rpaulo $");
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.c 195757 2009-07-18 20:19:53Z sam $");
29
30#include "opt_wlan.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/mbuf.h>
35#include <sys/malloc.h>
36#include <sys/endian.h>

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

280 break;
281 case IEEE80211_FC1_DIR_DSTODS:
282 IEEE80211_ADDR_COPY(eh->ether_dhost, wh.i_addr3);
283 IEEE80211_ADDR_COPY(eh->ether_shost, wh.i_addr4);
284 break;
285 }
286#ifdef ALIGNED_POINTER
287 if (!ALIGNED_POINTER(mtod(m, caddr_t) + sizeof(*eh), uint32_t)) {
29
30#include "opt_wlan.h"
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/mbuf.h>
35#include <sys/malloc.h>
36#include <sys/endian.h>

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

280 break;
281 case IEEE80211_FC1_DIR_DSTODS:
282 IEEE80211_ADDR_COPY(eh->ether_dhost, wh.i_addr3);
283 IEEE80211_ADDR_COPY(eh->ether_shost, wh.i_addr4);
284 break;
285 }
286#ifdef ALIGNED_POINTER
287 if (!ALIGNED_POINTER(mtod(m, caddr_t) + sizeof(*eh), uint32_t)) {
288 struct mbuf *n, *n0, **np;
289 caddr_t newdata;
290 int off, pktlen;
291
292 n0 = NULL;
293 np = &n0;
294 off = 0;
295 pktlen = m->m_pkthdr.len;
296 while (pktlen > off) {
297 if (n0 == NULL) {
298 MGETHDR(n, M_DONTWAIT, MT_DATA);
299 if (n == NULL) {
300 m_freem(m);
301 return NULL;
302 }
303 M_MOVE_PKTHDR(n, m);
304 n->m_len = MHLEN;
305 } else {
306 MGET(n, M_DONTWAIT, MT_DATA);
307 if (n == NULL) {
308 m_freem(m);
309 m_freem(n0);
310 return NULL;
311 }
312 n->m_len = MLEN;
313 }
314 if (pktlen - off >= MINCLSIZE) {
315 MCLGET(n, M_DONTWAIT);
316 if (n->m_flags & M_EXT)
317 n->m_len = n->m_ext.ext_size;
318 }
319 if (n0 == NULL) {
320 newdata =
321 (caddr_t)ALIGN(n->m_data + sizeof(*eh)) -
322 sizeof(*eh);
323 n->m_len -= newdata - n->m_data;
324 n->m_data = newdata;
325 }
326 if (n->m_len > pktlen - off)
327 n->m_len = pktlen - off;
328 m_copydata(m, off, n->m_len, mtod(n, caddr_t));
329 off += n->m_len;
330 *np = n;
331 np = &n->m_next;
332 }
333 m_freem(m);
334 m = n0;
288 m = ieee80211_realign(vap, m, sizeof(*eh));
289 if (m == NULL)
290 return NULL;
335 }
336#endif /* ALIGNED_POINTER */
337 if (llc != NULL) {
338 eh = mtod(m, struct ether_header *);
339 eh->ether_type = htons(m->m_pkthdr.len - sizeof(*eh));
340 }
341 return m;
342#undef wh

--- 557 unchanged lines hidden ---
291 }
292#endif /* ALIGNED_POINTER */
293 if (llc != NULL) {
294 eh = mtod(m, struct ether_header *);
295 eh->ether_type = htons(m->m_pkthdr.len - sizeof(*eh));
296 }
297 return m;
298#undef wh

--- 557 unchanged lines hidden ---